Background color move to child element

I want to set the background color on the outermost"div". After i save the document, i notice that this style was remove from outside “div” , and move to child element. For example, “div style=‘background-color:#808000;’><div” will be replace with "div><p style=“background-color:#808000;>”

Here is the sample code: (602 Bytes)


Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. If you open the HTML in MS Word and convert it to HTML, you will get the same output. Please check the screenshot.

However, we have logged this problem in our issue tracking system as WORDSNET-17801. You will be notified via this forum thread once there is an update available on this issue.

Do you have any workaround to avoid this issue?


Thanks for your inquiry. The shared issue is not a bug. So, we have closed it as “Won’t Fix” resolution.

The <div> blocks like the one used by you cannot be represented in the model and are ignored on load. As a workaround, you could use a table cell instead of <div>. That is, replace

<div style=‘background-color:#808000;’>…</div>


<table><td style=‘background-color:#808000;’>…</td></table>