-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context.document.body.text differs depending on platform #5286
Comments
Thank you for reporting this issue. We have confirmed that while the context.document.body.text method works correctly in the Word desktop client, it returns deleted text in Word Online when the "Simple Markup" option is enabled, as you described. We have logged this issue with the reference number #9698150 and have involved our development team for further review. We apologize for any inconvenience this may cause and appreciate your patience. Best regards, |
@pdoyon-Druide , thanks for reporting this. In this case (with "track changes" on), we recommend you to use another API to get the proper text: https://learn.microsoft.com/en-us/javascript/api/word/word.body?view=word-js-preview#word-word-body-getreviewedtext-member(1) That is: |
Thank you for your suggestion, but “body.getReviewedText(Word.ChangeTrackingVersion.current)” doesn’t quite fit our needs. This method returns text without deleted characters, which may differ from what is displayed in the document. Since our add-in relies on the “Range.search” function to find a specific range in the document, obtaining the text displayed in the document is essential. |
@pdoyon-Druide , I'm not sure whether there're any misunderstanding here, but I can per your test cases. Please check the attachment |
Sorry, I wasn't clear enough. With Word on line, when the “Markup on page” option is selected, the deleted characters appear in the document. However, they disappear when the “Simple Markup” option is activated. “body.getReviewedText(Word.ChangeTrackingVersion.current)” always provides text without deletions. Therefore, the result of this function does not always match to the text displayed in the document. |
context.document.body.text does not always return the text displayed in the document with Word Online.
Your Environment
Expected behavior
The output of the “context.document.body.text” function should remain consistent across all platforms. At present, it displays the text visible in the document’s preview on both Windows and Mac computers. However, this behaviour does not necessarily hold true for Word Online.
Current behavior
When the "Simple Markup" option is selected in Word Online for displaying "Simple Markup" (Review > Markup View > Markup in margin), the deleted text appears in the "context.document.body.text" property , but it is not displayed in Word's document view.
Steps to reproduce
The result is -> I eat an apples.
Context
Our plug-in depends on the “context.document.body.text” method to search for text in a document. Unfortunately, this functionality does not work with Word Online when the “Simple Markup” option is enabled.
The text was updated successfully, but these errors were encountered: