Proofing Tool API
We develop high quality grammar based proofing tools (including grammar checkers), and were looking into making them portable via Office.js, but the APIs are so fragmented and anemic that this seems extremely hard or even impossible.
We do not care whether the host app is Word, PowerPoint, Excel, Outlook or whether it's on Windows, Mac, iOS, Online ... we just need 3 things:
1) Read access to the current text that the user is editing, preferably with paragraph granularity.
2) Ability to navigate the user's view around to specific parts of the text, in order to highlight where an error is.
3) Write access to the current text, with single word granularity; not just preferably - this is a requirement, so that we can replace a single word with the user's chosen replacement, without messing up formatting.
Currently, #1 and #2 look to be doable in the Word 2016 preview API, but why is that limited to Word? And #3 is just not doable in any of the APIs.
Also on the wish list of things we'd like to do is add temporary colored wavy underlines, exactly like the built-in proofing tools are allowed to. This can't even be done from the non-portable C# APIs, so that would be a major improvement.
But of course, a proper cross-application cross-platform proofing tool API would be wonderful, as long as we can create a custom GUI for it to display contextual information.
Tino, thank you so much for your suggestions! We really appreciate it.
There are many requests on this entry. We strongly recommend that you open one for each granular requirement, so they can be voted individually. Could you please do that?
The first three things you are asking here are supported in Word. Please open separate requests for the other hosts so we can track them under the right categories and with the right teams.
For#1, you can absolutely have access to the current text. You can do range.getSelection().paragraphs . If there is no selection but the caret, you get the entire paragraph. once you are in a paragraph, you can use next(), previous() methods to navigate as needed.
For #2 and #3, I am not sure about the granularity level you need but if it’s word level, please check out the range.split method where you can get a set of ranges given a set of delimiters. For instance paragraph.split([" "]) will give you all the words in the paragraph.
The item noted as wish list adding wavy underlines is a good idea . Please create a separate item for this. Also for the cross platform proofing API.
Hope this helps.
Office Extensibility Team