Back to LanguageTool Homepage - Privacy - Imprint

I think I can program an add-in for Microsoft Word


(Ray Culp) #1

Hello everyone,

Awesome tool you have going here.

I'd be interested in programming an add-in for Microsoft Word.

I read at http://wiki.languagetool.org/missing-features that doing this would require using CGAPI.

THB, I have no idea what that API / library is, but even without knowing what it is, I think I can safely say that you don't need it.

You can run LanguageTool as a server on your local machine and send queries to it via HTTP. This is exactly how the extension for Firefox works. You send an HTTP request and the server returns XML. I haven't tried out other plugins, such as the one for Open Office, but I suspect they work the same way.

If this is true, then I see no reason why it wouldn't be possible to program an add-in for literally any application that queries the local server the same way. I've written Office add-ins that query remote servers using HTTP. Why wouldn't it work with a local server?

What do you think?

Best regards

Ray


(Daniel Naber) #2

Hi Ray,

yes, you could contact a local server. The LibreOffice version doesn't do that but that's also because we first had the LibreOffice/OpenOffice integration and only later the HTTP service I think.

Someone has started a marco based approach: http://www.office-loesung.de/p/viewtopic.php?f=162&t=702408, not sure if one can build on that.

Regards
Daniel


(Ray Culp) #3

Hi Daniel,

Excellent! I'll have a look at it immediately!

Best regards

Ray


(jaumeortola) #4

Hi Ray,

I have made some tests with an add-in for Microsoft Word using a LanguageTool server, and I plan to resume this work during the month of December. If we share the same goal, we could work together.

The easy part for me is the use of the LanguageTool API, which I am familiar with.

The MS Word interface is not so easy for me. There are different options regarding how to show the errors, and I have not decided what to use. A dialog box seems easy to implement but it is less useful, I think. Underlined words plus context menu (which I have tried to do) is quite tricky to implement. Another option is to show the results in a side panel (like in the Chrome LanguageTool add-on).

Another challenge is what to do with long documents. It would be desirable to analyze the text dynamically someway so that the user can always see the current page analyzed with LT without a long wait. But probably this is beyond the scope of a first version.

I will post my code on GitHub. Any idea or any contribution is welcomed.

Best regards,
Jaume


(Ray Culp) #5

Dear Jaume,

Sounds good! I'm going to be busy until around the end of next week, but I'll get back to you!

Best regards

Ray


(Ray Culp) #6

Dear Jaume,

I read up on the CGAPI mentioned at http://wiki.languagetool.org/missing-features (as well as the CSAPI), and I think I understand now why using this API is difficult. Microsoft isn't being very generous with information on it.

Nevertheless, it seems to be the only way to implement a spelling / grammar checker in Office that will underline the words and phrases in a document as you type.

Have you already tried to apply for the SDK from Microsoft? If not, do you think we should give it a try?

I am looking at alternatives and may have something to post a little later.

Best regards

Ray


(Daniel Naber) #7

Maybe you could also check how this extension integrated itself into MS Word:

https://store.office.com/proofread-bot-WA104379771.aspx?assetid=WA104379771&sourcecorrid=09aba2fc-0d64-4aff-9e36-b2952ba6e258&searchapppos=0


(Ray Culp) #8

Hi Daniel,

Thanks for the information.

I followed the link, signed in and tried to download the app, but I'm not using Office Live, 365 or 2016, so I'm going to have trouble getting / evaluating it. I read that Office has a new Javascript API, so that does indeed sound interesting.

Are you familiar with this addon? Is this a competitor to LT?

I was doing some searches today also, and I found the following two projects on Code Project:

http://www.codeproject.com/Articles/8775/Syntax-colorizing-with-Speller-engine-using-TOM-an

http://www.codeproject.com/Articles/1140/Using-the-Microsoft-Common-Spell-API

They're both pretty old, but may provide some insight into how the API works.

Regards

Ray


(Daniel Naber) #9

It's from a competitor, but I'm not familiar with the add-on.


(jaumeortola) #10

Hi,

I have tried to write an add-in for Ms Word 2010 using VSTO (Visual Studio Tools for Office) in C#. This add-in could be used in several versions of Ms Word: 2007-2013.

Here you can see some of my code:
https://github.com/jaumeortola/languagetool-msword10-addin

This is not working yet. I'm able to underline words with different colors using the LanguageTool results, but the dropdown menu with suggested replacements is not implemented. It's too difficult for me, and I'm giving up for now.

I would like to implement something like a dialog box or a pane, which seems easier. There is a lot of information about this in the web. Perhaps too much information. A working example would be the best help.

Regards,
Jaume


(Ray Culp) #11

Hi Jaume,

Thank you very much for posting your code.

I'm afraid my work schedule just got a lot fuller, so I probably won't be able to work on the addon until sometime in January.

You mentioned that this is 'some of your code'. There is more to it?

Best regards

Ray