We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DOCX to HTML Conversion missing first page header

Hi, we are using Aspose.Words for .NET 15.10.0.0 for converting DOCX to HTML. When the DOCX has different first page header, the converted html is missing the first page header. We have tried all the ‘non-None’ options of ExportHeadersFootersMode. Please help with resolving this issue. Thanks


Update 11/13/15 Attaching sample DOCX

Hi David,


Thanks for your inquiry. Please use HtmlSaveOptions.ExportHeadersFootersMode property to specifiy how headers and footers are output to HTML, MHTML or EPUB. Default value is PerSection for HTML/MHTML and None for EPUB.

It is hard to meaningfully output headers and footers to HTML because HTML is not paginated. When this property is PerSection, Aspose.Words exports only primary headers and footers at the beginning and the end of each section. When it is FirstSectionHeaderLastSectionFooter only first primary header and the last primary footer (including linked to previous) are exported. You can disable export of headers and footers altogether by setting this property to None.

Here is the code to get desired output:

Document doc = new Document(MyDir + @“in.doc”);

HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);<o:p></o:p>

opts.ExportHeadersFootersMode = ExportHeadersFootersMode.FirstPageHeaderFooterPerSection;<o:p></o:p>

doc.Save(MyDir + @“15.10.0.html”, opts);<o:p></o:p>


Hope, this helps.

In case the problem still remains, please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Thanks for the response. I appreciate the explanation. I have attached a sample.


We are using FirstSectionHeader… option. We see the effect (as you described) in the our online html editor component. We however are running in to an error when converting back to docx when user downloads. Should I open a different post for that?

Hi David,


Thanks for your inquiry.
:
We are using FirstSectionHeader… option. We see the effect (as you described) in the our online html editor component. We however are running in to an error when converting back to docx when user downloads. Should I open a different post for that?
To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words generated output HTML and the code used for this conversion
  • Aspose.Words generated Word document and the code used for this HTML to Word conversion
  • Your expected final Word document which shows the correct output. Please create this document using Microsoft Word application.
  • Please create screenshot(s) which help us identify the problematic areas during Word-HTML-Word round-trip

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,