When using compare API to compare the two Word documents with formatting changes in between them, the Aspose’s Document.getRevisions() API gives the List of Revisions with type “RevisionType.FORMAT_CHANGE”. The API gives the high-level revision type as FORMAT_CHANGE and the corresponding Run/Paragraph nodes where the formatting changes had occurred. But there is no API interface to know the type and details of the formatting changes.
For example, each RevisionType.FORMAT_CHANGE can be a one or more formatting changes such as font name/size change, color/highlight change, bold/italics/underline change, paragraph setting changes etc… That is I can apply multiple formatting changes to a single word/sentence. There is no API interface to retrieve such details of the revision like a list of formatting changes. Here each formatting change can contain a FORMATTING_CHANGE_TYPE, and old and new values for the change type. FORMATTING_CHANGE_TYPE can be fontName, fontSize, color, underline change etc.
When we retrieve the font properties from the Revision’s parent nodes (that is, parent Run/Paragraph nodes) from the revision document (with track changes), the font property values are of old document’s unless we accept the Revision.accept(). Once we do Revisin.accept() call, then we get the new or the changed font property values. But what we want is the ability to directly get the ChangeList of formatting changes using an API interface in a direct fashion.
I tested this with following API to compare two Word documents using Aspose.Words for Java with version 15.8 (aspose-words-15.9.0-jdk16.jar).
==> Document.compare(Document document, java.lang.String author, java.util.Date dateTime)
Attaching the following documents for this use case:
- “SourceDoc.docx” – source doc
- “TargetDoc.docx” – source doc modified to this doc with a number of formatting changes.
- “Compare_by_Aspose.docx” – result of comparing source and target documents by Aspose APIs
The target document consists of most of the formatting changes such as font name/size change, color/highlight change, bold/italics/underline change, subscript/superscript/strike-off, paragraph setting changes etc.
For this case, it would be nice to provide API interfaces to directly retrieve the list of formatting change details as described above. We need this for our feature to show it to the customers.
For reference below I am giving document.xml contain following structure for a change in color, size, highlighting and underline – all applied at the same text. The document.xml gives the formatting difference in direct way - with old font property values are there inside the tag, whereas the new font property values are there directly inside the tag. We need this info to be directly exposed in the Aspose API in the form of ChangeList as describe above.
<w:rPr> <w:sz w:val="24"/> <w:szCs w:val="24"/> </w:rPr> </w:rPrChange> </w:rPr> <w:t>database management</w:t> </w:r>
- This Enhancement Request is very important for us.