Forum


Replies: 2   Views: 239
Prevent page break
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 cwadensten  · 19-06-2024 - 05:52

I'm using phpdocx to build forms in docx from dynamic data. This means that I never know the exact content. The document is built with a number of components that goes together. 

I'm trying to find a way to prevent page breaks in bad places. For example. I have a Word fragment wih three rows of text boxes. If that fragment is added to the page I don't want the page to break inside it. If there isn't enough space on the page I would like it to have a page break before it.

Is there some way to either.

  • Prevent a page break in a word fragment.
  • Measure the height of a fragment and see if there is enough space left on the page
  • Group parts of the document in some other way than fragments and prevent page breaks in these?