- An user starts Word with the add-in.
- The user presses a button in the add-in.
- The add-in call a services for the template.
- The add-in insert the template in the current Word file.
Steps, Create the project and setup API services to return a template:
- Create a Word add-in project base on the “App for Office”.
- Add a WebAPI webservice to the project.
Add a Web API Controller Class to the project. N.B.! remember to post-fixet the filename with Controller!
Edit the ApiController to return a base64 string.
This example read a docx file from a sub folder “Documetns” in the website that host the Add-in.
Add a Global.asax to the project to allow ApiController to be start and call.
Add the folder “Documents” file to the project and create a Word file named template1.docx. And the project structure and Word file shout look something like this.
Related blog posts
Read the first part here http://blog.andersdissing.com/2015/11/office-word-add-ins-insert-template-part1.html