Forum


Replies: 2   Views: 177
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?

     

 

Posted by admin  · 19-06-2024 - 07:19

Hello,

What license and version of phpdocx are you using? Your username doesn't have any license tied, please send to contact[at]phpdocx.com the username or email of the phpdocx account that purchased the license you are using.

There's no method to get the height or width of text content, but phpdocx includes options (keepLines and keepNext) to keep contents on the same page (paragraphs, lists, tables, HTML...); these options can be applied to new contents, WordFragments, templates...

If you are using a license that includes technical support, we can generate a custom sample script. Please note that the trial package doesn't include this kind of support.

Regards.

Posted by cwadensten  · 19-06-2024 - 14:36

Thank you for your reply, I have the Advanced Licence, but it's tied to a coworkers email so that's why I'm on m own account. But I'll start by looking into keeplines and see if I can figure it out, otherwise we'll contact support with our licence details.