Free Support Forum - aspose.com

options.ExportHeaderFooter dosent work

Hi Team

I am converting docx into html
even though options.ExportHeaderFooter is set as true…by default

there is no footer in generated html for some files…

please find one file attached where it have footer on page 2 but failed to found in html

Test.zip (80.6 KB)

@kotharib2

Thanks for your inquiry.

It is hard to meaningfully output headers and footers to HTML because HTML is not paginated.

When you use PerSection property, Aspose.Words exports only primary headers and footers at the beginning and the end of each section.

When using FirstSectionHeaderLastSectionFooter property, only first primary header and the last primary footer ( including linked to previous ) are exported.

When using FirstSectionHeaderLastSectionFooter property, only first page header and footer are exported at the beginning and the end of each section.

Please use the following code to get desired results.

Document doc = new Document("D:\\Temp\\Test.docx");
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.Html);
saveOptions.ExportHeadersFootersMode = ExportHeadersFootersMode.FirstPageHeaderFooterPerSection;
doc.Save("D:\\Temp\\Test_18.11.html", saveOptions);

Please check generated HTML with footer for your reference. Test_18.11.zip (12.0 KB)