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

Free Support Forum - aspose.com

Save HTML in string

I am converting a Word document to HTML. Is it possible to save the output in a string instead of a file?



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

Thanks for your inquiry. I think that you can use the following code to achieve this.

//Save document as HTML into memory stream

MemoryStream htmlStream = new MemoryStream();

doc.Save(htmlStream, SaveFormat.Html);

//Get html string

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

Hope this helps.

Best regards.