Office.CoercionType enum
呼び出されたメソッドによって返される、または設定されるデータを強制的に変換する方法を指定します。
注釈
各 CoercionType のアプリケーションとプラットフォームのサポートは、次の要件セットの説明で指定されます。
HtmlCoercion、(
Office.CoercionType.Html使用時)ImageCoercion 1.1 (
Office.CoercionType.Image使用時)MatrixCoercion (
Office.CoercionType.Matrix使用時)OoxmlCoercion (
Office.CoercionType.Ooxml使用時)TableCoercion (
Office.CoercionType.Table使用時)TextCoercion (
Office.CoercionType.Text使用時)ImageCoercion 1.2 (
Office.CoercionType.XmlSvg使用時)
使用元
- 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}".`);
}
});
}
フィールド
| Html = "html" | データを HTML として取得または設定します。 注: Outlook 用 Word アドインおよび Outlook アドイン (作成モード) のデータにのみ適用されます。 |
| Image = "image" | データは返されるか、イメージ ストリームとして設定されます。 注: Excel、Word、PowerPoint のデータにのみ適用されます。 |
| Matrix = "matrix" | データをヘッダーなしの表形式データとして取得または設定します。 データは、1 次元の一連の文字を含む配列の配列として取得または設定されます。 たとえば、2 つの列にある 3 行の文字列値は、次のようになります: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]。 注: Excel と Word のデータにのみ適用されます。 |
| Ooxml = "ooxml" | データを Office Open XML として取得または設定します。 注: Word のデータにのみ適用されます。 |
| SlideRange = "slideRange" | 選択したスライドの ID、タイトル、インデックスの配列を含む JSON オブジェクトを返します。 たとえば、2 枚のスライドを選択する場合の 注: Document.getSelectedDataAsync メソッドを呼び出して現在のスライドまたは選択したスライド範囲を取得する場合にのみ、PowerPoint 内のデータに適用されます。 |
| Table = "table" | データをヘッダー付き (省略可能) の表形式データとして取得または設定します。 データをヘッダー付き (省略可能) の表形式データとして取得または設定します。 注: Excel と Word のデータにのみ適用されます。 |
| Text = "text" | データをテキスト (文字列) として返すか設定します。 データは、1 次元の一連の文字として取得または設定されます。 |
| XmlSvg = "xmlSvg" | データは、SVG 画像を含む XML データとして返されるか、または設定されます。 注: Excel、Word、PowerPoint のデータにのみ適用されます。 |