I
I
imsha2017-02-02 06:39:47
PHP
imsha, 2017-02-02 06:39:47

PHPWord - how to move a block to the next page if it is not included on the current one?

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addTitle('blablabla');
$section->addText('blablabla');
$section->addTitle('blablabla');
$section->addText('blablabla');
...
$section->addTitle('blablabla');
$section->addText('blablabla');
The page ends, the title stays on one, and the text wraps to the next.
And you need to transfer both blocks to the new one.
The method with "stuffing" empty lines will not work, because the size of the blocks is not known in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ruchiev, 2017-02-02
@denis_bardak

$section->addPageBreak();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question