Excel.PivotLayout class

ピボットテーブルのビジュアル レイアウトを表します。

Extends

注釈

[ API セット: ExcelApi 1.8 ]

プロパティ

altTextDescription

ピボットテーブルの代替テキストの説明。

代替テキストは、ピボットテーブルに含まれる情報の代替テキスト ベースの表現を提供します。 この情報は、視覚障碍や認知障碍のあるユーザーが、テーブルを表示または理解できない場合に役立ちます。 タイトルは、障害のある人に読み取ることができ、コンテンツの説明を聞きたいかどうかを判断するために使用されます。

altTextTitle

ピボットテーブルの代替テキスト タイトル。

代替テキストは、ピボットテーブルに含まれる情報の代替テキスト ベースの表現を提供します。 この情報は、視覚障碍や認知障碍のあるユーザーが、テーブルを表示または理解できない場合に役立ちます。 タイトルは、障害のある人に読み取ることができ、コンテンツの説明を聞きたいかどうかを判断するために使用されます。

autoFormat

更新時またはフィールドの移動時に書式を自動的に設定するかどうかを指定します。

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

emptyCellText

場合は、ピボットテーブル fillEmptyCells == true内の空のセルに自動的に入力されるテキスト。 が にfalse設定されている場合fillEmptyCells、この値は保持され、この値を設定してもそのプロパティは に設定されないことにtrue注意してください。 既定では、これは空の文字列です。

enableFieldList

フィールド リストを UI に表示できるかどうかを指定します。

fillEmptyCells

ピボットテーブルの空のセルに を設定するかどうかを指定します emptyCellText。 既定値は です false。 このプロパティが にfalse設定されている場合、のemptyCellText値は保持されることに注意してください。

layoutType

このプロパティは、ピボットテーブルのすべてのフィールドの PivotLayoutType を示します。 フィールドによって状態が異なる場合は null 値になります。

pivotStyle

ピボットテーブルに適用されるスタイル。

preserveFormatting

ピボット、並べ替え、ページ フィールド 項目の変更などの操作によってレポートを更新または再計算するときに、書式設定を保持するかどうかを指定します。

showColumnGrandTotals

ピボットテーブル レポートに列の総計を表示するかどうかを指定します。

showFieldHeaders

ピボットテーブルにフィールド ヘッダー (フィールド キャプションとフィルター ドロップダウン) を表示するかどうかを指定します。

showRowGrandTotals

ピボットテーブル レポートに行の総計を表示するかどうかを指定します。

subtotalLocation

このプロパティは、 SubtotalLocationType ピボットテーブルのすべてのフィールドの を示します。 フィールドの状態が異なる場合、これは になります null

メソッド

displayBlankLineAfterEachItem(display)

各項目の後に空白行を表示するかどうかを設定します。 これはピボットテーブルのグローバル レベルで設定され、個々の PivotFields に適用されます。 この関数は、ピボットテーブル内のすべてのフィールドの設定をパラメーターの display 値に上書きします。

getCell(dataHierarchy, rowItems, columnItems)

データ階層と、それぞれの階層の行および列の項目に基づいて、ピボットテーブル内の一意のセルを取得します。 返されるセルは、指定した階層のデータが含まれる、指定された行と列の交差部分です。 このメソッドは、呼び出し getPivotItems の逆であり、 getDataHierarchy 特定のセルに対してです。

getColumnLabelRange()

ピボットテーブルの列ラベルが存在する範囲を返します。

getDataBodyRange()

ピボットテーブルのデータ値が存在する範囲を返します。

getDataHierarchy(cell)

PivotTable 内で指定された範囲の値を計算するために使用される DataHierarchy を取得します。

getFilterAxisRange()

ピボットテーブルのフィルター エリアの範囲を返します。

getPivotItems(axis, cell)

PivotTable 内で指定された範囲の値を構成する PivotItems を軸から取得します。

getPivotItems(axisString, cell)

PivotTable 内で指定された範囲の値を構成する PivotItems を軸から取得します。

getRange()

フィルター エリアを除く、ピボットテーブルが存在する範囲を返します。

getRowLabelRange()

ピボットテーブルの行ラベルが存在する範囲を返します。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

repeatAllItemLabels(repeatLabels)

ピボットテーブルのすべてのフィールドに対して "すべての項目ラベルを繰り返す" 設定を設定します。

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

setAutoSortOnCell(cell, sortBy)

必要なすべての条件とコンテキストを自動的に選択するため、指定したセルを使用して自動的に並べ替えを実行するようピボットテーブルを設定します。 これは、UI から自動並べ替えを適用するのと同じ動作です。

setAutoSortOnCell(cell, sortByString)

必要なすべての条件とコンテキストを自動的に選択するため、指定したセルを使用して自動的に並べ替えを実行するようピボットテーブルを設定します。 これは、UI から自動並べ替えを適用するのと同じ動作です。

setStyle(style)

ピボットテーブルに適用されるスタイルを設定します。

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の Excel.PivotLayout オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として Excel.Interfaces.PivotLayoutData型指定) を返します。

プロパティの詳細

altTextDescription

ピボットテーブルの代替テキストの説明。

代替テキストは、ピボットテーブルに含まれる情報の代替テキスト ベースの表現を提供します。 この情報は、視覚障碍や認知障碍のあるユーザーが、テーブルを表示または理解できない場合に役立ちます。 タイトルは、障害のある人に読み取ることができ、コンテンツの説明を聞きたいかどうかを判断するために使用されます。

altTextDescription: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Set the alt text for the displayed PivotTable.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.altTextTitle = "Farm Sales PivotTable";
  pivotLayout.altTextDescription = "A summary of fruit sales. It is pivoted on farm name, and fruit type. The aggregated data is both the sums of crates sold at the farms and the sums of crates sold wholesale.";
  console.log("Adding alt text. Check the PivotTable settings to see the changes.");

  await context.sync();
});

altTextTitle

ピボットテーブルの代替テキスト タイトル。

代替テキストは、ピボットテーブルに含まれる情報の代替テキスト ベースの表現を提供します。 この情報は、視覚障碍や認知障碍のあるユーザーが、テーブルを表示または理解できない場合に役立ちます。 タイトルは、障害のある人に読み取ることができ、コンテンツの説明を聞きたいかどうかを判断するために使用されます。

altTextTitle: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.13 ]

autoFormat

更新時またはフィールドの移動時に書式を自動的に設定するかどうかを指定します。

autoFormat: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.9 ]

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

emptyCellText

場合は、ピボットテーブル fillEmptyCells == true内の空のセルに自動的に入力されるテキスト。 が にfalse設定されている場合fillEmptyCells、この値は保持され、この値を設定してもそのプロパティは に設定されないことにtrue注意してください。 既定では、これは空の文字列です。

emptyCellText: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Set a default value for an empty cell in the PivotTable. This doesn't include cells left blank by the layout.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.emptyCellText = "--";

  // Set the text alignment to match the rest of the PivotTable.
  pivotLayout.getDataBodyRange().format.horizontalAlignment = Excel.HorizontalAlignment.right;
  await context.sync();
});

enableFieldList

フィールド リストを UI に表示できるかどうかを指定します。

enableFieldList: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.10 ]

fillEmptyCells

ピボットテーブルの空のセルに を設定するかどうかを指定します emptyCellText。 既定値は です false。 このプロパティが にfalse設定されている場合、のemptyCellText値は保持されることに注意してください。

fillEmptyCells: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Toggle whether empty cells are filled with a default value.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.load("fillEmptyCells");
  await context.sync();

  let fillToSet = !pivotLayout.fillEmptyCells;
  console.log(`Filling empty cells? - ${fillToSet}`);

  pivotLayout.fillEmptyCells = fillToSet;
  await context.sync();
});

layoutType

このプロパティは、ピボットテーブルのすべてのフィールドの PivotLayoutType を示します。 フィールドによって状態が異なる場合は null 値になります。

layoutType: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline";

プロパティ値

Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"

注釈

[ API セット: ExcelApi 1.8 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Change the PivotLayout.type to a new type.
  const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
  pivotTable.layout.load("layoutType");
  await context.sync();

  // Cycle between the three layout types.
  if (pivotTable.layout.layoutType === "Compact") {
    pivotTable.layout.layoutType = "Outline";
  } else if (pivotTable.layout.layoutType === "Outline") {
    pivotTable.layout.layoutType = "Tabular";
  } else {
    pivotTable.layout.layoutType = "Compact";
  }

  await context.sync();
  console.log("Pivot layout is now " + pivotTable.layout.layoutType);
});

pivotStyle

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ピボットテーブルに適用されるスタイル。

readonly pivotStyle: Excel.PivotTableStyle;

プロパティ値

注釈

[ API セット: ExcelApi BETA (プレビューのみ) ]

preserveFormatting

ピボット、並べ替え、ページ フィールド 項目の変更などの操作によってレポートを更新または再計算するときに、書式設定を保持するかどうかを指定します。

preserveFormatting: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.9 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Set whether the PivotTable keeps the established format after it is refreshed and recalculated.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.load("preserveFormatting");
  await context.sync();

  let preserveFormattingToSet = !pivotLayout.preserveFormatting;
  console.log(`Preserve the formatting PivotTable after a refresh? - ${preserveFormattingToSet}`);

  pivotLayout.preserveFormatting = preserveFormattingToSet;
  await context.sync();
});

showColumnGrandTotals

ピボットテーブル レポートに列の総計を表示するかどうかを指定します。

showColumnGrandTotals: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.8 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Turn the grand totals on and off for the rows and columns.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.load(["showRowGrandTotals", "showColumnGrandTotals"]);
  await context.sync();

  let showColumnTotals = !pivotLayout.showColumnGrandTotals;
  let showRowTotals = !pivotLayout.showRowGrandTotals;
  console.log(`Show column grand totals? - ${showColumnTotals}`);
  console.log(`Show row grand totals? - ${showRowTotals}`);

  pivotLayout.showColumnGrandTotals = showColumnTotals;
  pivotLayout.showRowGrandTotals = showRowTotals;

  await context.sync();
});

showFieldHeaders

ピボットテーブルにフィールド ヘッダー (フィールド キャプションとフィルター ドロップダウン) を表示するかどうかを指定します。

showFieldHeaders: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Turn the field headers on and off for the row and column hierarchies.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;
  pivotLayout.load("showFieldHeaders");
  await context.sync();

  let showHeaders = !pivotLayout.showFieldHeaders;
  console.log(`Show field headers? - ${showHeaders}`);
  pivotLayout.showFieldHeaders = showHeaders;
  await context.sync();
});

showRowGrandTotals

ピボットテーブル レポートに行の総計を表示するかどうかを指定します。

showRowGrandTotals: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.8 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Turn the grand totals on and off for the rows and columns.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.load(["showRowGrandTotals", "showColumnGrandTotals"]);
  await context.sync();

  let showColumnTotals = !pivotLayout.showColumnGrandTotals;
  let showRowTotals = !pivotLayout.showRowGrandTotals;
  console.log(`Show column grand totals? - ${showColumnTotals}`);
  console.log(`Show row grand totals? - ${showRowTotals}`);

  pivotLayout.showColumnGrandTotals = showColumnTotals;
  pivotLayout.showRowGrandTotals = showRowTotals;

  await context.sync();
});

subtotalLocation

このプロパティは、 SubtotalLocationType ピボットテーブルのすべてのフィールドの を示します。 フィールドの状態が異なる場合、これは になります null

subtotalLocation: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off";

プロパティ値

Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"

注釈

[ API セット: ExcelApi 1.8 ]

メソッドの詳細

displayBlankLineAfterEachItem(display)

各項目の後に空白行を表示するかどうかを設定します。 これはピボットテーブルのグローバル レベルで設定され、個々の PivotFields に適用されます。 この関数は、ピボットテーブル内のすべてのフィールドの設定をパラメーターの display 値に上書きします。

displayBlankLineAfterEachItem(display: boolean): void;

パラメーター

display

boolean

True にすると、空白行の表示設定が有効になります。 False にするとオフになります。

戻り値

void

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Add a blank row after each PivotItem in the row hierarchy.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.displayBlankLineAfterEachItem(true);
  console.log("Setting `PivotLayout.displayBlankLineAfterEachItem` to true.");

  await context.sync();
});

getCell(dataHierarchy, rowItems, columnItems)

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

データ階層と、それぞれの階層の行および列の項目に基づいて、ピボットテーブル内の一意のセルを取得します。 返されるセルは、指定した階層のデータが含まれる、指定された行と列の交差部分です。 このメソッドは、呼び出し getPivotItems の逆であり、 getDataHierarchy 特定のセルに対してです。

getCell(dataHierarchy: DataPivotHierarchy | string, rowItems: Array<PivotItem | string>, columnItems: Array<PivotItem | string>): Excel.Range;

パラメーター

dataHierarchy

Excel.DataPivotHierarchy | string

dataHierarchy検索するデータ項目を提供する 。

rowItems

Array<Excel.PivotItem | string>

検索する値を構成する行軸の PivotItems。

columnItems

Array<Excel.PivotItem | string>

検索する値を構成する列軸の PivotItems。

戻り値

指定された値を含む 1 つのセルを指定する範囲。

注釈

[ API セット: ExcelApi BETA (プレビューのみ) ]

getColumnLabelRange()

ピボットテーブルの列ラベルが存在する範囲を返します。

getColumnLabelRange(): Excel.Range;

戻り値

注釈

[ API セット: ExcelApi 1.8 ]

getDataBodyRange()

ピボットテーブルのデータ値が存在する範囲を返します。

getDataBodyRange(): Excel.Range;

戻り値

注釈

[ API セット: ExcelApi 1.8 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-filters-and-summaries.yaml

await Excel.run(async (context) => {
    const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");

    // The layout controls the ranges used by the PivotTable.
    const range = pivotTable.layout.getDataBodyRange();

    // Get all the data hierarchy totals.
    const grandTotalRange = range.getLastRow();
    grandTotalRange.load("address");
    await context.sync();
    
    // Use the wholesale and farm sale totals to make a final sum.
    const masterTotalRange = context.workbook.worksheets.getActiveWorksheet().getRange("B27:C27");
    masterTotalRange.formulas = [["All Crates", "=SUM(" + grandTotalRange.address + ")"]];
    await context.sync();
});

getDataHierarchy(cell)

PivotTable 内で指定された範囲の値を計算するために使用される DataHierarchy を取得します。

getDataHierarchy(cell: Range | string): Excel.DataPivotHierarchy;

パラメーター

cell

Excel.Range | string

ピボットテーブル データ本文内の 1 つのセル。

戻り値

指定したセル内の値の計算に使用される DataPivotHierarchy オブジェクト。

注釈

[ API セット: ExcelApi 1.9 ]

getFilterAxisRange()

ピボットテーブルのフィルター エリアの範囲を返します。

getFilterAxisRange(): Excel.Range;

戻り値

注釈

[ API セット: ExcelApi 1.8 ]

getPivotItems(axis, cell)

PivotTable 内で指定された範囲の値を構成する PivotItems を軸から取得します。

getPivotItems(axis: Excel.PivotAxis, cell: Range | string): Excel.PivotItemCollection;

パラメーター

axis
Excel.PivotAxis

PivotItems を取得する軸。 "行" または "列" である必要があります。

cell

Excel.Range | string

ピボットテーブルのデータ本文内の 1 つのセル。

戻り値

指定した行の値を計算するために使用される PivotItems の PivotItemCollection。

注釈

[ API セット: ExcelApi 1.9 ]

getPivotItems(axisString, cell)

PivotTable 内で指定された範囲の値を構成する PivotItems を軸から取得します。

getPivotItems(axisString: "Unknown" | "Row" | "Column" | "Data" | "Filter", cell: Range | string): Excel.PivotItemCollection;

パラメーター

axisString

"Unknown" | "Row" | "Column" | "Data" | "Filter"

PivotItems を取得する軸。 "行" または "列" である必要があります。

cell

Excel.Range | string

ピボットテーブルのデータ本文内の 1 つのセル。

戻り値

指定した行の値を計算するために使用される PivotItems の PivotItemCollection。

注釈

[ API セット: ExcelApi 1.9 ]

getRange()

フィルター エリアを除く、ピボットテーブルが存在する範囲を返します。

getRange(): Excel.Range;

戻り値

注釈

[ API セット: ExcelApi 1.8 ]

getRowLabelRange()

ピボットテーブルの行ラベルが存在する範囲を返します。

getRowLabelRange(): Excel.Range;

戻り値

注釈

[ API セット: ExcelApi 1.8 ]

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: Excel.Interfaces.PivotLayoutLoadOptions): Excel.PivotLayout;

パラメーター

options
Excel.Interfaces.PivotLayoutLoadOptions

読み込むオブジェクトのプロパティのオプションを提供します。

戻り値

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames?: string | string[]): Excel.PivotLayout;

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。

戻り値

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Excel.PivotLayout;

パラメーター

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select は、読み込むプロパティを指定するコンマ区切り文字列で propertyNamesAndPaths.expand 、読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。

戻り値

repeatAllItemLabels(repeatLabels)

ピボットテーブルのすべてのフィールドに対して "すべての項目ラベルを繰り返す" 設定を設定します。

repeatAllItemLabels(repeatLabels: boolean): void;

パラメーター

repeatLabels

boolean

True にすると、ラベルの繰り返し表示設定がオンになります。 False にするとオフになります。

戻り値

void

注釈

[ API セット: ExcelApi 1.13 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml

await Excel.run(async (context) => {
  // Repeat the PivotItem labels for each row used by another level of the row hierarchy.
  const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
  const pivotLayout = pivotTable.layout;

  pivotLayout.repeatAllItemLabels(true);
  console.log("Setting `PivotLayout.repeatAllItemLabels` to true.");

  await context.sync();
});

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。

set(properties: Interfaces.PivotLayoutUpdateData, options?: OfficeExtension.UpdateOptions): void;

パラメーター

properties
Excel.Interfaces.PivotLayoutUpdateData

メソッドが呼び出されるオブジェクトのプロパティに等形的に構造化されたプロパティを持つ JavaScript オブジェクト。

options
OfficeExtension.UpdateOptions

properties オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。

戻り値

void

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

set(properties: Excel.PivotLayout): void;

パラメーター

properties
Excel.PivotLayout

戻り値

void

setAutoSortOnCell(cell, sortBy)

必要なすべての条件とコンテキストを自動的に選択するため、指定したセルを使用して自動的に並べ替えを実行するようピボットテーブルを設定します。 これは、UI から自動並べ替えを適用するのと同じ動作です。

setAutoSortOnCell(cell: Range | string, sortBy: Excel.SortBy): void;

パラメーター

cell

Excel.Range | string

使用する 1 つのセルは、自動ソートを適用するための条件を取得します。

sortBy
Excel.SortBy

並べ替えの方向。

戻り値

void

注釈

[ API セット: ExcelApi 1.9 ]

setAutoSortOnCell(cell, sortByString)

必要なすべての条件とコンテキストを自動的に選択するため、指定したセルを使用して自動的に並べ替えを実行するようピボットテーブルを設定します。 これは、UI から自動並べ替えを適用するのと同じ動作です。

setAutoSortOnCell(cell: Range | string, sortByString: "Ascending" | "Descending"): void;

パラメーター

cell

Excel.Range | string

使用する 1 つのセルは、自動ソートを適用するための条件を取得します。

sortByString

"Ascending" | "Descending"

並べ替えの方向。

戻り値

void

注釈

[ API セット: ExcelApi 1.9 ]

setStyle(style)

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ピボットテーブルに適用されるスタイルを設定します。

setStyle(style: string | PivotTableStyle | BuiltInPivotTableStyle): void;

パラメーター

style

string | Excel.PivotTableStyle | Excel.BuiltInPivotTableStyle

ピボットテーブルに適用するスタイル。 任意の InvalidArgumentException スタイルの名前と一致しない文字列が指定されている場合は、 がスローされます。

戻り値

void

注釈

[ API セット: ExcelApi BETA (プレビューのみ) ]

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の Excel.PivotLayout オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として Excel.Interfaces.PivotLayoutData型指定) を返します。

toJSON(): Excel.Interfaces.PivotLayoutData;

戻り値