createDocument() from base64 or url result in RichApi.Error: GeneralException

AG 1 Reputation point
2022-04-12T17:30:23.623+00:00

I am trying to open an existing document from within a Word add-in. I tried:
var newDoc = context.application.createDocument(base64Image)
newDoc.open()
context.sync()
but I'm am getting an error: Uncaught (in promise) RichApi.Error: GeneralException.
When I don't pass in an argument into createDocument(), it successfully opens a blank document.

I've placed the base64Image into the current document using insertFileFromBase64 and insertInlinePictureFromBase64, so I know the base64Image file is supported.

Any other ideas?

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,007 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
939 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.