Forum


Replies: 2   Views: 3522
Insert pagebreak into existing 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 cubryto  · 28-02-2014 - 23:17

Hi, My existing docx has the following format



1. First paragraph



2. Second paragraph



3. Third...



My questions are:



- Is there any way that I can insert a pagebreak between these paragraphes?



- Can searchAndReplace function insert a pagebreak?



- My last question is regarding parsing an existing docx (http://www.phpdocx.com/examples/parses-existing-word-document). I wonder if there is any instruction on how to edit the docx after parsing it.



Thank you!



 


Posted by jorgelj  · 03-03-2014 - 09:31

Hello,



You can use the addBreak method to add line, page or column breaks. Please check this example:



http://www.phpdocx.com/api-documentation/word-content/insert-line-column-page-break-Word-document-with-PHP



To do a pagebreak in a template you need to use the page_break_before property with replaceTemplateVariableByHTML.



About parsing a document, you get the full content using the read readDOCX method. But you can your own template in the constructor.



Regards.