仅适用于 Word 桌面的 Office 加载项

Office add-in for Word desktop only

我正在开发 Word 加载项,我使用 Word online 仍不支持的内容控件编辑,我还使用 Word online 也不支持的 Binding.bindingDataChanged 事件。

如果没有使用这些功能的功能,加载项对用户来说根本没有用。我想将加载项提交到 Office 商店,但要使其仅在 Word 桌面版中可用。

为此,我尝试在清单 xml 文件中使用需求集规范。 我查看了需求集文档页面 https://dev.office.com/reference/add-ins/requirement-sets/office-add-in-requirement-sets,但找不到我应该使用的集。 Binding.bindingDataChanged 事件我认为应该属于 BindingEvents 要求集,但文档指出该集受 Word Online 支持。我也不知道如何使用需求集指定我需要内容控制编辑功能。

我尝试添加我在此处找到的 Word 桌面版 2016 所需的所有要求集 https://dev.office.com/add-in-availability 以便我的清单要求设置部分看起来像这样

<Requirements>
        <Sets DefaultMinVersion="1.1">
          <Set Name="BindingEvents"/>
          <Set Name="CompressedFile"/>
          <Set Name="CustomXmlParts"/>
          <Set Name="DocumentEvents"/>
          <Set Name="File"/>
          <Set Name="HtmlCoercion"/>
          <Set Name="ImageCoercion"/>
          <Set Name="OoxmlCoercion"/>
          <Set Name="TableBindings"/>
          <Set Name="TableCoercion"/>
          <Set Name="TextBindings"/>
          <Set Name="TextFile"/>
          <Set Name="Settings"/>
          <Set Name="TextCoercion"/>
          <Set Name="MatrixCoercion"/>
          <Set Name="MatrixBindings"/>
          <Set Name="WordApi" MinVersion="1.2"/>
        </Sets>
      </Requirements>

但是,当我通过将加载项添加到我的 Sharepoint 应用程序目录来测试它并尝试通过转到插入->Office 加载项从 Word 在线使用它时,它仍然显示在我的组织下,所以我'我可以单击它并将其加载到任务窗格中。 有没有办法使用清单文件中的要求集来防止加载项在 Word 在线版中可用,或者我应该使用运行时检查还是其他方式?

我将在 Set the Hosts element 引用文档声明 ...

"Note: The Name attribute specifies the Office host application that can run your add-in. Office hosts are supported on different platforms and run on desktops, web browsers, tablets, and mobile devices. You can't specify which platform can be used to run your add-in. For example, if you specify Mailbox, both Outlook and Outlook Web App can be used to run your add-in."

基本上它说你不能通过清单使 add-in 仅适用于桌面版本。您仍然可以选择在 运行 时间检查主机,如下所述:Use runtime checks in your JavaScript code. You may also look at Additions to Office.context.