An Office service that supports add-ins to interact with objects in Office client applications.
Hello RahulK
Thank you for reaching out to Microsoft Q&A.
Based on the information you described, I understand that you are attempting to compare the currently opened Word document with another document using the compareFromBase64 method. This works correctly on Word for Mac (desktop) but consistently throws a RichApiException on Word for Windows (desktop). Your requirement is to support document comparison on both Windows and Mac desktop versions, and ideally also on Word for the web if possible.
After researching, the compareFromBase64 method is part of the Word JavaScript API (WordApiDesktop requirement set) and is not supported in Word Online. Word for the web does not provide any native Office.js API for document comparison, and there is currently no workaround within Office JS to enable this functionality online.
If document comparison is required for Word Online, the recommended approach is server-side processing, for example:
Export the currently opened document using getFileAsync (OOXML) > Send that content along with the second document’s Base64 to a backend service > Perform the comparison using Open XML SDK or a third-party document comparison library.
The compareFromBase64 method belongs to WordApiDesktop 1.2, which is only available in newer Microsoft 365 builds for Windows.
This method requires:
- Microsoft 365 Version 2502
- Build 18526.20144 or later
Your current Windows version does not yet support this requirement set, which explains the RichApiException (the API does not exist on that host version). So, please update Office on Windows to the latest Microsoft 365 build and retest.
I hope this clarifies the behavior you’re seeing and helps you move forward. If you need help, please feel free to let me know.
If the answer is helpful, please click ""Accept Answer"" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.