You can use Aspose.Words for Java to specify how headers and footers are exported to HTML, MHTML or EPUB. For example, the following code demonstrates how to disable the export of headers and footers when saving to MHTML format:
Document doc = new Document("D:\\TestCPMail-WithFooter\\TestCPMail-WithFooter.docx");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.MHTML);
opts.setExportHeadersFootersMode(ExportHeadersFootersMode.NONE);
doc.save("D:\\TestCPMail-WithFooter\\awjava-18.9.mhtml", opts);
Possible values of ExportHeadersFootersMode Enumeration are:
Member Name | Description | Value |
---|---|---|
None | Headers and footers are not exported. | 0 |
PerSection | Primary headers and footers are exported at the beginning and the end of each section. | 1 |
FirstSectionHeaderLastSectionFooter | Primary header of the first section is exported at the beginning of the document and primary footer is at the end. | 2 |
FirstPageHeaderFooterPerSection | First page header and footer are exported at the beginning and the end of each section. | 3 |