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

network sideload fails but npm run start sideload works #5215

Open
3 tasks
duane-j-wagner opened this issue Dec 20, 2024 · 14 comments
Open
3 tasks

network sideload fails but npm run start sideload works #5215

duane-j-wagner opened this issue Dec 20, 2024 · 14 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Possible-Solution Similar-Issue Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown

Comments

@duane-j-wagner
Copy link

duane-j-wagner commented Dec 20, 2024

Provide required information needed to triage your issue

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC and Web
  • Host [Excel, Word, PowerPoint, etc.]: Excel
  • Office version number: ___Microsoft® Excel® for Microsoft 365 MSO (Version 2410 Build 16.0.18129.20200) 64-bit ___
  • Operating System: Windows 11 Enterprise__
  • Browser (if using Office on the web): Edge

Expected behavior

The add in should be initialized on install, causing the custom contextual tab and the task pane to show.

Current behavior

The add-in does nothing on a network share install on a PC, nor when uploaded on Web. The custom contextual tab remains hidden and the task pane does not show.
if the OverriddenByRibbonApi tag in the manifest is set to false, the add-in installs and initializes as expected.
The whole point of that tag is to hide the control that should only be shown when overriding the control is not supported, so setting to false leads to a poor user experience.
Mac side-loading works as expected. npm run start side-loading also works on PC.

Steps to reproduce

  1. On PC, follow instructions to side-load the manifest file
  2. Select the add-in in this Excel spreadsheet and push Add to install. (If the Add-in ribbon button is inactive {another MS bug for protected sheets}, make a new sheet tab and try again.)

Link to live example(s)




Provide additional details




Context

We need to side load in order for QA to test on PC and Web. Side-loading works on Mac.

Useful logs

  • Console errors
  • Screenshots
  • Test file (if only happens on a particular file)
    The onReady() method never gets called and there are no errors. Excel shows a status at the bottom of window that the add-in was installed successfully.

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Dec 20, 2024
@RuizhiSunMS RuizhiSunMS added Area: Excel Issue related to Excel add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Dec 23, 2024
@RuizhiSunMS RuizhiSunMS self-assigned this Dec 23, 2024
@RuizhiSunMS RuizhiSunMS added the Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown label Dec 24, 2024
@RuizhiSunMS
Copy link
Contributor

Mark it as #9642233 into our backlog

@RuizhiSunMS RuizhiSunMS added the Needs: author feedback Waiting for author (creator) of Issue to provide more info label Dec 26, 2024
@RuizhiSunMS
Copy link
Contributor

RuizhiSunMS commented Dec 26, 2024

Hi @duane-j-wagner, I consulted our expert and got such explanation.
Setting OverriddenByRibbonApi to true aims to hide some items when addin is running on versions supporting custom contextual tab. So in your case, thewhole ribbon tab's hide is as expected. If you want to make it visible all the time, then you shouldn't set OverriddenByRibbonApi or you should set it to false.
"So, the add-in developer should not set this element to true for Groups or controls that should be visible all the time." he said.
In practice, OverriddenByRibbonApi is usually used for sub-items. In your manifest, you set the main and only group item with OverriddenByRibbonApi, so that whole ribbon is hidden. Maybe it's better for you to set OverriddenByRibbonApi case by case.

@duane-j-wagner
Copy link
Author

Perhaps I didn't explain the problem well enough.

  • My add-in should hide the ribbon tab until the initialization code makes it visible.
  • This works as expected when side-loading on Mac.
  • (BUG) The initialization code is not called when side-loading on Windows or the web. There is no way to show the task pane.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 26, 2024
@RuizhiSunMS
Copy link
Contributor

@duane-j-wagner, based on you shared manifest file, your addin will not show. Everything is hidden, I don't get your point on "until the initialization code makes it visible". Do you mean you something would happen (or run) to make tab from invisible to visible?

@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 26, 2024
@duane-j-wagner
Copy link
Author

Yes. I followed the advice on MS learn to create a contextual tab
The code creates the tab and makes it visible on certain spreadsheets like the one in the link in the original post. I expect this code to be called when side-loaded on mac, windows, web or whatever.
Office.onReady( function to create tab and make visible)
BUG - onReady is not called when add-in was installed.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 26, 2024
@RuizhiSunMS
Copy link
Contributor

@duane-j-wagner, would you please share your 'onReady' code here? I can transfer it to the expert.

@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 27, 2024
@duane-j-wagner
Copy link
Author

duane-j-wagner commented Dec 27, 2024

The code can be inspected by installing the add-in in Excel with the manifest linked in the original post and using the web view dev tools.

const main = async () => {
  runOfficejsScript();
  const loaded = await officeScriptPromise;
  if (!loaded) {
    throw Error('Failed to load office script');
  }
  // History change needed to get office scripts working with new angular
  window.history.replaceState = (a, b, c) => {};
  window.history.pushState = (a, b, c) => {};
  const info = await Office.onReady();
  if (info.host !== Office.HostType.Excel) {
    return;
  }
  await platformBrowserDynamic().bootstrapModule(AppModule);
};

main() is in main.ts and is run by the angular framework. When using dev tools, filter the code on 'app/' to see the typescript and filter out the generated javascript and node module code.
Once angular is bootstrapped, the code creates the tab. The following is in add-in-initializer.ts

private static contextualTabConfig = {
    actions: [
      {
        id: 'NexusAction1',
        type: 'ShowTaskpane',
        title: 'Show Task Pane',
        taskpaneId: 'NexusTaskpane1',
      },
    ],
    tabs: [
      {
        id: 'NexusTab1',
        groups: [
          {
            id: 'NexusGroup1',
            label: 'Nexus Actions',
            icon: [
              {
                size: 16,
                sourceLocation: 'icon-16.png',
              },
              {
                size: 32,
                sourceLocation: 'icon-32.png',
              },
              {
                size: 80,
                sourceLocation: 'icon-80.png',
              },
            ],
            controls: [
              {
                type: 'Button',
                id: 'NexusButton1',
                actionId: 'NexusAction1',
                enabled: true,
                label: 'Show Task Pane',
                superTip: {
                  title: 'Show Task Pane',
                  description: 'Push to show the task pane next to sheet.',
                },
                icon: [
                  {
                    size: 16,
                    sourceLocation: 'icon-16.png',
                  },
                  {
                    size: 32,
                    sourceLocation: 'icon-32.png',
                  },
                  {
                    size: 80,
                    sourceLocation: 'icon-80.png',
                  },
                ],
              },
            ],
          },
        ],
        label: 'Nexus',
        visible: false,
      },
    ],
  };

  private static readonly hideTabConfig: Office.RibbonUpdaterData = {
    tabs: [
      {
        id: AddInInitializer.contextualTabConfig.tabs[0].id,
        visible: false,
      },
    ],
  };

  private static readonly showTabConfig: Office.RibbonUpdaterData = {
    tabs: [
      {
        id: AddInInitializer.contextualTabConfig.tabs[0].id,
        visible: true,
      },
    ],
  };
...
  async createRibbonTab() {
    if (!AddInInitializer.wasTabCreated && this.isRibbonSupported) {
      try {
        if (!Office.context.requirements.isSetSupported('RibbonApi', '1.2')) {
          this.isRibbonSupported = false;
          this.logService.warn(
            'Nexus Excel Add-in: RibbonApi 1.2 is not supported by this Excel.'
          );
          return;
        }
        this.initializeIconSourceLocations(
          this.restApiService.formAppUri(window.location.href)
        );
        await Office.ribbon.requestCreateControls(
          AddInInitializer.contextualTabConfig
        );
      } catch (createError: any) {
        if (createError.code == 'HostRestartNeeded') {
          this.statusLogService.error(
            'Nexus Add-in has been upgraded. Please save your work, ' +
              'close the Office application, and restart it.'
          );
          await Office.addin.showAsTaskpane();
        }
        if (createError.code !== 'InvalidRibbonDefinition') {
          this.statusLogService.warn(createError);
          await Office.addin.showAsTaskpane();
        }
      }
      AddInInitializer.wasTabCreated = true;
      await Office.addin.showAsTaskpane();
    }
  }

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 27, 2024
@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 27, 2024
@RuizhiSunMS
Copy link
Contributor

Hi @duane-j-wagner, would you please confirm that which one is correct in your case:

  1. onReady is not executed
  2. the function called by onReady is not executed
  3. the function called by onReady did execute but work unexpectedly?

@duane-j-wagner
Copy link
Author

  1. onReady is not executed.
    If I set OverridenByRibbonApi to false, onReady is still not executed, but when I press the ribbon button, then onReady gets executed. I would expect onReady to be called when the add-in is installed or when the add-in calls Office.addin.setStartupBehavior(Office.StartupBehavior.load) and the workbook is opened again.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 30, 2024
@duane-j-wagner
Copy link
Author

If I try to debug the Office365 version of Excel, When I upload the manifest, I see the text from the manifest that my add-in installed successfully, but the tab was not added to the ribbon. In the Network tab of the Edge dev tools, I do not see any office.js loaded and the console has no useful errors.

@RuizhiSunMS
Copy link
Contributor

  1. onReady is not executed.
    If I set OverridenByRibbonApi to false, onReady is still not executed, but when I press the ribbon button, then onReady gets executed. I would expect onReady to be called when the add-in is installed or when the add-in calls Office.addin.setStartupBehavior(Office.StartupBehavior.load) and the workbook is opened again.

And onReady works as expected on mac? Does web on mac work unexpected here?

@duane-j-wagner
Copy link
Author

On mac using Google Chrome, I have the same result as on Windows with Edge.
Side-loading on mac with Excel App works as expected.

@RuizhiSunMS RuizhiSunMS removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label Dec 30, 2024
Copy link

Here are some similar issues that might help you. Please check if they can solve your problem.


Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Upon further inspection, we found that svg icons are not supported. When we replaced all the svg icons with png, the issue got resolved. You may close this.

Reference:

@duane-j-wagner
Copy link
Author

The bot is hallucinating. My manifest has only png icons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Possible-Solution Similar-Issue Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown
Projects
None yet
Development

No branches or pull requests

2 participants