Search code examples
office-jsonenote-api

Get the currently highlighted text in a OneNote Document


When building a word add in I can use

var selectedRange = context.document.getSelection();

To get the currently selected text, is this possible with Onenote addins?


Solution

  • Yes. You can do this through the getSelectedDataAsync method of the Common Office JavaScript API. For details about using this API in OneNote, see accessing-the-common-api-through-the-document-object