我是较新的 Office Web 插件,我使用 Visual Studio 2022 上的“Excel Web 插件”模板创建了我的第一个 Office Web 插件,并且我按照清单文件摘要教程尝试在“之后添加另一个按钮”显示任务窗格”按钮。我不知道为什么我的加载项在 Excel 准备就绪时崩溃,这是我的清单代码快照:
假设所有资源都存在
<ExtensionPoint xsi:type='PrimaryCommandSurface'>
<!-- 使用 OfficeTab 来扩展现有选项卡。使用 CustomTab 来创建新选项卡。 -->
<OfficeTab id='TabHome'>
<!-- 确保为组提供唯一 ID。建议 ID 为使用公司名的命名空间。 -->
<Group id='Contoso.Group1'>
<!-- 为组指定标签。resid 必须指向 ShortString 资源。 -->
<Label resid='Contoso.Group1Label' />
<!-- 图标。必需大小: 16、32、80,可选大小: 20、24、40、48、64。强烈建议为大 UX 提供所有大小。 -->
<!-- 使用 PNG 图标。资源部分中的所有 URL 必须使用 HTTPS。 -->
<Icon>
<bt:Image size='16' resid='Contoso.tpicon_16x16' />
<bt:Image size='32' resid='Contoso.tpicon_32x32' />
<bt:Image size='80' resid='Contoso.tpicon_80x80' />
</Icon>
<!-- 控件。可以为“按钮”类型或“菜单”类型。 -->
<Control xsi:type='Button' id='Contoso.TaskpaneButton'>
<Label resid='Contoso.TaskpaneButton.Label' />
<Supertip>
<!-- 工具提示标题。resid 必须指向 ShortString 资源。 -->
<Title resid='Contoso.TaskpaneButton.Label' />
<!-- 工具提示标题。resid 必须指向 LongString 资源。 -->
<Description resid='Contoso.TaskpaneButton.Tooltip' />
</Supertip>
<Icon>
<bt:Image size='16' resid='Contoso.tpicon_16x16' />
<bt:Image size='32' resid='Contoso.tpicon_32x32' />
<bt:Image size='80' resid='Contoso.tpicon_80x80' />
</Icon>
<!-- 这是触发命令时的操作(例如单击功能区)。支持的操作为 ExecuteFunction 或 ShowTaskpane。 -->
<Action xsi:type='ShowTaskpane'>
<TaskpaneId>ButtonId1</TaskpaneId>
<!-- 提供将显示在任务窗格上的位置的 URL 资源 ID。 -->
<SourceLocation resid='Contoso.Taskpane.Url' />
</Action>
</Control>
<!--My Button-->
<Control xsi:type='Button' id='DOGS.Button'>
<Label resid='DOGS.GROUP.ID.LABEL'/>
<Supertip>
<Title resid='DOGS.GROUP.ID.LABEL'/>
<Description resid='DOGS.GROUP.ID.LABEL'/>
</Supertip>
<Icon>
<bt:Image resid='Contoso.tpicon_32x32' size='32'/>
</Icon>
<Action xsi:type='ExecuteFunction'>
<FunctionName>helloworld</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
自动打开的任务窗格显示此错误:
预期的选项卡上没有出现任何内容。我该如何做才能正确添加选项卡或按钮?这与我的 Web 应用程序使用 Blazor Web 应用程序有什么关系吗?
我尝试过的:
Show TaskPane
复制为另一个按钮,只有这两个按钮存在,然后我的插件崩溃了为什么我无法添加 xml 代码快照..