Header & Footer content updates are not showing properly in comparison output file

Hi Team,

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.");
}

source file (v1):
demo_v1.docx (1.3 MB)
target file (v2):
demo_v2.docx (4.0 MB)
Aspose - output file:
output.docx (1.2 MB)
MS word - output file:
MSWord-output.docx (4.0 MB)

@Kldv

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.

If you need further assistance, feel free to ask!

@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.

Hi @alexey.noskov I also noticed inconsistencies between the output files of MS Word Compare and Aspose Compare for the following files.

Input files:
source:
File_test_v1.docx (37.8 KB)

target:
File_test_v2.docx (81.6 KB)

Aspose- output:
Aspose-output.docx (56.4 KB)

MS word -output:
MSword-output.docx (81.8 KB)

Observations:

  • Even though there is no header in even pages, it is showing header
  • Header text also not showing properly in even pages.

@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.