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.

Hi @alexey.noskov I noticed that the stories created for your internal tracking systems are marked as closed. Could you provide an update on this? what is causing these issues, and are there any steps we need to follow to prevent them?

@Kldv Yes, both issue are already resolved. The fixes will be available in the next 25.4 version of Aspose.Words. We will be sure to let you know once it is released. Usually java releases are published in the middle of each month.

The issues you have found earlier (filed as WORDSNET-28029) have been fixed in this Aspose.Words for .NET 25.4 update also available on NuGet.

Hi @alexey.noskov

We have encountered an issue similar to WORDSNET-28035 (tag updates in footer not coming). Could you please check the provided files and let us know if it is resolved with the latest changes of v25.4, or if it is a new issue that needs to be addressed?

Input files:
source file: source-Non Disclosure Agreement_very new.docx (133.5 KB)

target file: target-Non Disclosure Agreement_very_v2.docx (120.9 KB)

MSword Output: MSWord-output.docx (122.1 KB)

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

Observation:
on the first page, Aspose isn’t showing the data in the title and subtitle tags in the document body, but MS Word displays them correctly.

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

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 completed analyzing WORDSNET-28117. You should use ComparisonTargetType.New to get desired output (MS Word compares this case in different way depending on target type). Currently Subject property is not processed but Title property is already handled properly.

CompareOptions compareOptions = new CompareOptions() { Target = ComparisonTargetType.New };

Document v1 = new Document(@"C:\Temp\v1.docx");
Document v2 = new Document(@"C:\Temp\v2.docx");
v1.Compare(v2, "test", DateTime.Now, compareOptions);
v1.Save(@"C:\Temp\out1.docx");

out1.docx (83.0 KB)

Hi @alexey.noskov do we need to use this setting for specific files, or can we use it as the default for all comparisons?

@Kldv You can try using this options as default and see if it better fit your needs.

The issues you have found earlier (filed as WORDSNET-28035,WORDSNET-28029) have been fixed in this Aspose.Words for Java 25.4 update.

The issues you have found earlier (filed as WORDSNET-28117) have been fixed in this Aspose.Words for .NET 25.5 update also available on NuGet.