Inserting data by row
Added by Alonso Uribe almost 11 years ago
I just get the library.
The library has the function addRow but insert data by column, Is there any way to insert data row?
Excuse my english, I'm using a translator,
Thanks
Replies (6)
RE: Inserting data by row - Added by Andrei Bintintan almost 11 years ago
Hi,
Please be more specific. I don't understand what you mean.
.. or post it in your own language, we'll translate it.
Regards, Andrei.
RE: Inserting data by row - Added by Alonso Uribe almost 11 years ago
The function inserts the data (using AddRow())
view 1.png
I need to insert the data
view 2.png
thanks for your help
RE: Inserting data by row - Added by Andrei Bintintan almost 11 years ago
That is not supported. The table is created by adding a row at a time.
Best practice is to prepare the table data in an array or so and then add it row by row.
Andrei.
RE: Inserting data by row - Added by Alonso Uribe almost 11 years ago
could you give me some idea to create this function?, thanks
RE: Inserting data by row - Added by Andrei Bintintan almost 11 years ago
Can you send me a small example of how you get your data?
Assuming you have your data in the following format, you could do something like this:
//this is from database or some other data source
$aData = array(
array( //this is row1
'cell 11',
'cell 12',
'cell 13'
),
array( //this is row2
'cell 21',
'cell 22',
'cell 23'
)
);
foreach($aData as $aDataRow){
$aRow = Array(); foreach($aDataRow as $key => $val){ $aRow[$key]['TEXT'] = $val; } //add the row to the table $oTable->addRow($aRow);
}
//output the table...
... of course the possibilities are unlimited.