Forum


Replies: 5   Views: 287
Importcontents only for body, not for header/footer
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 dan_brokerbusiness  · 09-11-2023 - 21:26

Thanks. Not too keen on using mergeDocx because it operates on the file level, I'd much rather work on the content level.

My use case is a tool that allows a user to combine various blocks of content to a final word document. Some of these blocks are defined static, but one of them is "add content from a word document". 

I am just going through all the blocks and append it to the document (basically a large for loop over all blocks appending content to the docx). This works well so far and creating a docx, merging, opening the resulting docx and continue appending is not a great fit instead of just appending content (as kind of possible with importContents).

Can you think of combination of 'parent' or 'customQuery' combination on importContents that would allow me to just extract the content? All the styles are defined in the main document, i really just need the body content.

If not i'll probably keep on using importDocuments and then override the header/footer again at the end with the original file, but its not a clean solution.