1

How can i get the text in range from the current location of the cursor till the end of the file? I use JavaScript Word api.

2
  • 1
    What code have you tried so far? Commented May 1, 2022 at 11:37
  • 1
    As you can read in the API documentation, you have to get the Selection (the curser is an empty selection), and can then grab the text from the document retrieved. Commented May 1, 2022 at 11:42

1 Answer 1

0

Found a solution:

const doc = context.document;
const originalRange = doc.getSelection();
originalRange.load("text");
await context.sync();

var txt = originalRange.text;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.