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

Free Support Forum - aspose.com

Insert Html with style

Hi,


I have a requirement where I need to insert html in a word document. The html tags have css class assigned to it. They styles are not being applied property in the word document.

Here is some sample HTML

Text in a P tag

Test Div

One two

Once injected using insertHtml, I cannot see the style applied on the node.

Is there any way I can find the node that was created by the insertHtml operation and then set the styles manually on the node ?

Thanks
Karan

Hi Karan,

Thanks for your inquiry.

The latest version of Aspose.Words i.e. 13.8.0 supports importing style elements specified via “class” attribute on HTML paragraph elements. However, the HTML import engine currently does not fully support styles on div nodes during importing HTML into Aspse.Words’ DOM. I have logged this issue in our bug tracking system as WORDSNET-8921 . Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Secondly, I think, you need to implement INodeChangingCallback interface if you want to change values of the objects i.e. being inserted via InsertHtml method. As you go with the insertion of different HTML tags, you can track which nodes are currently being inserted and hence can modify the behavior at runtime.

Best regards,

Hi Karan,


Thanks for being patient. To ensure an accurate fix to your issue, please share the following resources:

  1. Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates your problem and attach it here for our reference.
  2. Please attach your input Word document you’re inserting HTML in using the insertHtml method.
  3. Please attach the output Word file that shows the undesired behaviour.
  4. Please attach your target Word document showing the desired behavior. You can use Microsoft Word to create your target Word document. We will investigate as to how you are expecting your final document be generated like.

Thanks for your cooperation.

Best regards,

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


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