Forum


Replies: 13   Views: 3485
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  · 23-05-2019 - 19:02

I must be doing something wrong...

I have setup a test content-type in Drupal, and have a Drupal twig template that has this:

<phpdocx_modifypagelayout data-paperType="A4" data-marginTop="850" data-marginRight="1077" data-marginBottom="850" data-marginLeft="1077" />

{{ node.field_test1.value|raw }} {# outputs a series of paragraphs #}

<phpdocx_section data-paperType="A4-landscape" data-sectionType="nextPage" />

{{ node.field_test2.value|raw }} {# outputs a series of paragraphs #}

<phpdocx_section data-paperType="A4" data-sectionType="nextPage" />

{{ node.field_test3.value|raw }} {# outputs a series of paragraphs #}

<phpdocx_section data-paperType="A4-landscape" data-sectionType="nextPage" />

{{ node.field_test4.value|raw }} {# outputs a series of paragraphs #}

I am expecting that I will see the page orientation change after each block of text. However, what I'm getting is:

  • The docx starts with a blank A4 (portrait) page (with correct margins), followed by
  • A blank A4-landscape page (with different margins), followed by
  • A blank A4 (portrait) page, followed by
  • A series of A4-landscape pages with the text output from the Drupal fields

Why am I getting blank pages, changed margins, and why is the text not appearing in the sections that preceed them?

Thanks