I am trying to insert pages in a Word DOCX document when the total page count is an odd number. The requirement is for there to always be an even number of pages in the document to facilitate correct 2-sided printing.
I see 2 possible approaches to this requirement:
- Create Word field code that, when applied, will add the page if it is needed. I found the formula below via an internet search. I have implemented it via the XSL below but I am not sure how to code the page break - does anyone know how I would
do that?
{ IF{ =MOD({ PAGE \* Arabic },2)}= 0 " " "[page break]" }
<w:p>
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve">IF</w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve">= MOD(</w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve">NUMPAGES \* Arabic</w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve">,2)</w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve">= 0 [page break]</w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
<w:r>
<w:fldChar w:fldCharType="separate"/>
</w:r>
</w:p>
2. Is there any way that XSL transforming the Word XML (document.xml) can be passed the number of pages in the document? Is there some way that the NUMPAGES field could be assigned to an XSL variable?
Is there some other approach for meeting the requirement that I am overlooking?
Thank you very much for whatever assistance can be offered ...