A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
document.body.load("text") is throwing the exception:
{
"code": "NotAllowed",
"message": "Não há suporte para a ação Word em um navegador. Verifique OfficeExtension.Error.debugInfo para obter mais informações.",
"errorLocation": "DocumentCreated.body",
"statement": "var body = v.body;",
"surroundingStatements": [
"var v = context.root._getObjectByReferenceId(\"{d6b1f8db-d91f-4904-8a3a-bc9a1953e855}{7}\");",
"// >>>>>",
"var body = v.body;",
"// <<<<<",
"// Instantiate {body}",
"body.load([\"text\"]);"
],
"fullStatements": [
"Please enable config.extendedErrorLogging to see full statements."
]
}
Steps to reproduce
Execute the following script:
await Word.run(async (context) => {
console.log("Opening formatted text in new window");
const newDocument = context.application.createDocument();
await context.sync();
const newDocumentBody = newDocument.body;
newDocumentBody.load("text");
await context.sync();
});
Link to live example(s)
Tried to create the live example, but it failed to add the extension.
Provide additional details
No extra steps
Context
I was trying to create a new document for the user.
Provide required information needed to triage your issue
Your Environment
Expected behavior
Create a new document and write to it content as described in the docs: https://learn.microsoft.com/pt-br/javascript/api/word/word.application?view=word-js-preview
Current behavior
document.body.load("text")
is throwing the exception:Steps to reproduce
Execute the following script:
Link to live example(s)
Tried to create the live example, but it failed to add the extension.
Provide additional details
No extra steps
Context
I was trying to create a new document for the user.
Useful logs
The logs are in the current behavior section