Free Support Forum - aspose.com

How to remove the title from the conversion Word to HTML?

Hi,

Could you tell me how to remove the title from the conversion Word to HTML?

Could you give me a sample?

Thanks,

Tan Quan

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

Thanks for your request. If you meant tag in HTML then you can use the following code snippet.

//Open document

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

//Save html to MemoryStream

MemoryStream htmlStream = new MemoryStream();

doc.Save(htmlStream, SaveFormat.Html);

//Get Html string

string htmlString = Encoding.UTF8.GetString(htmlStream.GetBuffer());

//Remove

htmlString = Regex.Replace(htmlString, ".*", "", RegexOptions.IgnoreCase);

//Save htmls to file

Stream htmlFile = new FileStream(@"Test106\out.html", FileMode.Create);

StreamWriter htmlWriter = new StreamWriter(htmlFile);

htmlWriter.Write(htmlString);

htmlWriter.Close();

htmlFile.Close();

Hope this helps.

Best regards.