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();
});
プロパティ
| column |
表の列数を取得します。 |
| columns | テーブル内の列のコレクションを取得します。 |
| context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
| row |
表の行数を取得します。 |
| rows | テーブル内の行のコレクションを取得します。 |
| style |
テーブル スタイルの設定を取得します。 |
| values | テーブル内のすべての値を取得します。 |
メソッド
| clear(options) | テーブル値と書式設定をクリアします。 |
| get |
指定した |
| get |
テーブルのマージされた領域を表すセルのコレクションを取得します。 |
| get |
テーブルの shape オブジェクトを取得します。 |
| load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| merge |
rowIndex と columnIndex で指定されたセルから始まるマージされた領域を作成します。 マージされた領域は、指定された数の行と列にまたがる。 |
| toJSON() | API オブジェクトが |
プロパティの詳細
columnCount
columns
テーブル内の列のコレクションを取得します。
readonly columns: PowerPoint.TableColumnCollection;
プロパティ値
注釈
context
オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。
context: RequestContext;
プロパティ値
rowCount
rows
テーブル内の行のコレクションを取得します。
readonly rows: PowerPoint.TableRowCollection;
プロパティ値
注釈
styleSettings
テーブル スタイルの設定を取得します。
readonly styleSettings: PowerPoint.TableStyleSettings;
プロパティ値
注釈
values
メソッドの詳細
clear(options)
テーブル値と書式設定をクリアします。
clear(options?: PowerPoint.TableClearOptions): void;
パラメーター
- options
- PowerPoint.TableClearOptions
テーブルをクリアするためのオプションを提供します。
戻り値
void
注釈
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 。
注釈
getShape()
テーブルの shape オブジェクトを取得します。
getShape(): PowerPoint.Shape;
戻り値
注釈
load(options)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(options?: PowerPoint.Interfaces.TableLoadOptions): PowerPoint.Table;
パラメーター
読み込むオブジェクトのプロパティのオプションを提供します。
戻り値
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
注釈
toJSON()
API オブジェクトがJSON.stringify()に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (JSON.stringify、それに渡されるオブジェクトの toJSON メソッドを呼び出します)。元の PowerPoint.Table オブジェクトは API オブジェクトですが、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( PowerPoint.Interfaces.TableData として型指定) を返します。
toJSON(): PowerPoint.Interfaces.TableData;