Addin word : Load header and footer from base64 file

CorGri 1 Reputation point
2021-04-15T16:12:54.183+00:00

Hi,

I have a .docx encoded in base64 and I try to put this document in a blank Word with my Word Adding tool.
(WordApi 1.3 / Angular 7)

I already tried to use
context.document.body.insertFileFromBase64(this.myFileBase64, Word.InsertLocation.replace);
But it doesn't include my header nor footer (of course, it's only loading the body).

Then I tried to get this header from another document using
context.document.sections.getFirst().getHeader("Primary");
but it doesn't work neither

The only way I find was to load my base64 file in a new Word instance, but it's closing my addin and erasing my settings

      let docWord:Word.DocumentCreated;
      docWord = app.createDocument(this.myFileBase64);
      docWord.open();

Can I load the entire Word file (header body footer) in a Word document?
Is there a way to load/reload my base64 file into a Word instance?

Thanks.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
1,950 questions
No comments
{count} votes