Hello,
We have noticed a new issue in Aspose.Words 25.10, where document metadata such as title, author gets cleared after performing document.compare with some other document (note there may be more, however some of the metadata like company name remains).
Here is a code snippet that reproduces the issue:
Document mainDocument = new Document();
mainDocument.getBuiltInDocumentProperties().setAuthor("Author");
mainDocument.getBuiltInDocumentProperties().setTitle("Document Title");
mainDocument.getBuiltInDocumentProperties().setCompany("Company Name");
CompareOptions compareOptions = new CompareOptions();
compareOptions.setGranularity(Granularity.WORD_LEVEL);
compareOptions.setTarget(ComparisonTargetType.NEW);
compareOptions.setIgnoreDmlUniqueId(true);
compareOptions.setIgnoreFormatting(false);
compareOptions.setIgnoreTables(false);
compareOptions.setIgnoreFootnotes(false);
compareOptions.setIgnoreTextboxes(false);
compareOptions.setIgnoreCaseChanges(false);
compareOptions.setIgnoreFields(false);
compareOptions.setIgnoreHeadersAndFooters(false);
// Compare main document with another document
Document otherDocument = new Document();
mainDocument.compare(
otherDocument,
" ",
Calendar.getInstance().getTime(),
compareOptions
);
BuiltInDocumentProperties properties = mainDocument.getBuiltInDocumentProperties();
// Aspose Words 25.10 "" (Unexpected - author is empty after compare)
// Aspose Words 24.9 "Author"
String author = properties.getAuthor();
// Aspose Words 25.10 "" (Unexpected - title is empty after compare)
// Aspose Words 24.9 "Document Title"
String title = properties.getTitle();
// Aspose Words 25.10 "Company Name" (Works as expected)
// Aspose Words 24.9 "Company Name"
String company = properties.getCompany();
Thank you!
@dfinsolutions
Summary
We could not locate any official documentation or release notes confirming that Aspose.Words 25.10 clears the Author and Title built‑in properties after a Document.compare operation. The behavior you observed appears to be a regression compared with version 24.9, but without supporting evidence we cannot definitively state the cause.
Why it might happen
In earlier versions the compare routine copies most document properties from the source document to the comparison result. If a change in the 25.10 build altered the handling of core properties (stored in docProps/core.xml), properties such as Author and Title could be omitted while app properties (e.g., Company) remain. This is a plausible explanation, but it is not confirmed by the available sources.
What to do next
- Confirm the behaviour locally – run the snippet you posted on both 24.9 and 25.10 and log the property values before and after
compare.
- Work‑around – if the properties are lost, store them before the comparison and re‑apply them afterwards:
// Save original values
String author = mainDocument.getBuiltInDocumentProperties().getAuthor();
String title = mainDocument.getBuiltInDocumentProperties().getTitle();
String company = mainDocument.getBuiltInDocumentProperties().getCompany();
mainDocument.compare(otherDocument, " ", Calendar.getInstance().getTime(), compareOptions);
// Restore lost values
mainDocument.getBuiltInDocumentProperties().setAuthor(author);
mainDocument.getBuiltInDocumentProperties().setTitle(title);
// Company usually stays intact, but you can set it again if needed
mainDocument.getBuiltInDocumentProperties().setCompany(company);
- Alternative approach – perform the comparison on a deep clone of the document so the original retains its metadata:
Document clone = (Document) mainDocument.deepClone();
clone.compare(otherDocument, " ", Calendar.getInstance().getTime(), compareOptions);
// Use `clone` for the comparison result; `mainDocument` still has its original properties.
- Report the issue – open a support ticket with Aspose, providing the minimal reproducible code, the version numbers, and the observed property values. Mention that the regression was not documented in the 25.10 release notes.
- Monitor future releases – once Aspose releases a fix or a hot‑fix, repeat the test. If the properties are retained, you can remove the workaround.
Note: Because the retrieved evidence does not contain any specific information about this metadata‑clearing behavior, the above explanation is based on typical internal handling of document properties and should be validated in your environment.
If you need examples for other languages (C#, Python, etc.) or further assistance, feel free to ask.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
@dfinsolutions
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-28819
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.