Free Support Forum - aspose.com

Header/Footer Issue with Mhtml

Hi,

I get strange results when I save a single page word file as MHtml using ExportHeadersFootersMode.FirstSectionHeaderLastSectionFooter. I just put the text “Header” in the header section und “Footer” in the footer section. After saving I get a Mhtml file with total different header/footer. The result has “- Seite 2 -” (it’s a german windows) as header and no footer.

I’m using Aspose.Words for .NET version 13.2.0.0.

best regards
Alexander

Hi Alexander,

Thanks for your inquiry. Could you please attach your input Word document and output Mhtml file showing the undesired behaviour here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

Hi awais,

As you requested I’ve attached my test files. I can reproduce this issue even with the latest Version of Aspose.Words 13.3.0.0.

Best regards
Alex

Hi Alex,


Thanks for your inquiry.

Please note that there can be a maximum of only one HeaderFooter of each HeaderFooterType perSection. Talking about headers, there are of three types i.e. HeaderFirst, HeaderPrimary and HeaderEven; so up to three different headers are possible in a Section (i.e. for first, even and odd pages). Same is true for Footers.

In your case, the text ‘Header’ is contained inside HeaderFirst and the text ‘Footer’ is contained inside FooterFirst area. The problem occurs because currently Aspose.Words outputs only Primary Header/Footer to HTML based formats. This is described in the documentation as follows:

It is hard to meaningfully output headers and footers to HTML because HTML is not paginated. When this property (ExportHeadersFootersMode) 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.

So, this is the expected behaviour; if we can help you with anything else, please feel free to ask.

Best regards,