Categories > TinyButStrong general >

merge block with an associative array and multi-sheet model ods

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Willyam NGAM
Date: 2016-02-06
Time: 14:03

merge block with an associative array and multi-sheet model ods

Hello everyone I am a new user tinybutsrong and I would like to create a multi-sheet model ods .
my data is stored in an associative array.
in my php code I do not know how to do the merge of blocks. Your solutions will greatly help me . Thank you
By: Anonymous
Date: 2016-02-06
Time: 23:56

Re: merge block with an associative array and multi-sheet model ods

Hello,

Please give more detail about what you try to do.
By: Willyam NGAM
Date: 2016-02-08
Time: 08:06

Re: merge block with an associative array and multi-sheet model ods

I have a data table and I would like to use tinybutstong to export data to an Excel file that has multiple sheets. Here is my table (called $arr_data):

[param] => Array
        (
            [datdebut] => 20/01/2016
            [datfin] => 20/02/2016
        )
    [totVente] => Array //i want this block to be in one sheet: block1
        (
            [0] => Array
                (
                    [codpays] => 0302
                    [vente] => 351000
                    [name_graph] => 0302
                    [value_graph] => 351000
                )

            [tot_vente] => 351000
        )

    [detail] => Array //this block should be another Excel sheet: block2
        (
            [0] => Array
                (
                    [numdev] => 1
                    [datdev] => 26/01/2016
                    [numcli] => 9
                    [nomcli] => DISPENSAIRE LA GRÂCE
                    [datliv] => 29/01/2016
                   
                )
        )
    [categorie] => Array // this the third sheet of my model (ods): block3
        (
            [0] => Array
                (
                    [numcat] => 0
                    [nom] => client régulier
                    [vente] => 351000
                    [name_graph] => 0
                    [value_graph] => 351000
                )

            [tot_vente] => 351000
        )
    [datedit] => 29/01/2016
    [auteur] => admin
)
i tried this (in my php code) :
$TbsDoc->loadXml('content.xml');
$TbsDoc->mergeXmlBlock('block1', $arr_data[totVente]);
$TbsDoc->mergeXmlBlock('block2', $arr_data[detail]);
$TbsDoc->mergeXmlBlock('block3', $arr_data[categorie]);       
$TbsDoc->saveXml();

but nothing happens. the merge() function did'nt walked.
I have a file that has a ods extension consisting of three sheets ( each sheet corresponding to a block of my table).
I define the fields of my file like this: [ data.numdev ; type = d; block = block1 : table-row ]; ... [ numcat ; type = d; block = block2 : table-row ] ... i just change the variable's  and blocks name depending on the sheet of the model.
i hope those informations can help you solve my problem.
thank you.