Import DIV Elements as HtmlBlock | Fill Entire DIV with a Background Color during HTML to Word Conversion C# .NET

Hi team,

i have a Html document where there is div having width 33% and they are in same line.
however when its converted to word document , i get single div in a row.
please guide. language-c#

@Rupesh.Kumar,

Please ZIP and upload your input HTML file and Aspose.Words generated DOCX file showing the undesired behavior here for testing. We will then investigate the issue on our end and provide you more information.

Docx file.zip (16.5 KB)
Attached zip file with sample html and word generated from aspose

@Rupesh.Kumar,

Please note that Aspose.Words for .NET tries to mimic / copy the behavior of MS Word during converting HTML to Word formats. We have converted your “HTML file.html” file to DOCX format by using Aspose.Words 20.9 and MS Word 2019 and attached them here for your reference:

There seems to be two differences in Aspose.Words 20.9 and MS Word 2019 generated DOCX files. We have logged the following issues in our issue tracking system:

  • WORDSNET-21063 : Preserve 5px outset red border around DIV during HTML to Word Conversion
  • WORDSNET-21064 : Fill entire DIV with lightblue background-color during HTML to Word Conversion

We will further look into the details of these problems and will keep you updated on the status of the linked issues.

The issues you have found earlier (filed as WORDSNET-21063) have been fixed in this Aspose.Words for .NET 22.8 update also available on NuGet.

The issues you have found earlier (filed as WORDSNET-21064) have been fixed in this Aspose.Words for .NET 22.9 update also available on NuGet.