Add "cloneRow" function to clone a table row in a template document. #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
One missing feature of the templating part of the PHPWord is the ability to create a table with a dynamic number of rows.
The function I wrote (cloneRow) allows you to clone the required number of times a row of a table in your template file.
The function takes two parameters, any template variable found on the specific row to identify the row to clone and the number of required rows.
All variables found on the table row will be suffixed with a # and a row number, so setValue can be used to set the variables values.
Some time ago a wrote a blog post how this works, maybe that clarifies all: http://jeroen.is/phpword-templates-with-repeating-rows/
Jeroen