PowerPoint.TableCell 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();
});

プロパティ

borders

テーブル セルの罫線のコレクションを取得します。

columnCount

このセルがまたがるテーブルの列の数を取得します。 1 以上になります。

columnIndex

テーブル内のセルの 0 から始まる列インデックスを取得します。

context

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

fill

テーブル セルの塗りつぶしの色を取得します。

font

テーブル セルのフォントを取得します。

horizontalAlignment

表のセル内のテキストの水平方向の配置を指定します。 セルのテキストに異なる配置が含まれている場合は null を返します。

indentLevel

テーブル セル内のテキストのインデント レベルを指定します。 セル テキストに異なるインデント レベルが含まれている場合は null を返します。

margins

テーブル セルの余白のセットを取得します。

rowCount

このセルがまたがるテーブルの行数を取得します。 1 以上になります。

rowIndex

テーブル内のセルの 0 から始まる行インデックスを取得します。

text

テーブル セルのテキストの内容を指定します。

textRuns

テーブル セルの内容を PowerPoint.TextRun オブジェクトの配列として指定します。 各 TextRun オブジェクトは、同じフォント属性を共有する 1 つ以上の文字のシーケンスを表します。

verticalAlignment

テーブル セル内のテキストの垂直方向の配置を指定します。

メソッド

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

resize(rowCount, columnCount)

指定した数の行と列にまたがるようにテーブル セルのサイズを変更します。 rowCount または columnCount が 1 より大きい場合、セルは結合領域になります。 セルが既に結合された領域であり、rowCount と columnCount が 1 に設定されている場合、そのセルは結合された領域ではなくなります。

split(rowCount, columnCount)

セルを指定した数の行と列に分割します。

toJSON()

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

プロパティの詳細

borders

テーブル セルの罫線のコレクションを取得します。

readonly borders: PowerPoint.Borders;

プロパティ値

注釈

API セット: PowerPointApi 1.9

columnCount

このセルがまたがるテーブルの列の数を取得します。 1 以上になります。

readonly columnCount: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

columnIndex

テーブル内のセルの 0 から始まる列インデックスを取得します。

readonly columnIndex: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

context

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

context: RequestContext;

プロパティ値

fill

テーブル セルの塗りつぶしの色を取得します。

readonly fill: PowerPoint.ShapeFill;

プロパティ値

注釈

API セット: PowerPointApi 1.9

font

テーブル セルのフォントを取得します。

readonly font: PowerPoint.ShapeFont;

プロパティ値

注釈

API セット: PowerPointApi 1.9

horizontalAlignment

表のセル内のテキストの水平方向の配置を指定します。 セルのテキストに異なる配置が含まれている場合は null を返します。

horizontalAlignment: PowerPoint.ParagraphHorizontalAlignment | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed" | null;

プロパティ値

PowerPoint.ParagraphHorizontalAlignment | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed" | null

注釈

API セット: PowerPointApi 1.9

indentLevel

テーブル セル内のテキストのインデント レベルを指定します。 セル テキストに異なるインデント レベルが含まれている場合は null を返します。

indentLevel: number | null;

プロパティ値

number | null

注釈

API セット: PowerPointApi 1.9

margins

テーブル セルの余白のセットを取得します。

readonly margins: PowerPoint.Margins;

プロパティ値

注釈

API セット: PowerPointApi 1.9

rowCount

このセルがまたがるテーブルの行数を取得します。 1 以上になります。

readonly rowCount: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

rowIndex

テーブル内のセルの 0 から始まる行インデックスを取得します。

readonly rowIndex: number;

プロパティ値

number

注釈

API セット: PowerPointApi 1.8

text

テーブル セルのテキストの内容を指定します。

text: string;

プロパティ値

string

注釈

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();
});

textRuns

テーブル セルの内容を PowerPoint.TextRun オブジェクトの配列として指定します。 各 TextRun オブジェクトは、同じフォント属性を共有する 1 つ以上の文字のシーケンスを表します。

textRuns: PowerPoint.TextRun[];

プロパティ値

注釈

API セット: PowerPointApi 1.9

verticalAlignment

テーブル セル内のテキストの垂直方向の配置を指定します。

verticalAlignment: PowerPoint.TextVerticalAlignment | "Top" | "Middle" | "Bottom" | "TopCentered" | "MiddleCentered" | "BottomCentered";

プロパティ値

PowerPoint.TextVerticalAlignment | "Top" | "Middle" | "Bottom" | "TopCentered" | "MiddleCentered" | "BottomCentered"

注釈

API セット: PowerPointApi 1.9

メソッドの詳細

load(options)

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

load(options?: PowerPoint.Interfaces.TableCellLoadOptions): PowerPoint.TableCell;

パラメーター

options
PowerPoint.Interfaces.TableCellLoadOptions

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

返品

load(propertyNames)

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

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

パラメーター

propertyNames

string | string[]

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

返品

load(propertyNamesAndPaths)

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

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

パラメーター

propertyNamesAndPaths

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

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

返品

resize(rowCount, columnCount)

指定した数の行と列にまたがるようにテーブル セルのサイズを変更します。 rowCount または columnCount が 1 より大きい場合、セルは結合領域になります。 セルが既に結合された領域であり、rowCount と columnCount が 1 に設定されている場合、そのセルは結合された領域ではなくなります。

resize(rowCount: number, columnCount: number): void;

パラメーター

rowCount

number

セルがまたがる行数。 0 より大きい必要があります。

columnCount

number

セルがまたがる列の数。 0 より大きい必要があります。

返品

void

注釈

API セット: PowerPointApi 1.9

split(rowCount, columnCount)

セルを指定した数の行と列に分割します。

split(rowCount: number, columnCount: number): void;

パラメーター

rowCount

number

分割する行の数。 0 より大きい必要があります。

columnCount

number

分割する列の数。 0 より大きい必要があります。

返品

void

注釈

API セット: PowerPointApi 1.9

toJSON()

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

toJSON(): PowerPoint.Interfaces.TableCellData;

返品