PowerPoint.Table class

テーブルを表します。

Extends

注釈

API セット: PowerPointApi 1.8

使用元

例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml

// Updates a table's values.
await PowerPoint.run(async (context) => {
  const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;

  // Add a table (which is a type of Shape).
  const shape = shapes.addTable(4, 3);
  let table = shape.getTable();
  table.load();
  await context.sync();

  // Update values in the table.
  for (let rowIndex = 0; rowIndex < table.rowCount; rowIndex++) {
    for (let columnIndex = 0; columnIndex < table.columnCount; columnIndex++) {
      const cell = table.getCellOrNullObject(rowIndex, columnIndex);
      cell.text = generateRandomString();
    }
  }

  await context.sync();
});

プロパティ

columnCount

表の列数を取得します。

columns

テーブル内の列のコレクションを取得します。

context

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

rowCount

表の行数を取得します。

rows

テーブル内の行のコレクションを取得します。

styleSettings

表のスタイル設定を取得します。

values

テーブルのすべての値を取得します。

メソッド

clear(options)

テーブルの値と書式設定をクリアします。

getCellOrNullObject(rowIndex, columnIndex)

指定した rowIndex と columnIndexのセルを取得します。

getMergedAreas()

テーブルの結合された領域を表すセルのコレクションを取得します。

getShape()

テーブルの図形オブジェクトを取得します。

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

mergeCells(rowIndex, columnIndex, rowCount, columnCount)

rowIndex と columnIndex で指定されたセルから始まる結合領域を作成します。 マージされた領域は、指定された数の行と列にまたがります。

toJSON()

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

プロパティの詳細

columnCount

表の列数を取得します。

readonly columnCount: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

columns

テーブル内の列のコレクションを取得します。

readonly columns: PowerPoint.TableColumnCollection;

プロパティ値

注釈

API セット: PowerPointApi 1.9

context

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

context: RequestContext;

プロパティ値

rowCount

表の行数を取得します。

readonly rowCount: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

rows

テーブル内の行のコレクションを取得します。

readonly rows: PowerPoint.TableRowCollection;

プロパティ値

注釈

API セット: PowerPointApi 1.9

styleSettings

表のスタイル設定を取得します。

readonly styleSettings: PowerPoint.TableStyleSettings;

プロパティ値

注釈

API セット: PowerPointApi 1.9

values

テーブルのすべての値を取得します。

readonly values: string[][];

プロパティ値

string[][]

注釈

API セット: PowerPointApi 1.8

メソッドの詳細

clear(options)

テーブルの値と書式設定をクリアします。

clear(options?: PowerPoint.TableClearOptions): void;

パラメーター

options
PowerPoint.TableClearOptions

テーブルをクリアするためのオプションを指定します。

返品

void

注釈

API セット: PowerPointApi 1.9

getCellOrNullObject(rowIndex, columnIndex)

指定した rowIndex と columnIndexのセルを取得します。

getCellOrNullObject(rowIndex: number, columnIndex: number): PowerPoint.TableCell;

パラメーター

rowIndex

number

セルの 0 から始まる行インデックス。

columnIndex

number

セルの 0 から始まる列インデックス。

返品

指定された行と列のセル。 セルが結合された領域の一部であり、結合された領域の左上のセルではない場合、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject のメソッドとプロパティ」を参照してください。

注釈

API セット: PowerPointApi 1.8

例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml

// Updates a table's values.
await PowerPoint.run(async (context) => {
  const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;

  // Add a table (which is a type of Shape).
  const shape = shapes.addTable(4, 3);
  let table = shape.getTable();
  table.load();
  await context.sync();

  // Update values in the table.
  for (let rowIndex = 0; rowIndex < table.rowCount; rowIndex++) {
    for (let columnIndex = 0; columnIndex < table.columnCount; columnIndex++) {
      const cell = table.getCellOrNullObject(rowIndex, columnIndex);
      cell.text = generateRandomString();
    }
  }

  await context.sync();
});

getMergedAreas()

テーブルの結合された領域を表すセルのコレクションを取得します。

getMergedAreas(): PowerPoint.TableCellCollection;

返品

テーブルの結合された領域を表すセルを持つ TableCellCollection 。

注釈

API セット: PowerPointApi 1.8

getShape()

テーブルの図形オブジェクトを取得します。

getShape(): PowerPoint.Shape;

返品

注釈

API セット: PowerPointApi 1.8

load(options)

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

load(options?: PowerPoint.Interfaces.TableLoadOptions): PowerPoint.Table;

パラメーター

options
PowerPoint.Interfaces.TableLoadOptions

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

返品

load(propertyNames)

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

load(propertyNames?: string | string[]): PowerPoint.Table;

パラメーター

propertyNames

string | string[]

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

返品

load(propertyNamesAndPaths)

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

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): PowerPoint.Table;

パラメーター

propertyNamesAndPaths

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

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

返品

mergeCells(rowIndex, columnIndex, rowCount, columnCount)

rowIndex と columnIndex で指定されたセルから始まる結合領域を作成します。 マージされた領域は、指定された数の行と列にまたがります。

mergeCells(rowIndex: number, columnIndex: number, rowCount: number, columnCount: number): void;

パラメーター

rowIndex

number

結合領域を開始するセルの 0 から始まる行インデックス。

columnIndex

number

結合領域を開始するセルの 0 から始まる列インデックス。

rowCount

number

開始セルと結合する行の数。 0 より大きい必要があります。

columnCount

number

開始セルと結合する列の数。 0 より大きい必要があります。

返品

void

注釈

API セット: PowerPointApi 1.9

toJSON()

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

toJSON(): PowerPoint.Interfaces.TableData;

返品