Replies: 2   Views: 699
Enforcesectionpagebreak is not working
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 hotspot22  · 12-02-2021 - 09:46


We are using phpdocx 9.5 premium and I think there is an issue with the mergeDocx option enforceSectionPageBreak.

In my case I have a docx document that is used for a bulk letter. So the document has some placeholders that are replaced by phpdocx and at the end all the documents are merged to one.

$merge = new MultiMerge();
$first_document = array_shift($files);
$merge_options = [
        'mergeType' => 0,
        'numbering' => 'restart',
        'preserveStyleDefaults' => true,
        'forceLatestStyles' => false,
        'enforceSectionPageBreak' => true,
        'lineBreaks' => 1
$merge->mergeDocx($first_document, $files, $filename, $merge_options);

But in the result document the text of the second document floats into the first document.

As a dirty fix I've added a section page break at the end of the document. So it has a blank last page.

With that fix the merge works correctly. The second document starts on the blank page of document one, the third document starts on the blank page of document two and so on. But at the end of the merged document there is a blank page because of my added section page break. So I need the enforceSectionPageBreak option to work please :)

Any ideas?