TinyButStrong - the PHP Template Engine
Categories > OpenTBS with XLSX >

Dynamic Row/Column For Xlsx

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Alex
Date: 2013-07-19
Time: 10:51

Dynamic Row/Column For Xlsx

Hello i'm trying export an array to make a dynamic Row/Column Excel.

Here my datas:

(Can have more or less header)
// Line 1 of my table
$header = array(
   'header_1' => 'Head 1',
   'header_2' => 'Head 3',
   'header_3' => 'Head 2'
);

If i have these 3 headers here my values:
// Line 2 of my table
$value[0] = array(
   'value_1' => 'Value 1',
   'value_2' => 'Value 3',
   'value_3' => 'Value 2'
);
// Line 3 of my table
$value[1] = array(
   'value_1' => 'Value 1',
   'value_2' => 'Value 3',
   'value_3' => 'Value 2'
);


        $TBS->MergeBlock('b1', $header);
        $TBS->MergeBlock('b2', $value);

Should do in Excel
           A           B           C
1   Header 1  Header 2 Header 3  
2     Value 1    Value 2   Value 3
3     Value 1    Value 2   Value 3

How should implement this in Execl?

Tried something like this :

[b1.header;block=c]
[b2.value;block=row]

But doesn't work properly.

Thank's by advance.
By: Alex
Date: 2013-07-19
Time: 11:09

Re: Dynamic Row/Column For Xlsx

Ok i found the solution I was not with 1.8+ ...

So here the solution:

$TBS->MergeBlock('cell1,cell2','num', $nb_header);
$TBS->MergeBlock('b1', $header);
$TBS->MergeBlock('b2', $value);

[b1.valeur;block=c]
[b2.valeur_[cell2.val;block=tbs:cell];block=row]
By: florin
Date: 2015-04-17
Time: 16:37

Re: Dynamic Row/Column For Xlsx

I've tried what you implemented. Unfortunally, it isn't working for me.
would you be so kind to send me an example, with the XLS file included, by e-mail.
Thanks.