Aspose.words API/online converter is not able to retain formats, once converted from html to docx

https://products.aspose.app/words/conversion#

InputHTML.docx (7.2 KB)

Reference :
input html doc we used :

"<html><head>this is title</head><body><div class=\"sw-full-screen-off\"><aw-scrollpanel class=\"aw-base-scrollPanel\"><div type=\"TOOLBAR\" orientation=\"HORIZONTAL\" negative=\"true\" class=\"aw-advanced-bar aw-advanced-bar-horizontal \"> <div class=\"sw-row justify-justified\"><div class=\"sw-column align-self-center justify-center\"><div class=\"aw-command-bar aw-commands-commandBarHorizontal \" anchor=\"aw_requirementHistoryContentViewer\" data-locator=\"command-bar-aw_requirementHistoryContentViewer\"><div class=\"aw-commands-wrapper  aw-no-overflow\"><div class=\"aw-command\"></div></div></div></div><div class=\"sw-column align-self-center justify-center\"><h5>Comparison Preview: \"Revision\nA;\nVersion\n2\" with \"Revision\nA;\nVersion\n3\"</h5></div><div class=\"aw-requirement-chip\"><span><span style=\"display: inline-block; background-color: rgb(132, 227, 185); height: 5pt; width: 5pt;\"></span><span> Added</span><span style=\"display: inline-block; background-color: rgb(227, 137, 132); height: 5pt; width: 5pt;\"></span><span style=\"margin-right: 15px;\"> Removed</span><span style=\"display: inline-block; background-color: rgb(102, 200, 222); height: 5pt; width: 5pt;\"></span><span> Formatted</span></span></div><div class=\"sw-column align-self-center justify-center\"><div class=\"aw-command-bar aw-commands-commandBarHorizontal \" anchor=\"arm0_comparisonPreviewListcommands\" data-locator=\"command-bar-arm0_comparisonPreviewListcommands\"><div class=\"aw-commands-wrapper  aw-no-overflow\"><div class=\"aw-command\" title=\"Swap\"></div><div class=\"aw-command\" data-popup-id=\"ui-id-5\"></div></div></div></div><div class=\"sw-column align-self-center justify-center\"><div class=\"aw-command-bar aw-commands-commandBarHorizontal \" anchor=\"aw_toolbarRight,aw_fullScreen\" data-locator=\"command-bar-aw_toolbarRight,aw_fullScreen\"><div class=\"aw-commands-wrapper  aw-no-overflow\"><div class=\"aw-command\" data-popup-id=\"\"></div></div></div></div></div> </div><div class=\"aw-requirements-compareHistory aw-richtexteditor-documentPaper aw-richtexteditor-document aw-richtexteditor-documentPanel\"><div><div><div><!--?xml version=\"1.0\" encoding=\"UTF-8\"?--><diffreport><h3><div class=\"aw-compareHistory-header1\"> Test Header</div><div class=\"aw-compareHistory-header2\" style=\"font-size: 10pt;\">Revision A</div></h3></body></html>"

@nchauras I do not see issues with your HTML document conversion. I have used the following simple code for testing:

Document doc = new Document(@"C:\Temp\in.html");
doc.Save(@"C:\Temp\out.docx");

Here is output DOCX documents produced by Aspose.Words and MS Word:
ms.docx (12.5 KB)
out.docx (7.2 KB)

Could you please specify what exactly is not retained? Also, please not, Aspose.Words is designed to work with MS Word documents. HTML documents and MS Word documents object models are quite different and it is not always possible to provide 100% fidelity after conversion one format to another.

input html had colored legends like below –

And the converted Docs –

@nchauras Thank you for additional information. In your HTML you use span for inserting such colored rectangles:

<span style="display: inline-block; background-color: rgb(132, 227, 185); height: 5pt; width: 5pt;"></span>

In MS Word document analog of span is Run node that can have background, like you see in the output document, but it cannot have fixed dimension.
If you have control over the HTML creation process, I would suggest you to use images or SVG to insert these colored rectangles. In this case they will look like expected in MS Word.