roland75's avatar
roland75
Copper Contributor
Aug 28, 2024
Status:
New

[Word API] Document.compare: ability to specify Original and Revised document?

We're using the new Word.Document.compare() API, which is currently in preview (https://learn.microsoft.com/en-us/javascript/api/word/word.document?view=word-js-preview#word-word-document-compare-member(1)) . It seems it is not possible to specify what is the original and what is the revised document. It seems to assume the current document is the original, and the target document is the revised document

 

See also this Github issue: https://github.com/OfficeDev/office-js/issues/4766

3 Comments

  • skorada's avatar
    skorada
    Copper Contributor

    The compare api functionality is really confusing the user without the option of specifying which one is original and which one is revised.  Is there a way for this feature request to be picked up?

  • asparrowhawk's avatar
    asparrowhawk
    Copper Contributor

    Without the option to specify which document is the original, the resulting comparison can be confusing for the user. I have an example Add-in that loads some document content from a base 64 string. If I then delete a word and invoke the `compareFromBase64` function with the `CompareTarget.compareTargetNew` option a new window appears that details the differences. However the difference shown is that the word that was deleted is highlighted as being added.

    The Office Add-in sample code can be found https://github.com/asparrowhawk/word-comparison