Read the first part here http://blog.andersdissing.com/2015/11/office-word-add-ins-insert-template-part1.html
OpenXML Developer - http://openxmldeveloper.org/
Download - https://openxmlsdkjs.codeplex.com/
Steps, add OpenXmlSDK, retrieve and insert template:
- First we need to download and add the openxmlsdkjs to the project.
- Modify the Home.html, head html tag, to include the openxml.js and dependence.
- Modify the Home.html, body html tag, to include a button
- Modify the Home.js
- Bind the click event to a function
- Create the click event function
- Fill in the logic of the insertTemplate function
- Get template (base 64 string) from API service
- Create a openXml.OpenXmlPackage object
- Save the OpenXmlPackage to a FlacOpt object
- Use the build-in Word API to insert the FlacOpt object to the body of the Word file
- The test
- F5 to run the project
- Click the ‘insert template’ in the Add-in.
Related blog posts
Read the first part of the Office Word add-ins: Insert template base on Word here http://blog.andersdissing.com/2015/11/office-word-add-ins-insert-template-part1.html