HtmlToWmlConverter adding page numbers

Home Forums Open-Xml-PowerTools HtmlToWmlConverter adding page numbers

This topic contains 2 replies, has 2 voices, and was last updated by  gamartin 4 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #4164


    What is the best way to add page numbers to a document created with the HtmlToWmlConverter? Use a template document with the header/footer I want and merge the 2? Or can I use something in documentbuilder or documentassembler to add the header/footer section?




    Eric White

    Hi Garth,

    At the moment it is not possible.

    Adding page numbers (and headers / footers) would require writing a layout engine. AFAIK, right now there is no open source layout engine. Without a layout engine, one can’t do pagination. Without pagination, there is no way to determine the page number, etc.

    In the document, there are w:lastRenderedPageBreak elements. Unfortunately, there are ‘bugs’ in Word that cause these to be put into the wrong places in a number of circumstances. I put quotes on ‘bugs’ because Word does not guarantee the correct placement of these elements, so Microsoft doesn’t consider these to be bugs, I believe.

    So currently, there is no good path to do this.

    Best, Eric



    OK thanks Eric. I will continue to do what I have been doing, which is using a docx file as a template that only has a header with the paging control in it and merging it with the output generated by the HtmlToWmlConverter.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.