Compare for Java with RTF does not highlight style changes


#1

I am using Comparison for Java 17.3.2 with a trial license. I am testing RTF comparison and it detects style changes but does not highlight them like it does with DOCX. If I change the margins in DOCX it will show 1 style change and a green box where the margins were changed. In RTF it shows 1 style change but nothing in the document above the summary to indicate where the style change is.

Code Used:
private static void compareFiles(String file1, String file2, String reportPath)
{
ComparisonSettings settings = null;
Comparer comparer = null;
ICompareResult result = null;
String suffix = null;

	try
	{
		comparer = new Comparer();
		settings = new ComparisonSettings();
		settings.setGenerateSummaryPage(true);
		settings.setStyleChangeDetection(true);
		
		suffix = file1.substring(file1.lastIndexOf("."));
		if(!suffix.startsWith("."))
		{
			suffix = "." + suffix;
		}

		result = comparer.compare(new FileInputStream(file1), new FileInputStream(file2), settings);
		result.saveDocument(reportPath + suffix);
		
		System.out.println("Finished compare " + result.getCountOfErrors() + " errors and " + result.getChanges().length + " changes.");
		System.out.println("Report written to " + reportPath + suffix);
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
}

I have attached a zip file with the two documents compared and the result document.
Compare.zip (93.3 KB)


#2

@sherter,

Thank you for taking interest in GroupDocs.Comparison for Java and posting your concerns.
This issue is reproduced at our end. Hence, it has been logged in our internal issue tracking system with ID: COMPARISONJAVA-419. It is still under investigation. As we have any update, we shall notify you.

Aside this, it’s been observed that this issue is generated in particular source and target files you shared. We compared some other RTF files and output shows highlights output.zip (9.3 KB).


#3

@sherter,

Your reported issue COMPARISONJAVA-419 is resolved in 18.6 version of the API. Please integrate latest release of the API in your project.


#4

I downloaded version 18.6 and re-ran my test. It is finding a lot more, but the style change for different margins is still not highlighted. I have attached a zip file with the two documents and the report. The only change to the code was to remove the reference to getCountOfErrors off of the result since it looks like it is no longer there.RTF_Compare2.zip (144.6 KB)


#5

@sherter,

Can you please point out such paragraph or line? Output report shows number of style changes (9). But report doesn’t highlight them (it only highlights 4 changes), right?


#6

I provided the two original RTF documents to compare. The last paragraph before the signature block is indented in the document in folder RTF1 and is not indented in the document in folder RTF2. Those folders and documents are in the RTF_Comapre2.zip I uploaded previously.


#7

@sherter,

We are further investigating this issue. We shall notify you as we have any update.


#8

Have you manged to reproduce the problem or get any more information on this?

Thanks.


#9

@sherter,

This issue is still under investigation. We shall update you as we have any update on it.


#10

@sherter,

Please integrate latest version 18.6.1 of the API. You can now see style changes in the output file. See this screenshot - style changes.JPG (107.4 KB).


#11

With 18.6.1 it looks like it is finding everything.


#12

@sherter,

Glad to know that your issue is now resolved.