Forum


Replies: 13   Views: 2415
How to use phpdocx_section?
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 rapidtech  · 22-11-2019 - 10:51

Ok, I've managed to do this. Another issue is with converting the resulting DOCX to PDF. In the PDF doc each section goes to a new page.

$docx = new CreateDocx();

$html = '<p>1 Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p>';
$docx->embedHTML($html, array('useHTMLExtended' => true));

$html = '
<phpdocx_section data-sectionType="continuous" data-paperType="A4" data-numbercols="3" />
<p>2 Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p>
';
$docx->embedHTML($html, array('useHTMLExtended' => true));

$html = '
<phpdocx_section data-sectionType="continuous" data-paperType="A4" data-numbercols="1" />
<p>3 Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p>
';
$docx->embedHTML($html, array('useHTMLExtended' => true));

$docx->createDocx('test.docx');

$transform = new TransformDocAdvPDF('test.docx');
$transform->transform('test.pdf');

How to get the exact same look in PDF as it is in the DOCX?