OfficeDev / office-js

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.
https://learn.microsoft.com/javascript/api/overview
Other
687 stars 94 forks source link

Cannot select slide in PowerPoint when notes section is selected (desktop version) #3552

Open mscc-sascha opened 1 year ago

mscc-sascha commented 1 year ago

When developing an Office AddIn for PowerPoint (using OfficeJS) I cannot use any PowerPoint API when the notes section is selected. In my scenario I want to select a certain slide by using context.presentation.setSelectedSlides([slide.id]);, the execution crashes with the following error message:

image

In PowerPoint Online (web version) everything works as expected, the error is only thrown when using the desktop version (for Mac and Windows)

Provide required information needed to triage your issue

Your Environment

Expected behavior

Selecting a slide by providing the slide-id should select the slide instead of throwing an error message when the notes section is selected.

Current behavior

Error is thrown: image

Steps to reproduce

  1. Create an Office AddIn for PowerPoint using OfficeJS
  2. Implement a button which selects a certain slide by providing the slide id (context.presentation.setSelectedSlides([slide.id]);)
  3. Click on the notes section in PowerPoint image
  4. Press the button in the AddIn

Context

Currently the error crashes our integration into PowerPoint when the user has not actively selected any slide content.

ZYUN-MSFT commented 1 year ago

Hi @mscc-sascha ,

Can you please share your repro code by the public gist? image

Thanks.

mscc-sascha commented 1 year ago

Hi @ZYUN-MSFT You can simply use the sample 'Get, set, load, and save slides' from the ScriptLab. I have uploaded the sample: "https://gist.github.com/mscc-sascha/91c194da4e9c83eb69dde6e234f9f188

Steps to reproduce:

  1. Create sample slides in PowerPoint (for Desktop)
  2. Select some slides and press 'Save selected slides' in ScriptLab
  3. Select the Notes-Section in PowerPoint
  4. Press 'Load the saved slide selection' in ScriptLab

An error will be thrown:

[ERROR]: Error:
{
    "stack": "RichApi.Error: GeneralException\n    at new n (https://appsforoffice.microsoft.com/lib/1/hosted/powerpoint-win32-16.01.js:26:244272)\n    at i.processRequestExecutorResponseMessage (https://appsforoffice.microsoft.com/lib/1/hosted/powerpoint-win32-16.01.js:26:308888)\n    at https://appsforoffice.microsoft.com/lib/1/hosted/powerpoint-win32-16.01.js:26:306950",
    "message": "GeneralException",
    "name": "RichApi.Error",
    "code": "GeneralException",
    "traceMessages": [],
    "innerError": null,
    "debugInfo": {
        "code": "GeneralException",
        "message": "GeneralException",
        "errorLocation": "Presentation.setSelectedSlides",
        "statement": "root.setSelectedSlides(...);",
        "surroundingStatements": [
            "var root = context.root;",
            "// >>>>>",
            "root.setSelectedSlides(...);",
            "// <<<<<"
        ],
        "fullStatements": [
            "Please enable config.extendedErrorLogging to see full statements."
        ]
    },
    "httpStatusCode": 500
}

This error only occours in PowerPoint for Desktop, in PPT Online everything works as expected!

Thanks!

ZYUN-MSFT commented 1 year ago

Hi @mscc-sascha ,

We are still investigating this issue with engineer team. I will back to this thread once I get update.

Thanks.

ZYUN-MSFT commented 1 year ago

Hi @mscc-sascha ,

We have created an internal bug 8196867 for this issue. Once we got fixed we will update this thread.

Thanks.