Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new document is not working #5005

Open
geovannimp opened this issue Oct 25, 2024 · 1 comment
Open

Create new document is not working #5005

geovannimp opened this issue Oct 25, 2024 · 1 comment
Assignees
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback

Comments

@geovannimp
Copy link

Provide required information needed to triage your issue

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: Word
  • Office version number: Web
  • Operating System: Linux
  • Browser (if using Office on the web): Chrome

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:

{
    "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.

Useful logs

The logs are in the current behavior section

@microsoft-github-policy-service microsoft-github-policy-service bot added the Area: Word Issue related to Word add-ins label Oct 25, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Oct 25, 2024
Copy link
Contributor

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback
Projects
None yet
Development

No branches or pull requests

2 participants