0

I have an application which uses the scripting bridge to locate revisions in a Microsoft Word document and display them in a NSTableView. I would like to select the revision text based on a row selection in the table view. I have intercepted the row selection and have tried the following to select the text in Word:

WordRevision *revision = ...
WordTextRange *range = revision.textObject;
WordSelectionObject *selection = self.activeDocument.activeWindow.selection;
selection.selectionStart = range.startOfContent;
selection.selectionEnd = range.endOfContent;

This appears to select the correct text but it doesn't scroll the document so that it is visible. When I use the "select" command in AppleScript it does just that.

I haven't found a "go to selection" command or anything that would tell the window to always display the selection.

Any ideas? Thanks.

Mac OS X 10.9 (Mavericks), Microsoft Word 2011

Barry Lay
  • 13
  • 4

1 Answers1

0

I figured out how to do this.

The parent object WordBaseObject has a select method, so the code becomes simply

WordRevision *revision = ...
WordTextRange *range = revision.textObject;

[range select];
Barry Lay
  • 13
  • 4