Forum


Replies: 13   Views: 3234
Add section and change page orientation with htmlextended
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 gmakstutis  · 24-05-2019 - 08:27

Hmmm... this is difficult. We are generating a very complex document (many pages, different styles, etc.) from a Drupal 8 site. The Word file is the output of a complex Twig template, that includes many entity_references, and; therefore, a complex relationship of different Twig templates get embedded. We can't really use the code feature of phpdocx, as our team doesn't have sufficient PHP/Drupal coding experience.

Thinking about future development, would it be possible to do something like have an opening and closing phpdocx tag that integrates the call to $docx->embedHTML($html, array('useHTMLExtended' => true)); when the closing tag is called?

Effectively, this would use everything between the opening <phpdocx_section> and </phpdocx_section> is the value of $html. Something like:

<phpdocx_section data-paperType="A4-landscape" data-sectionType="nextPage">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</phpdocx_section>

Might this allow for using HTMLextended to achieve multiple sections in a document?