在 Excel 2016 中找不到 Office JavaScript DialogApi

Office JavaScript DialogApi not found in Excel 2016

我正在尝试在 Excel 中使用 Office JavaScript DialogApi 1.1。根据文档,它看起来应该适用于我的版本,但似乎没有安装。

要求集表示不受支持,对象Office.context.ui在运行时未定义。

我是不是遗漏了什么,或者我的 Excel 版本不支持这个?

版本:
Windows10
微软 Excel 2016 MSO (16.0.4849.1000) 32 位

taskpane.js

Office.onReady(info => {
  if (!Office.context.requirements.isSetSupported("DialogApi", 1.1)) {
    // I end up here and Office.context.ui === undefined    
    console.log('DialogApi is not supported.')
  }
});

taskpane.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Contoso Task Pane Add-in</title>

    <!-- Office JavaScript API -->
    <script
      type="text/javascript"
      src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"
    ></script>
  </head>

  <body>
  </body>
</html>

manifest.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
  <Id>99999999-9999-9999-9999-999999999999</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Contoso</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="office-addon"/>
  <Description DefaultValue="A template to get started."/>
  <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
  <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-80.png"/>
  <SupportUrl DefaultValue="https://www.contoso.com/help"/>
  <AppDomains>
    <AppDomain>https://localhost:3000</AppDomain>
  </AppDomains>
  <Hosts>
    <Host Name="Workbook"/>
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
  </DefaultSettings>
  <Permissions>ReadWriteDocument</Permissions>
</OfficeApp>

你能不能试试用IE/Edge打开这个linkhttps://appsforoffice.microsoft.com/lib/1/hosted/excel-win32-16.01.js然后贴回版本如下: /* * @overview es6-promise - Promises/A+ 的一个微小实现。 * @copyright 版权所有 (c) 2014 Yehuda Katz、Tom Dale、Stefan Penner 和贡献者(由 Jake Archibald 转换为 ES6 API) * @license 根据麻省理工学院许可获得许可 * 见 https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE * @version 2.3.0 */

我们想知道是否有一些本地缓存导致未获取最新版本。

Microsoft 工程师认为可能发生的情况是 Office 用于在 UI 中报告其版本的 DLL 在您的计算机上已更新,但其他本应同时更新的 DLL时间不是。如果用户选择应用安全更新而不是其他更新,就会发生这种情况。通过 Microsoft Update 应用 Office 更新时,所有 Office DLL 都应自动更新。在手动应用更新的情况下,某些 Office DLL 可能不包含在更新中。您需要应用 osfclient-x-none MSP 补丁并验证 osf.dll 至少是版本 16.0.4390.1000.

要单独应用更新,this page 列出了最新的 Office 2016 更新文件。查找 osfclient-x-none 更新。