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

Free Support Forum - aspose.com

Emailing worksheets as HTML body

I am trying to create an html body from several worksheets for an email that will be sent using an email app that we developed that uses SMTP. I’ve tried the following to generate HTML and MHtml, but the mail app doesn’t seem to render the pages properly:

HtmlSaveOptions opt = new HtmlSaveOptions();
opt.ExportPrintAreaOnly = true;
opt.Encoding = System.Text.Encoding.UTF8;
opt.ExportWorksheetCSSSeparately = false;
htmlWb.Save(@"<Location>\HtmlBody.html", opt);

Where location is the file path.

The problem with this approach is that Aspose will generate the HTML file and a folder that contains CSS and JavaScript to render the page.

I’ve also tried htmlWb.Save(@"", SaveFormat.MHtml); to save as MHtml at the specified location, but the problem that I have is that the styles get lost, and the tables won’t look properly.

What do you guys recommend me to do to achieve what I need?


Thank you for your query.
You may please try the sample code in the following article and share the feedback.

Using a Microsoft Excel Worksheet as the Message Body and Sending Email

Following your example I am able to send the email, but I get “This page uses frames, but your browser doesn’t support them” message when opening the email with MS Outlook.

Is it because the way Html code is generated by Aspose?


Please share your template Excel file, bare minimum runnable code to reproduce the issue and output email on receiving end for our analysis. We will test issue here and provide our feedback.

After applying the license, the html generated got rid of the frames causing problems when rendering the html on the email client.

Thank you very much.

Good to know that your issue is sorted out. Feel free to contact us at any time if you need further help or have some other issue or queries, we will be happy to assist you soon.