Office 通用 API 要求集

要求集是指各组已命名的 API 成员。 Office 加载项使用清单中指定的要求集或执行运行时检查,以确定 Office 应用程序是否支持加载项所需的 API。 有关详细信息,请参阅 Office 版本和要求集。

提示

正在寻找 特定于应用程序的 API 要求集? 请参阅以下 API 要求集。

通用 API 要求集

以下部分列出了常见的 API 要求集、每个集中的方法以及支持该要求集的 Office 客户端应用程序。 除非另行指定,否则这些 API 要求集都是第 1.1 版。

提示

需要有关 Office 应用程序和版本支持加载项和要求集的位置的信息? 请参阅 Office 加载项的 Office 客户端应用程序和平台可用性。

ActiveView

最低 Office 应用程序支持 集内的方法
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Document.getActiveViewAsync

AddInCommands

请参阅加载项命令要求集。


BindingEvents

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Binding.addHandlerAsync
  • Binding.removeHandlerAsync

CompressedFile

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持使用 Document.getFileAsync 方法时输出作为字节数组 (Office.FileType.Compressed) 的 Office Open XML (OOXML) 格式
。

ContextMenuApi

最低 Office 应用程序支持 集内的方法
请参阅 上下文菜单 API 要求集。
  • Office.contextMenu.requestUpdate

CustomXmlParts

最低 Office 应用程序支持 集内的方法
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • CustomXmlNode.getNodesAsync
  • CustomXmlNode.getNodeValueAsync
  • CustomXmlNode.getTextAsync
  • CustomXmlNode.getXmlAsync
  • CustomXmlNode.setNodeValueAsync
  • CustomXmlNode.setTextAsync
  • CustomXmlNode.setXmlAsync
  • CustomXmlPart.addHandlerAsync
  • CustomXmlPart.deleteAsync
  • CustomXmlPart.getNodesAsync
  • CustomXmlPart.getXmlAsync
  • CustomXmlPart.removeHandlerAsync
  • CustomXmlParts.addAsync
  • CustomXmlParts.getByIdAsync
  • CustomXmlParts.getByNamespaceAsync
  • CustomXmlPrefixMappings.addNamespaceAsync
  • CustomXmlPrefixMappings.getNamespaceAsync
  • CustomXmlPrefixMappings.getPrefixAsync

DevicePermissionService

最低 Office 应用程序支持 集内的方法
请参阅 设备权限服务要求集。
  • DevicePermission.requestPermissions
  • DevicePermission.requestPermissionsAsync

DialogApi

最低 Office 应用程序支持 集内的方法
请参阅 Dialog API 要求集。
  • UI.messageParent
  • UI.displayDialogAsync
  • UI.closeContainer
  • UI.Dialog

DialogOrigin

最低 Office 应用程序支持 集内的方法
请参阅 对话框来源要求集。 跨域支持:
  • UI.messageParent
  • UI。Dialog.messageChild

DocumentEvents

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • OneNote 网页版
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Document.addHandlerAsync
  • Document.removeHandlerAsync

文件

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Document.getFileAsync
  • File.closeAsync
  • File.getSliceAsync

HtmlCoercion

最低 Office 应用程序支持 集内的方法
  • OneNote 网页版
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getSelectedDataAsync、Document.setSelectedDataAsync、Binding.getDataAsync 或 Binding.setDataAsync 方法读取和写入数据时强制转换为 HTML (Office.CoercionType.Html)。

IdentityAPI

最低 Office 应用程序支持 集内的方法
请参阅 Identity API 要求集。
  • Auth.getAccessToken

ImageCoercion

最低 Office 应用程序支持 集内的方法
请参阅图像强制要求集。
  • Document.setSelectedDataAsync

键盘快捷方式

最低 Office 应用程序支持 集内的方法
请参阅 键盘快捷方式要求集。
  • Office.actions.areShortcutsInUse
  • Office.actions.getShortcuts
  • office.actions.replaceShortcuts

邮箱

最低 Office 应用程序支持 集内的方法
  • Outlook 网页版
  • Windows 版新 Outlook
  • Windows 上的经典 Outlook
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Android 版 Outlook
  • Mac 版 Outlook
  • iOS 版 Outlook
请参阅了解 Outlook API 要求集。

MatrixBindings

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Bindings.addFromNamedItemAsync
  • Bindings.addFromSelectionAsync
  • Bindings.getAllAsync
  • Bindings.getByIdAsync
  • Bindings.releaseByIdAsync
  • Binding.getDataAsync
  • Binding.setDataAsync

MatrixCoercion

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getSelectedDataAsync、Document.setSelectedDataAsync、Binding.getDataAsync 或 Binding.setDataAsync 方法读取和写入数据时强制转换为“矩阵”(数组的数组)数据结构 (Office.CoercionType.Matrix)。

NestedAppAuth

最低 Office 应用程序支持 集内的方法
请参阅 嵌套应用身份验证要求集。
  • Office.auth.getAuthContext

OoxmlCoercion

最低 Office 应用程序支持 集内的方法
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getSelectedDataAsync、Document.setSelectedDataAsync、Binding.getDataAsync 或 Binding.setDataAsync 方法读取和写入数据时强制转换为 Open Office XML (OOXML) 格式 (Office.CoercionType.Ooxml)。

OpenBrowserWindowApi

最低 Office 应用程序支持 集内的方法
请参阅 打开浏览器窗口 API 要求集。
  • Office.context.ui.openBrowserWindow

PdfFile

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getFileAsync 方法时输出 PDF 格式 (Office.FileType.Pdf)。

RibbonApi

最低 Office 应用程序支持 集内的方法
请参阅 功能区 API 要求集。
  • Office.ribbon.requestUpdate

选择

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Windows 版 Project
    • 批量许可的永久 Office 2016
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Document.getSelectedDataAsync
  • Document.setSelectedDataAsync

Settings

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • OneNote 网页版
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Settings.get
  • Settings.remove
  • Settings.saveAsync
  • Settings.set

SharedRuntime

最低 Office 应用程序支持 集内的方法
请参阅 共享运行时要求集。
  • Office.addin.getStartupBehavior
  • Office.addin.hide
  • Office.addin.onVisibilityModeChanged
  • Office.addin.setStartupBehavior
  • Office.addin.showAsTaskpane
  • Office.BeforeDocumentCloseNotification.disable
  • Office.BeforeDocumentCloseNotification.enable
  • Office.BeforeDocumentCloseNotification.onCloseActionCancelled

TableBindings

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Bindings.addFromNamedItemAsync
  • Bindings.addFromSelectionAsync
  • Bindings.getAllAsync
  • Bindings.getByIdAsync
  • Bindings.releaseByIdAsync
  • Binding.addColumnsAsync
  • Binding.addRowsAsync
  • Binding.deleteAllDataValuesAsync
  • Binding.getDataAsync
  • Binding.setDataAsync

TableCoercion

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getSelectedDataAsync、Document.setSelectedDataAsync、Binding.getDataAsync 或 Binding.setDataAsync 方法读取和写入数据时强制转换为“表格”数据结构 (Office.CoercionType.Table)。

TaskPaneApi

最低 Office 应用程序支持 集内的方法
请参阅 任务窗格 API 要求集。
  • TaskPane.setWidth

TextBindings

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
  • Bindings.addFromNamedItemAsync
  • Bindings.addFromSelectionAsync
  • Bindings.getAllAsync
  • Bindings.getByIdAsync
  • Bindings.releaseByIdAsync
  • Binding.getDataAsync
  • Binding.setDataAsync

TextCoercion

最低 Office 应用程序支持 集内的方法
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • iPad 版 Excel
  • OneNote 网页版
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Windows 版 Project
    • 批量许可的永久 Office 2016
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getSelectedDataAsync、Document.setSelectedDataAsync、Binding.getDataAsync 或 Binding.setDataAsync 方法读取和写入数据时强制转换为文本格式 (Office.CoercionType.Text)。

TextFile

最低 Office 应用程序支持 集内的方法
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
支持在使用 Document.getFileAsync 方法时输出文本格式 (Office.FileType.Text)。

不作为要求集一部分的方法

Office JavaScript API 中的以下方法不属于要求集。 如果您的加载项需要这些方法中的任何一种,请使用<加载项清单中的 Methods 和 Method> 元素声明它们是必需的,或者使用语句执行if运行时检查。>< 有关详细信息,请参阅 指定 Office 应用程序和 API 要求。

方法名称 最低 Office 应用程序支持
Bindings.addFromPromptAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
Document.getFilePropertiesAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
Document.getProjectFieldAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getResourceFieldAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getSelectedResourceAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getSelectedTaskAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getSelectedViewAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getTaskAsync
  • Project Standard 2016
  • Project Professional 2016
Document.getTaskFieldAsync
  • Project Standard 2016
  • Project Professional 2016
Document.goToByIdAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 PowerPoint
  • iPad 版 PowerPoint
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Word
  • iPad 版 Word
Settings.addHandlerAsync
  • Excel 网页版
Settings.refreshAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • PowerPoint 网页版
  • Windows 版 PowerPoint
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Word 网页版
  • Windows 版 Word
    • Microsoft 365 订阅
    • 永久 Office 2016
Settings.removeHandlerAsync
  • Excel 网页版
TableBinding.clearFormatsAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
TableBinding.setFormatsAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel
TableBinding.setTableOptionsAsync
  • Excel 网页版
  • Windows 版 Excel
    • Microsoft 365 订阅
    • 永久 Office 2016
  • Mac 版 Excel
  • iPad 版 Excel

另请参阅