Forum


Replies: 2   Views: 1045
Group items to prevent page breaks inside the group
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 RDI  · 17-09-2021 - 20:46

Hi,

I have a bunch of tables that each have their own heading text right above it. This is all dynamically created from data within a database, so the table length can vary.

How can I group each heading and table together so that if 2 tables (each with their own heading) don't fit on one page the 2nd table AND it's header move onto their own additional page?

As it is right now the 2nd table moves onto a new page but the 2nd heading stays on the first page, after the 1st table.

$docx->addText(...); // Heading 1
$docx->addTable(...); // Table 1

$docx->addText(...); // Heading 2
$docx->addTable(...); // Table 2

Thanks!