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

Free Support Forum - aspose.com

Creating ASPOSE.Word.Document from html

Hi Guys,
I’m using ASPOSE.Word product to display and edit rich text. First, I am reading saved word document from database and building ASPOSE document. Then, I am saving it in HTML format and putting them into div object to display in browser. When user edit document and try to save it, I am trying to create ASPOSE Document from inner html of the div object. I coded following lines,
MemoryStream ms = new MemoryStream(ASCIIEncoding.Default.GetBytes(ri.CurrentValue));
Document doc = new Document(ms);
doc.Save(ms, SaveFormat.Rtf);
But it is throwing exception in second line. (Unknown file format). But, this html code was produced by ASPOSE!!
P.S: rich text in html format. It is created by ASPOSE.Word and users edit it.

Thanks for your inquiry. This exception can be caused when HTML document is not properly formatted. For example the following HTML will cause this exception.

<h1>Aspose Test</h1>

But the following will work fine.

<h1>Aspose Test</h1>

I hope this could help you.
Best regards.