Forum


Replies: 6   Views: 5433
Make pagebreak
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 nikkyb8  · 08-11-2013 - 15:27

Hello,



I'm trying to make a pagebreak like that :



$docx = new CreateDocx();

$docx->enableCompatibilityMode();

$docx->addTemplate($chemin_tamplate);



$docx->addText("before");

$docx->addBreak(array('type' => 'page'));



$docx->addText("after");



$docx->createDocxAndDownload($name);



It doesn't work...



Do you konw why ?


Posted by jorgelj  · 11-11-2013 - 09:16

Hi,



As you're using a template you'll nedd to add the page break manually; using 'page-break-before' style and replaceTemplateVariableByHTML. Something like:



$html= '<p><span>This is a page</span></p><p style="page-break-before:always;"><span>This is other page</span></p>';



$docx->replaceTemplateVariableByHTML('VAR', 'inline', $html);



Regards.


Posted by nikkyb8  · 12-11-2013 - 09:11

Hello ant thank's for answer,



So i need to make $VAR$ in the bottom of my templates



that's right ?


Posted by jorgelj  · 12-11-2013 - 10:13

Hello,



Yes, you need to add that placeholder to your templates.



Regards.


Posted by nikkyb8  · 12-11-2013 - 15:54

D'accord, mais du coup, j'ai toujours une page blanche à la fin.

Y aurait il une fonctionne pour supprimer la derniere page par exemple ?


Posted by jorgelj  · 14-11-2013 - 09:51

Hello,



Please attach your DOCX, we'd like to check it.



Regards.