Forum


Replies: 1   Views: 2346
Get .docx content as a wordfragment to put in another docx
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 FGI  · 13-10-2017 - 12:01

Hello,

is there a way to load the content of a .docx in a WordFragment or something similar, to put in the middle of another .docx? (with replaceVariableByWordFragment(), for example)

I would like to avoid merging existing docs: this would require to:

  • split my template in 2 docx files
  • merge the 1st part of the template + many other .docx + last part of the template

(which is really ugly :-) )

 

Best regards,

Posted by admin  · 13-10-2017 - 12:10

Hello,

There's no method to create a WordFragment from a DOCX. But you can merge a DOCX and then use DOCXPath to move it to any position of the document.

On https://www.phpdocx.com/documentation/cookbook/merge-docx-documents-anywhere you can find a recipe that explains how to do it.

Premium licenses can do this using in-memory documents but Advanced licenses need to use documents in the file system.

Regards.