【发布时间】:2019-07-04 13:27:00
【问题描述】:
我正在尝试在 Excel 中使用 Office JavaScript DialogApi 1.1。根据文档,它看起来应该适用于我的版本,但似乎没有安装。
需求集表明它不受支持,并且对象 Office.context.ui 在运行时未定义。
是我遗漏了什么,还是我的 Excel 版本不支持?
版本:
视窗 10
Microsoft 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>
【问题讨论】:
-
你的版本真的是10.0.4849.100还是16.0.4849.100?
-
感谢您发现错字。确实是 16.0.4849.1000 版本。
-
我正在内部寻求帮助。