次の方法で共有


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 set: 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 set: PowerPointApi 1.9 ]

font

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

readonly font: PowerPoint.ShapeFont;

プロパティ値

注釈

[ API set: 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 set: PowerPointApi 1.9 ]

indentLevel

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

indentLevel: number | null;

プロパティ値

number | null

注釈

[ API set: PowerPointApi 1.9 ]

margins

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

readonly margins: PowerPoint.Margins;

プロパティ値

注釈

[ API set: 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 set: PowerPointApi 1.9 ]

verticalAlignment

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

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

プロパティ値

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

注釈

[ API set: 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 set: PowerPointApi 1.9 ]

split(rowCount, columnCount)

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

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

パラメーター

rowCount

number

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

columnCount

number

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

戻り値

void

注釈

[ API set: PowerPointApi 1.9 ]

toJSON()

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

toJSON(): PowerPoint.Interfaces.TableCellData;

戻り値