Excel 无法加载基本自定义函数加载项



首先,环境:

Excel 版本 1905(内部版本 11629.20246 即点即用( 已连接到 Office 365 专业增强版

视窗 10 企业版 10.0.16299 内部版本 16299

我一直在尝试在 Excel 中使用自定义函数 API,但它始终无法加载我的清单。我正在使用Visual Studio进行开发,以及它的处理端加载。

加载项似乎部分加载,因为任务窗格确实打开并加载,但我的自定义函数都没有注册。

我还从 https://github.com/OfficeDev/Excel-Custom-Functions-JS 运行了示例项目,它无法加载并出现类似的错误。

我的管理员已授予我访问外接程序存储的权限,认为这可能是问题的一部分,但它没有帮助。

我相信有一些 GPO 或设置禁用了自定义函数 API,但我不会找到有关此类设置的任何文档。我已经尽我所能来确认我提供的清单是有效的,但 Excel 仍然声称它无效。

Web 项目的基本结构如下:

C:.
│   Home.html
│   packages.config
│   WaveyWeb.csproj
│   WaveyWeb.csproj.user
│   Web.config
│   Web.Debug.config
│   Web.Release.config
│
├───dist
│       functions.html
│       functions.js
│       functions.json
│
└───Properties
AssemblyInfo.cs

我已经确认 Web 服务器正在预期位置提供页面。

这是我尝试加载的清单。Visual Studio不会抱怨它是无效的,它正在检查架构。如果我进行任何无效的更改,它确实会抱怨。

请注意,~remoteAppUrl在构建时被正确转换

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<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>515f3886-1c17-41be-8393-26b5acfd676a</Id>
<Version>1.0.0.0</Version>
<ProviderName>Adam</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Project Wavey" />
<Description DefaultValue="Its like excel, but with more waves"/>
<IconUrl DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<SupportUrl DefaultValue="http://www.contoso.com" />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>AppDomain1</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
<Hosts>
<Host Name="Workbook" />
</Hosts>
<Requirements>
<Sets DefaultMinVersion="1.1">
<Set Name="CustomFunctionsRuntime" MinVersion="1.1"/>
</Sets>
</Requirements>
<DefaultSettings>
<SourceLocation DefaultValue="~remoteAppUrl/Home.html" />
</DefaultSettings>
<!-- End TaskPane Mode integration.  -->
<Permissions>ReadWriteDocument</Permissions>
<!-- Begin Add-in Commands Mode integration. -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<AllFormFactors>
<ExtensionPoint xsi:type="CustomFunctions">
<Script>
<SourceLocation resid="CustomFunc.URL.JS"/>
</Script>
<Page>
<SourceLocation resid="CustomFunc.URL.HTML"/>
</Page>
<Metadata>
<SourceLocation resid="CustomFunc.URL.JSON"/>
</Metadata>
<Namespace resid="CustomFunc.Namespace"/>
</ExtensionPoint>
</AllFormFactors>
</Host>
</Hosts>
<!-- You can use resources across hosts and form factors. -->
<Resources>
<bt:Urls>
<bt:Url id="CustomFunc.URL.JS" DefaultValue="~remoteAppUrl/dist/functions.js"/>
<bt:Url id="CustomFunc.URL.HTML" DefaultValue="~remoteAppUrl/dist/functions.html"/>
<bt:Url id="CustomFunc.URL.JSON" DefaultValue="~remoteAppUrl/dist/functions.json"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="CustomFunc.Namespace" DefaultValue="WAVE" />
</bt:ShortStrings>
</Resources>
</VersionOverrides>
<!-- End Add-in Commands Mode integration. -->
</OfficeApp>

查看我的世界经济论坛日志:

9/18/2019 9:33:42   Medium  Web Add-In Runtime Logging Session Started          
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=52, CharPosition=14     
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=55, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=58, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=61, CharPosition=14      
9/18/2019 9:33:42   Monitorable Manifest    Extension point list has no supported extension points for this client      
9/18/2019 9:33:42   Monitorable Manifest    Issue encountered while parsing manifest, add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Error at element "VersionOverrides" : Manifest override with unsupported requirements or no supported extension points ignored: http://schemas.microsoft.com/office/taskpaneappversionoverrides, VersionOverridesV1_0, Line=78, CharPosition=5       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=52, CharPosition=14     
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=55, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=58, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=61, CharPosition=14      
9/18/2019 9:33:42   Monitorable Manifest    Extension point list has no supported extension points for this client      
9/18/2019 9:33:42   Monitorable Manifest    Issue encountered while parsing manifest, add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Error at element "VersionOverrides" : Manifest override with unsupported requirements or no supported extension points ignored: http://schemas.microsoft.com/office/taskpaneappversionoverrides, VersionOverridesV1_0, Line=78, CharPosition=5       
9/18/2019 9:34:43   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:43   Unexpected  Catalog Access to your add-ins trusted catalog has been denied. Select Insert > My Add-ins > Excel Options > Trust Center > Trust Center Settings > Trusted Add-in Catalogs to check your trusted catalogs.     
9/18/2019 9:34:43   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:47   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:47   Unexpected  Catalog Access to your add-ins trusted catalog has been denied. Select Insert > My Add-ins > Excel Options > Trust Center > Trust Center Settings > Trusted Add-in Catalogs to check your trusted catalogs.     

我认为我的问题发生在加载实际脚本之前,但为了完整起见,这里是文件的内容/dist/

函数.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title></title>
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/custom-functions-runtime.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>

函数.js

/**
* Adds two numbers.
* @customfunction 
* @param first First number.
* @param second Second number.
* @returns The sum of the two numbers.
*/
function add(first, second) {
return first + second;
}
CustomFunctions.associate("ADD", add);

functions.json

{
"functions": [
{
"id": "ADD",
"name": "ADD",
"description": "Add two numbers",
"helpUrl": "http://www.contoso.com/help",
"result": {
"type": "number",
"dimensionality": "scalar"
},
"parameters": [
{
"name": "first",
"description": "first number to add",
"type": "number",
"dimensionality": "scalar"
},
{
"name": "second",
"description": "second number to add",
"type": "number",
"dimensionality": "scalar"
}
]
}
]
}

运行 https://github.com/OfficeDev/Excel-Custom-Functions 中找到的 Excel 自定义函数示例项目时更新日志

9/19/2019 13:22:06  Medium  Web Add-In Runtime Logging Session Started          
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=35, CharPosition=14     
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=38, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=41, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=44, CharPosition=14      
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=35, CharPosition=14     
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=38, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=41, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=44, CharPosition=14      

我在日志中看到以下错误:

2019/9/18 9:34:43 意外清单对清单 XML 文件的访问被拒绝。请与此外接程序的管理员联系以获取帮助。
2019/9/18 9:34:43 意外目录 对加载项受信任目录的访问已被拒绝。选择">我的外接程序> Excel 选项">"信任中心">"信任中心设置">"受信任的外接程序目录"插入"以检查受信任的目录。

您可能需要按照以下步骤共享文件夹: 1. 打开 Excel->打开新工作簿 ->文件 ->选项 ->信任中心 -> 信任中心设置 -> 受信任的加载项目录 ->添加包含清单文件的文件夹的网络路径。然后按确定并选中右侧框 2.关闭Excel并再次打开它,

希望对您有所帮助。

最新更新