PowerPoint.TableAddOptions interface
テーブルを追加するときに使用できるオプションを表します。
注釈
使用元
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the width and height of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying the width and height.
shapes.addTable(3, 4, {
width: 600,
height: 400
});
await context.sync();
});
プロパティ
| columns | 指定した場合、テーブル内の各列のプロパティを指定します。 配列の長さは、テーブルの列数と同じにする必要があります。 既定の書式設定を使用する列に空のオブジェクトを指定します。 |
| height | テーブルの高さをポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値に設定されている場合は、 注: 表の高さが行数で均等に割り切れない場合、PowerPoint は表の高さを最も近い値に設定します。 たとえば、3 行の高さが 400 の場合、実際の高さは 399.9999 になります。 |
| left | 表の左側からスライドの左側までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合、テーブルは水平方向に中央揃えされます。 |
| merged |
指定した場合、複数のセルが 1 つのセルとして表示される四角形の領域を表します。 |
| rows | 指定した場合は、テーブル内の各行のプロパティを指定します。 配列の長さは、テーブルの行数と同じにする必要があります。 既定の書式設定を使用する行には空のオブジェクトを指定します。 |
| specific |
指定した場合は、テーブル内の各セルのプロパティを指定します。 これは、テーブルと同じ数の行と列を持つ 2D 配列である必要があります。 特定の書式設定を必要としないセルの場合は、そのセルに空のオブジェクトを指定します。 結合されたセルの左上のセルのみにプロパティを指定でき、結合された領域全体に適用されます。 結合された領域内の他のセルには、空のオブジェクトを指定する必要があります。 |
| style | 表のスタイルを表す値を指定します。 |
| top | 表の上端からスライドの上端までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 |
| uniform |
すべてのテーブル セルに均一に適用される書式設定を指定します。 個々のセルに特定の書式を適用するには、 uniformCellProperties と specificCellProperties の両方が定義されていない場合は、既定の書式が使用され、既定のテーブル スタイルが適用されます。 テーブルの外観は、ユーザーが PowerPoint UI を使用してテーブルを追加した場合と同じになります。 テーブルの外観をわかりやすくするには、このプロパティを空のオブジェクトに設定し、 |
| values | 指定した場合は、テーブルの値を指定します。 テーブルに結合されたセルの領域が含まれている場合、結合された各領域の左上のセルのみが、空ではない文字列値を持つことができます。 結合された領域内の他のセルは空の文字列である必要があります。 |
| width | テーブルの幅をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値に設定されている場合は、 注: 表の幅が列数で均等に割り切れない場合は、PowerPoint は可能な限り最も近い値に設定します。 たとえば、3 列の幅を 400 の場合、実際の幅は 399.9999 になります。 |
プロパティの詳細
columns
指定した場合、テーブル内の各列のプロパティを指定します。 配列の長さは、テーブルの列数と同じにする必要があります。 既定の書式設定を使用する列に空のオブジェクトを指定します。
columns?: PowerPoint.TableColumnProperties[];
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the column widths and row heights of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying column widths and row heights.
shapes.addTable(3, 4, {
columns: [{ columnWidth: 100 }, { columnWidth: 200 }, { columnWidth: 100 }, { columnWidth: 200 }],
rows: [{ rowHeight: 60 }, { rowHeight: 120 }, { rowHeight: 180 }]
});
await context.sync();
});
height
テーブルの高さをポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値に設定されている場合は、 InvalidArgument 例外をスローします。
注: 表の高さが行数で均等に割り切れない場合、PowerPoint は表の高さを最も近い値に設定します。 たとえば、3 行の高さが 400 の場合、実際の高さは 399.9999 になります。
height?: number | undefined;
プロパティ値
number | undefined
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the width and height of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying the width and height.
shapes.addTable(3, 4, {
width: 600,
height: 400
});
await context.sync();
});
left
表の左側からスライドの左側までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合、テーブルは水平方向に中央揃えされます。
left?: number | undefined;
プロパティ値
number | undefined
注釈
mergedAreas
指定した場合、複数のセルが 1 つのセルとして表示される四角形の領域を表します。
mergedAreas?: PowerPoint.TableMergedAreaProperties[];
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the merge areas of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying one 2x2 merged area.
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "", "HHHH"],
["1", "", "", "1234"]
],
mergedAreas: [{ rowIndex: 1, columnIndex: 1, rowCount: 2, columnCount: 2 }]
});
await context.sync();
});
rows
指定した場合は、テーブル内の各行のプロパティを指定します。 配列の長さは、テーブルの行数と同じにする必要があります。 既定の書式設定を使用する行には空のオブジェクトを指定します。
rows?: PowerPoint.TableRowProperties[];
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the column widths and row heights of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying column widths and row heights.
shapes.addTable(3, 4, {
columns: [{ columnWidth: 100 }, { columnWidth: 200 }, { columnWidth: 100 }, { columnWidth: 200 }],
rows: [{ rowHeight: 60 }, { rowHeight: 120 }, { rowHeight: 180 }]
});
await context.sync();
});
specificCellProperties
指定した場合は、テーブル内の各セルのプロパティを指定します。
これは、テーブルと同じ数の行と列を持つ 2D 配列である必要があります。 特定の書式設定を必要としないセルの場合は、そのセルに空のオブジェクトを指定します。 結合されたセルの左上のセルのみにプロパティを指定でき、結合された領域全体に適用されます。 結合された領域内の他のセルには、空のオブジェクトを指定する必要があります。
specificCellProperties?: PowerPoint.TableCellProperties[][];
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors.
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
style
表のスタイルを表す値を指定します。
style?: PowerPoint.TableStyle | "NoStyleNoGrid" | "ThemedStyle1Accent1" | "ThemedStyle1Accent2" | "ThemedStyle1Accent3" | "ThemedStyle1Accent4" | "ThemedStyle1Accent5" | "ThemedStyle1Accent6" | "NoStyleTableGrid" | "ThemedStyle2Accent1" | "ThemedStyle2Accent2" | "ThemedStyle2Accent3" | "ThemedStyle2Accent4" | "ThemedStyle2Accent5" | "ThemedStyle2Accent6" | "LightStyle1" | "LightStyle1Accent1" | "LightStyle1Accent2" | "LightStyle1Accent3" | "LightStyle1Accent4" | "LightStyle1Accent5" | "LightStyle1Accent6" | "LightStyle2" | "LightStyle2Accent1" | "LightStyle2Accent2" | "LightStyle2Accent3" | "LightStyle2Accent4" | "LightStyle2Accent5" | "LightStyle2Accent6" | "LightStyle3" | "LightStyle3Accent1" | "LightStyle3Accent2" | "LightStyle3Accent3" | "LightStyle3Accent4" | "LightStyle3Accent5" | "LightStyle3Accent6" | "MediumStyle1" | "MediumStyle1Accent1" | "MediumStyle1Accent2" | "MediumStyle1Accent3" | "MediumStyle1Accent4" | "MediumStyle1Accent5" | "MediumStyle1Accent6" | "MediumStyle2" | "MediumStyle2Accent1" | "MediumStyle2Accent2" | "MediumStyle2Accent3" | "MediumStyle2Accent4" | "MediumStyle2Accent5" | "MediumStyle2Accent6" | "MediumStyle3" | "MediumStyle3Accent1" | "MediumStyle3Accent2" | "MediumStyle3Accent3" | "MediumStyle3Accent4" | "MediumStyle3Accent5" | "MediumStyle3Accent6" | "MediumStyle4" | "MediumStyle4Accent1" | "MediumStyle4Accent2" | "MediumStyle4Accent3" | "MediumStyle4Accent4" | "MediumStyle4Accent5" | "MediumStyle4Accent6" | "DarkStyle1" | "DarkStyle1Accent1" | "DarkStyle1Accent2" | "DarkStyle1Accent3" | "DarkStyle1Accent4" | "DarkStyle1Accent5" | "DarkStyle1Accent6" | "DarkStyle2" | "DarkStyle2Accent1" | "DarkStyle2Accent2" | "DarkStyle2Accent3";
プロパティ値
PowerPoint.TableStyle | "NoStyleNoGrid" | "ThemedStyle1Accent1" | "ThemedStyle1Accent2" | "ThemedStyle1Accent3" | "ThemedStyle1Accent4" | "ThemedStyle1Accent5" | "ThemedStyle1Accent6" | "NoStyleTableGrid" | "ThemedStyle2Accent1" | "ThemedStyle2Accent2" | "ThemedStyle2Accent3" | "ThemedStyle2Accent4" | "ThemedStyle2Accent5" | "ThemedStyle2Accent6" | "LightStyle1" | "LightStyle1Accent1" | "LightStyle1Accent2" | "LightStyle1Accent3" | "LightStyle1Accent4" | "LightStyle1Accent5" | "LightStyle1Accent6" | "LightStyle2" | "LightStyle2Accent1" | "LightStyle2Accent2" | "LightStyle2Accent3" | "LightStyle2Accent4" | "LightStyle2Accent5" | "LightStyle2Accent6" | "LightStyle3" | "LightStyle3Accent1" | "LightStyle3Accent2" | "LightStyle3Accent3" | "LightStyle3Accent4" | "LightStyle3Accent5" | "LightStyle3Accent6" | "MediumStyle1" | "MediumStyle1Accent1" | "MediumStyle1Accent2" | "MediumStyle1Accent3" | "MediumStyle1Accent4" | "MediumStyle1Accent5" | "MediumStyle1Accent6" | "MediumStyle2" | "MediumStyle2Accent1" | "MediumStyle2Accent2" | "MediumStyle2Accent3" | "MediumStyle2Accent4" | "MediumStyle2Accent5" | "MediumStyle2Accent6" | "MediumStyle3" | "MediumStyle3Accent1" | "MediumStyle3Accent2" | "MediumStyle3Accent3" | "MediumStyle3Accent4" | "MediumStyle3Accent5" | "MediumStyle3Accent6" | "MediumStyle4" | "MediumStyle4Accent1" | "MediumStyle4Accent2" | "MediumStyle4Accent3" | "MediumStyle4Accent4" | "MediumStyle4Accent5" | "MediumStyle4Accent6" | "DarkStyle1" | "DarkStyle1Accent1" | "DarkStyle1Accent2" | "DarkStyle1Accent3" | "DarkStyle1Accent4" | "DarkStyle1Accent5" | "DarkStyle1Accent6" | "DarkStyle2" | "DarkStyle2Accent1" | "DarkStyle2Accent2" | "DarkStyle2Accent3"
注釈
top
表の上端からスライドの上端までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。
top?: number | undefined;
プロパティ値
number | undefined
注釈
uniformCellProperties
すべてのテーブル セルに均一に適用される書式設定を指定します。
個々のセルに特定の書式を適用するには、 specificCellProperties を使用します。
uniformCellProperties と specificCellProperties の両方が定義されていない場合は、既定の書式が使用され、既定のテーブル スタイルが適用されます。 テーブルの外観は、ユーザーが PowerPoint UI を使用してテーブルを追加した場合と同じになります。
テーブルの外観をわかりやすくするには、このプロパティを空のオブジェクトに設定し、 specificCellProperties を指定しないでください。
uniformCellProperties?: PowerPoint.TableCellProperties;
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies a table's borders.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying border styles.
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
uniformCellProperties: {
borders: {
left: { color: "blue", dashStyle: PowerPoint.ShapeLineDashStyle.solid, weight: 4 },
right: { color: "blue", dashStyle: PowerPoint.ShapeLineDashStyle.solid, weight: 4 },
top: { color: "red", dashStyle: PowerPoint.ShapeLineDashStyle.longDashDotDot, weight: 2 },
bottom: { color: "red", dashStyle: PowerPoint.ShapeLineDashStyle.longDashDotDot, weight: 2 }
}
}
});
await context.sync();
});
values
指定した場合は、テーブルの値を指定します。
テーブルに結合されたセルの領域が含まれている場合、結合された各領域の左上のセルのみが、空ではない文字列値を持つことができます。 結合された領域内の他のセルは空の文字列である必要があります。
values?: string[][];
プロパティ値
string[][]
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies a table's values.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying cell values.
const shape = shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
]
});
await context.sync();
});
width
テーブルの幅をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値に設定されている場合は、 InvalidArgument 例外をスローします。
注: 表の幅が列数で均等に割り切れない場合は、PowerPoint は可能な限り最も近い値に設定します。 たとえば、3 列の幅を 400 の場合、実際の幅は 399.9999 になります。
width?: number | undefined;
プロパティ値
number | undefined
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the width and height of a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying the width and height.
shapes.addTable(3, 4, {
width: 600,
height: 400
});
await context.sync();
});