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

Free Support Forum - aspose.com

Style issue when converting HTML to Word

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

I am evaluating the Aspose.word to convert the HTML to Word Document.

Attached htmltoword.zip file has the input xml, styles and the word document created by Aspose.Word.

The below HTML is translated as below in the out put.

<DIV style="DISPLAY: none" id=contactTitle class=short>Contact Name

Contact Name

Wherein in the HTML the style DISPLAY:none is not displayed.

below is the code used to create the file

string fileName = @"D:\Trials\Aspose\sample files\prb\in1.html";

// Open the stream.
Stream stream = File.OpenRead(fileName);

// Open the document. Note the Document constructor detects HTML format automatically.
// Pass the URI of the base folder so any images with relative URIs in the file can be found.
LoadOptions loadOptions = new LoadOptions();
loadOptions.BaseUri = @"D:\Trials\Aspose\sample files\prb";
loadOptions.LoadFormat = LoadFormat.Html;
Document doc = new Document(stream, loadOptions);

// You can close the stream now, it is no longer needed because the document is in memory.

// Save in the DOC format.
doc.Save(MyDir + "Document.OpenFromStreamWithBaseUri Out.doc");

Is there a work around for this in ASPOSE?

Please suggest

Thanks for your help.

Best Regards,



Thanks for your request. Aspose.Words does not support inheriting styles from parent elements in HTML.

In your particular case, formatting of text is specified on

element. But currently, Aspose.Words expects that font formatting (display:none or hidden is font option in MS Word) is set in , , or element, formatting of paragraph – in


elements etc…

Your request has been linked to the appropriate issue, you will be notified as soon as it is resolved.

In your case, your HTML should look like the following:



<p><span style="display:none">hidden text</span></p>



Best regards.


Many thanks for the reponse. Nested level of styles are not supported for divs.

will there be any fix for this? Any timelines would be of help.




Thanks for your request. Sure we are working on improving our HTML module. Once we implement mechanism of inheriting styles from parent elements, your issue will be resolved.

Unfortunately, at the moment I cannot provide you any reliable estimate regarding this issue. We will keep you informed regarding its status and let you know once it is resolved.

Best regards,

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

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