Forum


Replies: 2   Views: 667
Addtext option 'pagebreakbefore'
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 admin  · 17-11-2022 - 15:30

Hello,

The pageBreakBefore option available in addText is a paragraph style:

$docx = new CreateDocx();
$docx->addText('Content');
$docx->addText('New content', array('pageBreakBefore' => true));

This pageBreakBefore option enables the "Page break before" option available for paragraphs in DOCX documents. It can be edited/changed/updated using MS Word and any other DOCX program. For example using MS Word: right click on the paragraph => "Line and Page Breaks" tab => "Page break before" option. The option is working as expected.

You can also add page breaks using addBreak:

$docx->addText('Content');
$docx->addBreak(array('type' => 'page'));
$docx->addText('New content');

working with the document and with WordFragments. Or add new sections with addSection to create new pages.

Regards.