Compare HTML gives different results in export to DOCX and HTML (Formatting changes lost in Output HTML)

I am comparing two HTML files , while exporting it to the DOCX , I can see the simple text and formatting changes ( Rich text formatting ) , But exporting in HTML the formatting changes lost (It is not the same as DOCX generted) . I have implemented the solution given here - Compare: formatting changes lost when saved as html - #3 by chiraggupta629 .But my formatting changes coming empty and if i export as .docx , it produces the accurate result with formatting results on the side panel.

I am using aspose-words-22.9 with OpenJDK - jdk-8.0.232.09-openj9.
DOCX.png (6.7 KB)
HTML.png (2.9 KB)

Input.zip (1.1 KB)

@chiraggupta629 It looks like you need to set ShowInBalloons.FORMAT_AND_DELETE in RevisionOptions. Please try using code like the floowing:

docA.compare(docB, "Author", new Date(), cmpOptions);

docA.getLayoutOptions().getRevisionOptions().setShowInBalloons(ShowInBalloons.FORMAT_AND_DELETE);

docA.save("C:\\Temp\\Output.html", options);
docA.save("C:\\Temp\\Output.docx");

Hello @alexey.noskov ,

It is working , It is showing the result in side panel . And in HTML format , it is very difficult to differntiate which part of text has been formatted , DOCX version is quite good.Is there any solution of this ? Is this API capable of sending the meta-data, so i can create the view myself. ?

HTMLFormattingWithSidePanel.png (17.6 KB)

@chiraggupta629 Unfortunately. there is no way to output revisions in HTML format in a good way. The approach you are using is document rendering, where revisions are simply rendered to provide visual representation of revisions not their real functionality. This is the same what MS Word does when you save document with revisions to PDF.

Hello @alexey.noskov ,
I have few more queries -

  1. The result html is completely changed from the given input html. I mean you have added span tag and some styles to the html. I only want to put “<ins” and "<del " tag to the changed text. Is it possible ?

  2. I want to give my custom styling to the text for removed and inserted text like I want to give custom background color and strikethrough the text.

Can i do that. ?

  1. For Image comparison (In my case - svg) , sometimes the output is not correct ( I have compared two different iamges , Sometimes , it returns both images and sometimes only single image).

@chiraggupta629 The questions are answered in another your thread:
https://forum.aspose.com/t/compare-results-formatting-changes-in-html/254545