Forum


Replies: 4   Views: 3690
Create a dynamic table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by sevilha  · 09-10-2013 - 20:10

Hi guys,



I have a template, with variables and i need to create and add a dynamic table on this file without a declared variable on the template. I´m trying to use this code 



$ncms = $total = $desonerado = array();



        foreach ($ncmDados as $dados) {

            $ncms[] = (String)$dados['ncm'];

            $total[] = (String)$dados['total'];

            $desonerado[] = (String)$dados['desonerado'];

        }

        

        

        $docx->addTable(array($ncms,$total,$desonerado));



 



Someone can help me?



 


Posted by jorgelj  · 10-10-2013 - 09:14

Hello,



What version of PHPDocX are you using?



Regards.


Posted by sevilha  · 10-10-2013 - 14:58

I´m using the Version Pro+.


Posted by jorgelj  · 11-10-2013 - 07:49

Hello,



You need to add at least one variable (placeholder) to the template to replace it by a table. You can find an example on intermediate/Template.php file.



The addTable method is for new documents.



Regards.