次の方法で共有


PowerPoint.TableAddOptions interface

テーブルを追加するときに使用できるオプションを表します。

注釈

[ API セット: PowerPointApi 1.8 ]

// 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

テーブルの高さをポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値を設定すると、 InvalidArgument 例外がスローされます。

注: テーブルの高さが行数で均等に割り切れない場合は、PowerPointは可能な限り最も近い値に設定します。 たとえば、3 行の高さが 400 の場合、実際の高さは 399.9999 になります。

left

テーブルの左側からスライドの左側までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合、テーブルは水平方向に中央揃えされます。

mergedAreas

指定した場合、複数のセルが 1 つのセルとして表示される四角形の領域を表します。

rows

指定した場合は、テーブル内の各行のプロパティを指定します。 配列の長さは、テーブル内の行数と等しい必要があります。 既定の書式設定を使用する必要がある行に空のオブジェクトを指定します。

specificCellProperties

指定した場合は、テーブル内の各セルのプロパティを指定します。

これは、テーブルと同じ数の行と列を持つ 2D 配列である必要があります。 セルに特定の書式設定が必要ない場合は、そのセルに空のオブジェクトを指定します。 マージされたの左上のセルのみがプロパティを指定でき、マージされた領域全体に適用されます。 マージされた領域内の他のセルには、空のオブジェクトを指定する必要があります。

style

テーブル スタイルを表す値を指定します。

top

テーブルの上端からスライドの上端までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。

uniformCellProperties

すべてのテーブル セルに均一に適用される書式を指定します。

個々のセルに特定の書式を適用するには、 specificCellPropertiesを使用します。

uniformCellProperties と specificCellProperties の両方が未定義の場合、既定の書式設定が使用され、既定のテーブル スタイルが適用されます。 テーブルは、ユーザーがPowerPoint UI を介してテーブルを追加したときと同じ外観になります。

テーブルの外観をわかりやすくするには、このプロパティを空のオブジェクトに設定し、 specificCellPropertiesを指定しないでください。

values

指定した場合は、テーブルの値を指定します。

テーブルに結合されたセルの領域が含まれている場合、マージされた各領域の左上のセルだけが空ではない文字列値を持つことができます。 マージされた領域内の他のセルは空の文字列である必要があります。

width

テーブルの幅をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。 負の値を設定すると、 InvalidArgument 例外がスローされます。

注: テーブルの幅が列の数で均等に割り切れない場合は、PowerPointは可能な限り最も近い値に設定します。 たとえば、3 列の幅が 400 の場合、実際の幅は 399.9999 になります。

プロパティの詳細

columns

指定した場合は、テーブル内の各列のプロパティを指定します。 配列の長さは、テーブル内の列の数と等しい必要があります。 既定の書式設定を使用する列に空のオブジェクトを指定します。

columns?: PowerPoint.TableColumnProperties[];

プロパティ値

注釈

[ API セット: PowerPointApi 1.8 ]

// 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

注釈

[ API セット: PowerPointApi 1.8 ]

// 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

注釈

[ API セット: PowerPointApi 1.8 ]

mergedAreas

指定した場合、複数のセルが 1 つのセルとして表示される四角形の領域を表します。

mergedAreas?: PowerPoint.TableMergedAreaProperties[];

プロパティ値

注釈

[ API セット: PowerPointApi 1.8 ]

// 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[];

プロパティ値

注釈

[ API セット: PowerPointApi 1.8 ]

// 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[][];

プロパティ値

注釈

[ API セット: PowerPointApi 1.8 ]

// 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"

注釈

[ API set: PowerPointApi 1.9 ]

top

テーブルの上端からスライドの上端までの距離をポイント単位で指定します。 このパラメーターが指定されていない場合は、既定値が使用されます。

top?: number | undefined;

プロパティ値

number | undefined

注釈

[ API セット: PowerPointApi 1.8 ]

uniformCellProperties

すべてのテーブル セルに均一に適用される書式を指定します。

個々のセルに特定の書式を適用するには、 specificCellPropertiesを使用します。

uniformCellProperties と specificCellProperties の両方が未定義の場合、既定の書式設定が使用され、既定のテーブル スタイルが適用されます。 テーブルは、ユーザーがPowerPoint UI を介してテーブルを追加したときと同じ外観になります。

テーブルの外観をわかりやすくするには、このプロパティを空のオブジェクトに設定し、 specificCellPropertiesを指定しないでください。

uniformCellProperties?: PowerPoint.TableCellProperties;

プロパティ値

注釈

[ API セット: PowerPointApi 1.8 ]

// 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[][]

注釈

[ API セット: PowerPointApi 1.8 ]

// 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

注釈

[ API セット: PowerPointApi 1.8 ]

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