Office.CoercionType enum
指定如何强制由调用方法返回或设置的数据。
注解
以下要求集说明中指定了每个项目 CoercionType 的应用程序和平台支持。
HtmlCoercion,使用
Office.CoercionType.Html) 时 (使用
Office.CoercionType.Image) 时 (ImageCoercion 1.1使用
Office.CoercionType.Matrix) 时的 MatrixCoercion (使用
Office.CoercionType.Ooxml) 时的 OoxmlCoercion (使用
Office.CoercionType.Table) 时的 TableCoercion (使用
Office.CoercionType.Text) 时的 TextCoercion (使用
Office.CoercionType.XmlSvg) 时的 ImageCoercion 1.2 (
使用方
- Office.AppointmentCompose: getSelectedDataAsync
- Office.Body: getAsync, getTypeAsync
- Office.CoercionTypeOptions: coercionType
- Office.DecryptedMessageBody: coercionType
- Office.Document: getSelectedDataAsync
- Office.GetBindingDataOptions: coercionType
- Office.MessageCompose: getSelectedDataAsync
- Office.SetBindingDataOptions: coercionType
- Office.SetSelectedDataOptions: coercionType
示例
// This function displays the currently selected text in the console.
// It uses the Common APIs.
function run() {
Office.context.document.getSelectedDataAsync(Office.CoercionType.Text, (asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.error(asyncResult.error.message);
} else {
console.log(`The selected data is "${asyncResult.value}".`);
}
});
}