I am currently working on a plugin which will take voice commands and upon receiving a response from the server, act accordingly. For example if i say "delete word", the last word will be deleted. I want to be able to move the pointer left/right/up one line/down one line. Does Word Javascript API provide a way to achieve this?
There are no cursor movement APIs. But there are methods on the Paragraph object for getting the previous paragraph and the next paragraph. There are also ways to move among Ranges, if you can get a collection or an array of the ranges that you want to move around. And you can find the AdjacentAfter
and AdjacentBefore
ranges using the Range.compareLocationWith
method. The Range object also has getNextRange
and getNextRangeOrNullObject
methods. Finally, the Range.select("Start")
and Range.select("End")
will put the cursor just before/after the current selected range.