It seems you are experiencing issues with the comparison of DOCX files using Aspose.Words, specifically regarding the display of changes in the viewer. Here are some insights that may help you troubleshoot the problems you described in both scenarios:
Scenario 1: Added Bullet Point
In your first scenario, you mentioned that a bullet point was shown as edited in the viewer, even though it was not actually edited. This could be due to how the comparison algorithm interprets changes. To ensure accurate comparison results, you might want to consider the following:
Check Comparison Options: You can customize the comparison settings to ignore certain types of changes. For instance, if formatting changes are causing the bullet point to be flagged, you can set the comparison options to ignore formatting differences.
Scenario 2: Removed All Content
In the second scenario, where you removed all content in two steps, and the changes count was shown incorrectly, it might be beneficial to:
Use Granularity Settings: Adjusting the granularity of the comparison can help in accurately detecting changes. For example, you can set the granularity to character level to capture more detailed changes.
Example Code
Here’s a basic example of how to set up a comparison with custom options in Aspose.Words:
import com.aspose.words.*;
public class DocumentComparison {
public static void main(String[] args) throws Exception {
Document docA = new Document("Source.docx");
Document docB = new Document("Target.docx");
CompareOptions options = new CompareOptions();
options.setIgnoreFormatting(true); // Ignore formatting changes
options.setIgnoreHeadersAndFooters(true); // Ignore headers and footers
docA.compare(docB, "user", new Date(), options);
System.out.println("Changes count: " + docA.getRevisions().getCount());
}
}
Additional Recommendations
Review Documentation: It may be helpful to review the Aspose.Words documentation on document comparison to understand the various options available and how they can affect the results.
Check for Updates: Ensure you are using the latest version of Aspose.Words, as updates may include bug fixes and improvements related to document comparison.
If the issues persist, consider providing more details or examples of the documents you are comparing, as this may help in diagnosing the problem further.
The behavior is expected. Aspose.Words comparison result is the same as MS Word comparison result. Here is the result produced by MS Word for Scenario 1: ms.docx (35.4 KB)
The behavior is expected. Aspose.Words comparison result is the same as MS Word comparison result. Here is the result produced by MS Word for Scenario 2: ms.docx (39.8 KB)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.