Forum


Replies: 1   Views: 5270
Label generation - table column/cell variable replace
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 wolfric  · 04-12-2014 - 01:25

I am looking into the feasibility of phpdocx for the initial use of generating labels (with possible future use of report generation) I have crawled through the sample templates and the API Documentation but have been unable to locate the specific information I am after. I am looking to populate a table of fixed sizes with data from an array, but have each index of the array apply to a single cell. I have looked at the replaceTableVariable API command, but it generates a single row for each element in the array. It would be possible for me to frankenstein something together that would explode my initial array out to an array containing the data for each row instead of each cell, but this may add unwanted complexity. Is there an easier way to fill a table cell by cell from a template rather than row by row?

Posted by admin  · 04-12-2014 - 07:47

Hello, You'd need to set a single placeholder for each cell. You can use the replaceTableVariable method adding the placeholders dinamically and then the replaceVariableByText to replace each placeholder. Regards.