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
686 stars 95 forks source link

Excel Add-in online - function wizard function arguments broken #4419

Open stefandrissen opened 6 months ago

stefandrissen commented 6 months ago

I have just started trying to create my own Excel Add-in with custom functions.

When using local Excel on Windows 10, the functions work fine. When using Excel Online, the function wizard is broken and only shows the first argument twice (with a sequence number).

Can be reproduced by uploading the sample manifest.xml as referenced by https://learn.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-overview with function GETKEYVALUEFORKEYCF which contains one key parameter:

https://github.com/OfficeDev/Office-Add-in-samples/blob/15b0646aa3eed1097071fe8fc44426e949a20f73/Samples/excel-shared-runtime-global-state/src/functions/functions.json#L7-L13

But is shown as:

image

The manifest.xml generated by Yeoman is also odd in that the function URLs have an additional /public folder:

      <bt:Urls>
        <bt:Url id="Functions.Script.Url" DefaultValue="http://localhost:3000/public/functions.js"/>
        <bt:Url id="Functions.Metadata.Url" DefaultValue="http://localhost:3000/public/functions.json"/>
        <bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="http://go.microsoft.com/fwlink/?LinkId=276812"/>
        <bt:Url id="Taskpane.Url" DefaultValue="http://localhost:3000/taskpane.html"/>
      </bt:Urls>

Somehow this works fine when run on a local Excel installation, but fails when using the dist package (404 on public/functions.json) - the custom functions do not show. Removing public from the urls above does not result in the functions being listed, copying the functions.json to the public folder does.

akrantz commented 6 months ago

With shared runtime, there should be no need to have these url get files from /public. When dev server is running, it should serve these files up from what is generated in memory -- they won't be on disk -- so go to https://localhost:3000/functions.json (or .html or .js) in the browser and see if they are served up there.

@davidchesnut Could you please look into this?

davidchesnut commented 6 months ago

Hi @stefandrissen, thanks for reporting this issue. I can repro this with a new yo office project, so looks like a product bug. I'll move this to the office-js repo where we track product bugs. Thanks!

davidchesnut commented 6 months ago

@adrianwu8516 this looks like a bug, can you please take a look? Thanks!

stefandrissen commented 6 months ago

The broken dialog seems to be the same issue as #3916

lucadom commented 2 months ago

Same problem here. Any updates about this issue?