By: Adilson
Date: 2011-07-21
Time: 21:20
|
Dynamic tables (with variable columns) on ODS file
Hi all,
Someone know how to create dynamic tables (with variable columns) in a ODS file?
I manage to create it in Html (according to the example) but have no clue about hot to do the same in a ODS file.
Thanks in advanced,
Adilson Oliveira Cruz
|
By: Adilson
Date: 2011-07-21
Time: 22:55
|
Re: Dynamic tables (with variable columns) on ODS file
Well, I just find a solution.
The PHP side (similar to the dynamics columns example):
$nbr_row = 10;
$nbr_col = 10;
// List of column's names
$columns = array();
for ($col=1;$col<=$nbr_col;$col++) {
$columns[$col] = 'column_'.$col;
}
// Creating data
$data = array();
for ($row=1;$row<=$nbr_row;$row++) {
$record = array();
for ($col=1;$col<=$nbr_col;$col++) {
$record[$columns[$col]] = $row * $col;
}
$data[$row] = $record;
}
// Expanding columns
$TBS->MergeBlock('c0,c1,c2',$columns);
// Merging rows
$TBS->MergeBlock('r',$data);
$TBS->Show();
The ODS side:
X [c0.key;block=table:table-cell]
[r.$;block=table:table-row] [r.[c1.val;block=table:table-cell]]
[r.$;block=table:table-row] [r.[c2.val;block=table:table-cell]]
|