I’m using Aspose.words for Java to compare two versions of .DOCX files, but I noticed that footer content updates are not showing in the comparison output file, even though it works fine on MS Word compare.
sample code:
public static void main(String[] args) throws Exception {
String currentDirectory = System.getProperty("user.dir");
System.out.println("Checking Aspose Java library with current dir :" + currentDirectory);
loadAsposeLicense();
Document original = new Document("<file-v1>.docx");
Document revised = new Document("<file-v2>.docx");
compareDocuments(revised, original);
}
public static void compareDocuments(Document original, Document revised) throws Exception {
if (original.hasRevisions()) original.acceptAllRevisions();
if (revised.hasRevisions()) revised.acceptAllRevisions();
original.compare(revised, "Author", new java.util.Date());
original.save("<output-file-name>.docx");
System.out.println("Comparison completed. Result saved.");
}
It seems that the footer content updates are not being reflected in the comparison output file when using Aspose.Words for Java. This issue may arise due to the default comparison settings, which might be ignoring certain elements like headers and footers.
To ensure that footer changes are included in the comparison, you can utilize the CompareOptions class to adjust the comparison settings. Specifically, you should set the IgnoreHeadersAndFooters option to false. Here’s how you can modify your compareDocuments method to include this option:
public static void compareDocuments(Document original, Document revised) throws Exception {
if (original.hasRevisions()) original.acceptAllRevisions();
if (revised.hasRevisions()) revised.acceptAllRevisions();
CompareOptions options = new CompareOptions();
options.setIgnoreHeadersAndFooters(false); // Ensure headers and footers are considered
original.compare(revised, "Author", new java.util.Date(), options);
original.save("<output-file-name>.docx");
System.out.println("Comparison completed. Result saved.");
}
By setting IgnoreHeadersAndFooters to false, the comparison will take into account any changes made in the footers, which should resolve the issue you are experiencing.
Make sure to test this adjustment with your documents to verify that the footer updates are now reflected in the output file. If you continue to face issues, consider checking the specific content of the footers in both documents to ensure they are being recognized correctly by the library.
@Kldv
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28035
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@Kldv
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28029
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
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.
Enables storage, such as cookies, related to analytics.
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.