Excel Addin 在安装时未加载任务窗格

发布于 2025-01-18 09:42:54 字数 4467 浏览 5 评论 0原文

当用户打开Excel文件时,我正在尝试打开Taskpane。我在下面解释了有关如何解决问题的详细信息。这在Excel桌面上工作正常,但在Excel Web中不正常。

我试图在打开Excel文件时打开Taskpane。我使用Open XML SDK创建了Excel文件,并将属性'Office.AutoShowTaskPanewithDocument'设置为TRUE,并将addin路径设置为我的本地共享驱动器。当我使用Excel桌面打开文件时,这可以正常工作。当我在Excel Web上尝试过同样的尝试时,它将无法使用。在开发人员控制台中,我发现以下错误。有人可以帮助我如何调试此问题,还是该addin的问题是什么?

“

subtest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>1234c63f-b860-4280-8280-3e4fb5ea7726</Id>
    <Version>1.0.0.0</Version>
    <ProviderName>Microsoft</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <DisplayName DefaultValue="test" />
    <Description DefaultValue="test" />
    <IconUrl DefaultValue="https://localhost:3000/manifestimages/appLogo_64px.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/manifestimages/appLogo_128px.png" />
    <SupportUrl DefaultValue="https://localhost:3000/help" />
    <AppDomains>
        <AppDomain>https://localhost:3000</AppDomain>
    </AppDomains>
    <Hosts>
        <Host Name="Workbook"></Host>
    </Hosts>
    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="SharedRuntime" MinVersion="1.1" />
        </Sets>
    </Requirements>
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/commands.html" />
    </DefaultSettings>
    <Permissions>ReadWriteDocument</Permissions>
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
        <Hosts>
            <Host xsi:type="Workbook">
                <Runtimes>
                    <Runtime resid="Taskpane.Url" lifetime="long" />
                    <Runtime resid="Commands.Url" lifetime="long" />
                </Runtimes>
                <DesktopFormFactor>
                    <FunctionFile resid="Commands.Url" />
                    <ExtensionPoint xsi:type="PrimaryCommandSurface">
                        <OfficeTab id="TabHome1">
                            <Group id="OfficeTab1.Group">
                                <Label resid="OfficeTab1.Group.Label" />
                                <Icon>
                                    <bt:Image size="16" resid="Refresh-16" />
                                    <bt:Image size="32" resid="Refresh-32" />
                                    <bt:Image size="80" resid="Refresh-80" />
                                </Icon>
                                <Control xsi:type="Button" id="InitSheet">
                                    <Label resid="InitSheet.Button.Label" />
                                    <Supertip>
                                        <Title resid="InitSheet.Button.Label" />
                                        <Description resid="InitSheet.Button.Tooltip" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="Refresh-16" />
                                        <bt:Image size="32" resid="Refresh-32" />
                                        <bt:Image size="80" resid="Refresh-80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
                                        <SourceLocation resid="Taskpane.Url" />
                                        <Title resid="FRE.Taskpane.Title" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>

I am trying to open taskpane when user opens excel file. I explained details below on how I approached the problem. This is working fine in excel desktop but not in excel web.

I was trying to open taskpane on opening the excel file. I created Excel file using open XML SDK and set property 'Office.AutoShowTaskpaneWithDocument' to true and also set the AddIn path to my local shared drive. When I open file with excel desktop, this works fine. When I tried the same on Excel web,it wont work. In developer console, I find the below error.Can someone help me how to debug this issue or what is the issue with this AddIn ?

Error in dev console

Manifest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>1234c63f-b860-4280-8280-3e4fb5ea7726</Id>
    <Version>1.0.0.0</Version>
    <ProviderName>Microsoft</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <DisplayName DefaultValue="test" />
    <Description DefaultValue="test" />
    <IconUrl DefaultValue="https://localhost:3000/manifestimages/appLogo_64px.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/manifestimages/appLogo_128px.png" />
    <SupportUrl DefaultValue="https://localhost:3000/help" />
    <AppDomains>
        <AppDomain>https://localhost:3000</AppDomain>
    </AppDomains>
    <Hosts>
        <Host Name="Workbook"></Host>
    </Hosts>
    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="SharedRuntime" MinVersion="1.1" />
        </Sets>
    </Requirements>
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/commands.html" />
    </DefaultSettings>
    <Permissions>ReadWriteDocument</Permissions>
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
        <Hosts>
            <Host xsi:type="Workbook">
                <Runtimes>
                    <Runtime resid="Taskpane.Url" lifetime="long" />
                    <Runtime resid="Commands.Url" lifetime="long" />
                </Runtimes>
                <DesktopFormFactor>
                    <FunctionFile resid="Commands.Url" />
                    <ExtensionPoint xsi:type="PrimaryCommandSurface">
                        <OfficeTab id="TabHome1">
                            <Group id="OfficeTab1.Group">
                                <Label resid="OfficeTab1.Group.Label" />
                                <Icon>
                                    <bt:Image size="16" resid="Refresh-16" />
                                    <bt:Image size="32" resid="Refresh-32" />
                                    <bt:Image size="80" resid="Refresh-80" />
                                </Icon>
                                <Control xsi:type="Button" id="InitSheet">
                                    <Label resid="InitSheet.Button.Label" />
                                    <Supertip>
                                        <Title resid="InitSheet.Button.Label" />
                                        <Description resid="InitSheet.Button.Tooltip" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="Refresh-16" />
                                        <bt:Image size="32" resid="Refresh-32" />
                                        <bt:Image size="80" resid="Refresh-80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
                                        <SourceLocation resid="Taskpane.Url" />
                                        <Title resid="FRE.Taskpane.Title" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2025-01-25 09:42:54

此文档带有示例,如果您以前没有看到它,则可能有用: https://learn.microsoft.com/en-us/office/dev/add/add-indd-ins/develop/automately-open-a-a-task--abask--abask--abask--abask--abask--abask--abask--a-task--abask--abask--abask--abask--abask--abask--abask-abask--abask--a task--a-a-a-a-a-a-task--窗格 - 文档

确保您的代码包含:

Office.context.document.settings.set("Office.AutoShowTaskpaneWithDocument", true);
Office.context.document.settings.saveAsync();

为了更好地找到问题,请分享repro的代码剪辑。

This document with examples that may useful if you didn't see it before: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/automatically-open-a-task-pane-with-a-document.

Ensure your code contains:

Office.context.document.settings.set("Office.AutoShowTaskpaneWithDocument", true);
Office.context.document.settings.saveAsync();

To better locate your issue, please share a code snip for repro.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文