Forum


Replies: 3   Views: 3667
Multi-templated paged document
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 arcmedia  · 02-03-2015 - 09:43

Hey, we have a corporate licence and need to compose a document with multiple sections (some sections have different layouts). I have read here (http://www.phpdocx.com/en/forum/default/topic/735) that the way to do this (with templates and variable substitution), is by creating several separate documents and merging them together. Is there a way to achieve this without generating multiple files and then merging them? Also, since the complete document needs continuous paging throughout its length, how can one keep paging seamless?

Posted by admin  · 02-03-2015 - 11:36

Hello, You can use the addSection method (http://www.phpdocx.com/api-documentation/layout-and-general/add-section-Word-document-with-PHP) dinamically creating documents drom scratch and generate a DOCX. And then load this DOCX as a template and replace the placeholders. Regards.

Posted by arcmedia  · 04-03-2015 - 10:44

I cannot find the way to concatenate multiple templates into one document. I have several WordFragment objects constructed from CreateDocxFromTemplate objects. How do I stitch them together, each in its own section? I have found the much promising method "insertWordFragmentAfter", but I can't seem to find any clear documentation for it (epecially for its parameter "referenceNode"). (Follow-up question: Once stiched together, how do I insert paging into a common variable?)

Posted by admin  · 04-03-2015 - 11:56

Hello, The insertWordFragmentAfter method is not supported in the current version. The only two approachs are: · Merge them using MultiMerge class. · Create new sections and add the contents. The included addSection sample creates a new section and add content to it. Regards.