(Related: https://forum.aspose.com/t/comparing-documents-explodes-w-hyperlinks-into-sequence-of-w-fldchars/241646.)
The left and right documents contain only a hyperlink and are identical except for the presence of the w:history
attribute. This attribute causes document comparison to show the hyperlink as being deleted, and then immediately re-added. The deleted and re-added hyperlinks are not identical: one has the \h
switch, and the other does not.
My understanding is that \h
is a display-formatting flag, so the deletion/re-addition isn’t even representing the change in attribute properly. (But please correct me if I’m wrong here.)
Desired result: correctly represent the change by deleting/inserting w:hyperlinks
(as in the issue linked above). Acceptable but less desired result: don’t generate an insertion/deletion if it can’t/doesn’t represent the change that actually happened to the w:hyperlink
.
Java, 22.1.
right.docx (11.1 KB)
left.docx (11.1 KB)
compared.docx (10.8 KB)
Filed internally as #8479.
@epaulet-society
The history attribute as per specification
The history attribute value of true specifies that the target of the current hyperlink must be added to a list of visited hyperlinks when invoked within the document.
So, it cannot be said that this is a formatting attribute.
As far as I see the comparison using MS Word
Sub CompareDocument()
ActiveDocument.Compare Name:="right.docx", _
CompareTarget:=wdCompareTargetNew
end sub
gives a completely identical result, including converting w:hyperlink to HYPERLINK field with \h attribute. The policy of Aspose.Words is the mimics MS Word behavior. Therefore, in this case, we do not see any inconsistencies.
Ah, I also see that Word behaves the same, so I understand why you would not want to make the change. I’ll work around it on my own end.
@epaulet-society We apologize for the inconvenience, but such a fix may cause complaints from our other customers who expect behavior similar to MS Word.