Issue with display: none Not Being Applied in Word Conversion

Hi,

I’m converting the following simple HTML file:

<html>
<head>
  <style>
    .hide {
      display: none;
    }
  </style>
</head>
<body>
  <p class="hide">This should be hidden</p>
  <p>This should be visible</p>
</body>
</html>

However, it appears that the display: none rule is not being respected. In the generated Word document, the text inside the hidden paragraph is still visible.

Do you know what might be causing this?

Best regards.
test1.docx (113.5 KB)

@fdt

It seems that the issue you’re experiencing with the display: none rule not being respected during the conversion to a Word document may be related to how Aspose.Words handles hidden content.

In some cases, content styled with display: none in HTML is correctly marked as hidden in the generated Word document. However, if the “Show paragraph marks and other hidden formatting symbols” option is enabled in Word, you might still see the hidden content. To verify that the content is indeed hidden, you can disable this option in Word (using Ctrl + *).

If you are still seeing the hidden content despite this, it may be worth checking the version of Aspose.Words you are using, as there could be updates or fixes related to HTML rendering and hidden elements.

If you continue to face issues, consider reaching out to the Aspose support team for further assistance.

Sources:
[1]: Loading Html ignores

1 Like

Issue solved. Thx.

1 Like