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

Free Support Forum - aspose.com

Convert Word to Email Without Header and Footer


I am working on a project to convert word to Email but couldn’t find a way to remove header and footer.
Please see my code below.
string dataDir = @“C:\TEMP”;

    Document wordDocument = new Document(dataDir + "Test.docx");
    MemoryStream mhtmlStream = new MemoryStream();
    wordDocument.Save(mhtmlStream, SaveFormat.Mhtml);

    Document doc = new Document(dataDir + "HeaderFooter.RemoveFooters.doc");
    mhtmlStream.Position = 0;
    MailMessage message = MailMessage.Load(mhtmlStream,new MhtmlLoadOptions());


Thanks for your inquiry. Please use ExportHeadersFooterMode property of HtmlSaveOptions object as following. Hopefully it will help you to accomplish the task.

Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions();
options.SaveFormat = SaveFormat.Mhtml;
options.ExportHeadersFootersMode = ExportHeadersFootersMode.None;
Document doc = new Document("input.docx");
MemoryStream stream= new MemoryStream();


Thank you so much for your quick respond, it’s working perfectly.