Free Support Forum -

Formatting of HTML


I have written some code to process a Word document and save it as HTML, using Aspose.Words 5.0.2. The command I have used to save the document is awd.Save("AsposeTest.HTM", Aspose.Words.SaveFormat.Html). The resulting HTML text is then attached as the body of an e-mail and sent to an e-mail recipient

The resulting HTML document looks fine, but is filled with span tags. These tags are stripped out of mail messages by many browser-based e-mail systems (such as GMail, HotMail, etc).

When I do the same thing with Word 2003, the resulting HTML displays correctly in HotMail

Is this a known issue, and if not please can it be investigated? The application is now completed, and finding this unexpected issue has put a spanner in the works


Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I tried using the following code and all works fine on my side.

//Convet DOC to HTML

Document doc = new Document(@"Test021\in.doc");

doc.Save(@"C:\Temp\Message.html", SaveFormat.Html);

//Define required data

string email = "";

string fromEmail = "";

string password = "mypassword";

string smtp = "";

string subject = "Aspose test";

//Create MailDefinition

System.Web.UI.WebControls.MailDefinition mail = new System.Web.UI.WebControls.MailDefinition();

mail.IsBodyHtml = true;

mail.BodyFileName = @"C:\Temp\Message.html";

mail.From = fromEmail;

mail.Subject = subject;

//Create mail message

MailMessage mess = mail.CreateMailMessage(email, new ListDictionary(), new System.Web.UI.Control());

SmtpClient sender = new SmtpClient(smtp);

sender.Credentials = new NetworkCredential(fromEmail, password);

//Send email


Could you please provide me your code and document that will allow me to reproduce this issue? I will investigate this and provide you more information.

Best regards.

I tested with GMail and it worked fine. Tiscali WebMail does not work correctly, however. I am liaising with Tiscali and will let you know if I discover anything further.

Thanks again for your great customer support