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

Free Support Forum - aspose.com

Save a word to html produces empty html

We use the following code to convert a word document (docx) into a html document.

var opt = new Aspose.Words.Saving.HtmlSaveOptions();
opt.Encoding = Encoding.UTF8;
var doc = new Document(@"C:\temp\customer.docx");
doc.Save(@"c:\temp\output.html", opt);

With a specific document, the html will be almost empty (no content from the word document).
The document is attached to this issue (customer.docx).
Running the above code with this document will produce a empty html.
Reason seems to be that all content is part of the word header.
But with other document with content placed only in the word header, the creation of a html works just fine.

We are using Aspose.Words.dll 2015 04 30

Any hints what is wrong?

Hi Manuel,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12546. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please use highlighted code snippet as a workaround of this issue. Hope this helps you.

var opt = new Aspose.Words.Saving.HtmlSaveOptions();
opt.Encoding = Encoding.UTF8;
var doc = new Document(MyDir + "customer.docx");
if (doc.Sections.Count == 1 && doc.FirstSection.Body.ToString(SaveFormat.Text).Trim() == "")
{
    DocumentBuilder builder = new DocumentBuilder(doc);
    builder.Writeln();
}
doc.Save(MyDir + "output.html", opt);

The issues you have found earlier (filed as WORDSNET-12546) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.