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?