I'm writing an add-in where the user will have the option to load different predefined templates.
I have these templates on my pc as docx files.
I know of the method body.insertFileAsBase64, but I cant get it to work!
function insertTemplate01() {
Word.run(function (context) {
var body = context.document.body;
body.clear();
body.insertText("rapport 1", "Start");
return context.sync();
});
}
So instead of inserting just a string, i want to load in a .docx file as a template.
I think i need a baby-step guide of how to do this.
I dont know how to convert my docx files to base64 and then use them to load into the current document.
Thanks a lot!