Probably many of us use some of the add-in on Microsoft Word. Add-in is like a plugin, which opens as taskpane within Microsoft Word and gives options of custom services or jobs, like selection of text like simple action to complex web API driven text analysis. Here is how to create Microsoft Word Add-in to get own custom functions and services in to Word. MS Word Add-in uses HTML, CSS and Js for Add-in. Previously, we published a short guide on Example of Using IBM Watson For Text Analysis with Google Docs, which used Apps Script. Apps Script is easy and far less featured than MS Word Add-in. However, developing Microsoft Word Add-in requires to get used with Word JavaScript API. In this guide, we will provide only the basic steps to get started. Microsoft has enough example sample Add-in to understand how to develop. Office Add-ins platform is quite interesting :
1 | https://docs.microsoft.com/en-us/office/dev/add-ins/overview/office-add-ins |
Steps to Create Microsoft Word Add-in
We need to have Microsoft Visual Studio 2019 (community edition) installed. Within Visual Studio, install the Office/SharePoint development workload. Now, within the Visual Studio menu bar, go to File > New > Project.
Type SharePoint in the search and you will find Word Web Add-in as the project type. Click select and proceed to next step. Name the project, and then choose OK. You will select Web application project as type. Visual Studio creates a solution that contains two projects. Visual Studio creates a solution and its two projects appear in Solution Explorer.
Microsoft does have own guide for this development :
---
1 | https://docs.microsoft.com/en-in/office/dev/add-ins/quickstarts/word-quickstart?tabs=visual-studio |
However, you’ll find that the new default “Word Add-In with Commands Sample” more nice to study along with the above text and basic sample. We have a home.html
file, a home.css
, a home.js
and finally a XML manifest file. The XML manifest file has least editing work.
The names of the files, such as home.html
, home.css
, home.js
quite meaningful – they are just like part of web application or web page development. The API reference of JavaScript API is most important :
1 | https://docs.microsoft.com/en-us/office/dev/add-ins/reference/overview/word-add-ins-reference-overview |
In order to test, simply click the Start
option (with play icon) within the Microsoft Visual Studio IDE (Start is located at top, middle). At end, the loaded add-in will open on Microsoft Word. We have marked the location of the Start
option in the above screenshot.