Forum


Replies: 3   Views: 2426
Woking from template
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 Simco uwkm  · 19-12-2017 - 10:50

We have template file with coverpage for our document. 
on cover page i have placeholder which is getting replaced 

$docx = new \Phpdocx\Create\CreateDocxFromTemplate(__DIR__ . '/../../Resources/Public/Templates/Quotation_front_'.$short.'.docx');
/* some code with defining header variable */

$docx->replaceVariableByHTML('HEADING', 'block', $header, array('isFile' => false, 'parseDivsAsPs' => true));

then we need to have be on next page since we are done with the coverpage 

$docx->addBreak('page');

/* creating html on-fly and embedding that into doc */
$productElement = new \Phpdocx\Elements\WordFragment($docx, 'products');
$productElement->embedHTML($html);
$docx->addWordML($productElement);

but when i insert my content it places it in cover page.
so the question is how i can move to the next page

 

Posted by Simco uwkm  · 19-12-2017 - 12:46

well have solved my problem by adding sections instead of pagebreaks
 

$options = array('marginRight'=> 850, 'marginLeft'=>850);
$docx->addSection('nextPage', 'A4', $options);

 

Posted by Simco uwkm  · 19-12-2017 - 14:25

Ok thx, from other manuals it was mentioned as string..