Forum


Replies: 2   Views: 1325
Split document by word
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 geofhoch  · 09-02-2021 - 10:57

Hi,

I would like to know if it's possible to split a word document to several word document.

Here an example of a word document i would like to split : https://act-cs.fr/example/example.docx

I would like to create a word document from this example. The idea would be to retrieve the code and create a new word document that will have this code as the name.

Here is the result I would like to obtain : 
https://act-cs.fr/example/lp01.docx
https://act-cs.fr/example/lp02.docx

Thanks

 

Posted by geofhoch  · 09-02-2021 - 11:01

I forgot to tell that i'm using Premium version of phpdocx.

Posted by admin  · 09-02-2021 - 11:38

Hello,

What version number of phpdocx are you using?

Advanced and Premium licenses include splitDocx to split documents, but this method only works with sections, and you are trying to split contents wrapped by specific contents.

phpdocx 10 Premium added importContents that allows importing contents from existing documents (in the main body content). Using this method you can generate new documents importing the exact contents in the main document body from external DOCX, for example creating a new document with all contents from CODE : LP01 (or START) to END, and other new document with all contents from CODE : LP02 (or START) to END.

If you are using a previous version than phpdocx 10, we recommend you to upgrade your license to be able to use the importContents method.

Regards.