Forum


Replies: 13   Views: 3489
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  · 03-06-2019 - 14:23

I've got my sections working, with:

  #Landscape section - Next Page
  $landscape_fragment = new Phpdocx\Elements\WordFragment($docx);
  $landscape_fragment->addWordML('<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:pPr><w:sectPr><w:type w:val="nextPage"/><w:pgSz w:code="9" w:h="11906" w:orient="landscape" w:w="16838"/><w:pgMar w:bottom="850" w:footer="708" w:gutter="0" w:header="708" w:left="1077" w:right="1077" w:top="850"/><w:cols w:num="1" w:space="708"/><w:docGrid w:linePitch="360"/></w:sectPr></w:pPr></w:p>');
  $landscape = '<phpdocx_wordfragment data-content="'.base64_encode(serialize($landscape_fragment)).'" />';
  $variables['landscape'] = $landscape;

  #Portrait section - Next Page
  $portrait_fragment = new Phpdocx\Elements\WordFragment($docx);
  $portrait_fragment->addWordML('<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:pPr><w:sectPr><w:type w:val="nextPage"/><w:pgSz w:code="9" w:h="16838" w:orient="portrait" w:w="11906"/><w:pgMar w:bottom="850" w:footer="708" w:gutter="0" w:header="708" w:left="1077" w:right="1077" w:top="850"/><w:cols w:num="1" w:space="708"/><w:docGrid w:linePitch="360"/></w:sectPr></w:pPr></w:p>');
  $portrait = '<phpdocx_wordfragment data-content="'.base64_encode(serialize($portrait_fragment)).'" />';
  $variables['portrait'] = $portrait;

However, I'm losing my footer; which was being added by:

<phpdocx_footer>
    <div class="print-footer">
        <table border="-" style="border-collapse: collapse; width:100%;">
            <tbody>
                <tr>
                    <td class="text-left font-8"><phpdocx_pagenumber data-target="defaultFooter" data-type="numerical" data-fontSize="8" data-font="Open Sans" data-textAlign="left" /></td>
                    <td class="text-right font-8">
                        Pearson BTEC Levels 4 and 5 Higher Nationals in {{ subject }}<br/>
                        Specification - Issue {{ issue }} - {{ issmonth }} {{ issyear }} &copy; 2019
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</phpdocx_footer>

I'm assuming that I need to have footers defined as part of my sections. Is this correct?