OPF

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Table

    Table content, inline or dataset-backed. An inline table has 'rows' (required) and optional 'columns'. A dataset-backed table has 'dataset' (required) and optional 'fields', and no 'rows' or 'columns': it takes its headers, rows and column formats from the dataset (per-cell styles need an inline table).

    Metadata

    Definition
    #/$defs/Table
    Form
    object
    Source
    spec/schemas/opf.schema.json

    Field index

    FieldTypeReq.Description
    columnsarray<string | array<ref:TextRun> | ref:StyledTableCell | ref:DataColumn | null>—Optional column labels. Labels may be strings, rich runs, styled cell objects or DataColumn objects ({ "name", "format" }). A header's 'format' (DataColumn or StyledTableCell) is the column's number format; a body cell's own format wins. Null is an empty label or a placeholder covered by a preceding column span.
    rowsarray<array<ref:TableCell>>—Two-dimensional table row data; each row aligns by index with columns when columns are supplied.
    datasetref:DatasetId—Id of a top-level dataset that supplies this table's headers, rows and column formats. Excludes 'rows' and 'columns'. An unknown id is a 'dataset-unknown' error.
    fieldsref:DatasetFields—Dataset tables only: the dataset columns to show, by name and in order. Absent shows every column. An unknown name is a 'dataset-field-unknown' error.
    altstring—Text alternative for the table: what it shows (the point and the key numbers), not 'a table'. The preview exposes it as the table's accessible name (role group with aria-label; the cells stay readable) and the PowerPoint export writes it as the table frame's alternative text (descr); import reads it back. An empty string hides a purely decorative table, with the same meaning as an empty Asset alt. The alt is a summary read before the cells, which stay readable, so it is most useful for a large or dense table; validate does not require one and does not report a missing one.
    highlightobject—Optional emphasis: the body rows that carry the message, named by their first-column (key) text exactly as 'chart.highlight' names categories, as text; a key shared by several rows highlights each of them. The engines draw a highlighted row on an accent tint of the table surface (15% of the deck's primary color, mixed less where the cell text would fall under 4.5:1); a cell with its own 'style.fill' keeps it. Absent, the engines highlight the rows the slide's other texts name (its title, a sentence, a list entry, a quote or a chart's alt) when they agree on some rows but not all; an empty 'rows' list turns that off. PPTX export writes the tint as each cell's fill and import restores the list. A name no row has is a 'table-highlight-unknown-name' error.

    columns

    typearray<string | array<ref:TextRun> | ref:StyledTableCell | ref:DataColumn | null>requirednodefault—

    Optional column labels. Labels may be strings, rich runs, styled cell objects or DataColumn objects ({ "name", "format" }). A header's 'format' (DataColumn or StyledTableCell) is the column's number format; a body cell's own format wins. Null is an empty label or a placeholder covered by a preceding column span.

    Named choices are not exhaustive. See the schema for other values and constraints.
    columns[] (oneOf 2)[] (oneOf 2).color (anyOf 2).color, columns[] (oneOf 3).style.fill, columns[] (oneOf 3).style.color, columns[] (oneOf 3).style.borders.top (anyOf 2).color · Named choices
    "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "dark1", "dark2", "light1", "light2", "hyperlink", "followedHyperlink", "primary", "secondary", "accent", "background", "surface", "surfaceAlt", "text", "textSecondary"
    columns[] (oneOf 3).style.align · Allowed values
    "start", "center", "end"
    columns[] (oneOf 3).style.verticalAlign · Allowed values
    "top", "middle", "bottom"
    columns[] (oneOf 3).style.borders.top, columns[] (oneOf 3).style.borders.right, columns[] (oneOf 3).style.borders.bottom, columns[] (oneOf 3).style.borders.left · Named choices
    "none"
    columns[] (oneOf 3).style.borders.top (anyOf 2).dash · Allowed values
    "solid", "dash", "dot"
    columns.json
    {
      "columns": [
        "Region",
        "Q3 Revenue",
        "Q4 Revenue",
        "YoY %"
      ]
    }

    rows

    typearray<array<ref:TableCell>>requirednodefault—

    Two-dimensional table row data; each row aligns by index with columns when columns are supplied.

    Named choices are not exhaustive. See the schema for other values and constraints.
    rows[][] (oneOf 1) (oneOf 5)[] (oneOf 2).color (anyOf 2).color, rows[][] (oneOf 2).style.fill, rows[][] (oneOf 2).style.color, rows[][] (oneOf 2).style.borders.top (anyOf 2).color · Named choices
    "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "dark1", "dark2", "light1", "light2", "hyperlink", "followedHyperlink", "primary", "secondary", "accent", "background", "surface", "surfaceAlt", "text", "textSecondary"
    rows[][] (oneOf 2).style.align · Allowed values
    "start", "center", "end"
    rows[][] (oneOf 2).style.verticalAlign · Allowed values
    "top", "middle", "bottom"
    rows[][] (oneOf 2).style.borders.top, rows[][] (oneOf 2).style.borders.right, rows[][] (oneOf 2).style.borders.bottom, rows[][] (oneOf 2).style.borders.left · Named choices
    "none"
    rows[][] (oneOf 2).style.borders.top (anyOf 2).dash · Allowed values
    "solid", "dash", "dot"
    rows.json
    {
      "rows": [
        [
          "North America",
          12.4,
          18.1,
          "46%"
        ],
        [
          "EMEA",
          8.2,
          11.5,
          "40%"
        ]
      ]
    }

    dataset

    typeref:DatasetIdrequirednodefault—

    Id of a top-level dataset that supplies this table's headers, rows and column formats. Excludes 'rows' and 'columns'. An unknown id is a 'dataset-unknown' error.

    fields

    typeref:DatasetFieldsrequirednodefault—

    Dataset tables only: the dataset columns to show, by name and in order. Absent shows every column. An unknown name is a 'dataset-field-unknown' error.

    alt

    typestringrequirednodefault—

    Text alternative for the table: what it shows (the point and the key numbers), not 'a table'. The preview exposes it as the table's accessible name (role group with aria-label; the cells stay readable) and the PowerPoint export writes it as the table frame's alternative text (descr); import reads it back. An empty string hides a purely decorative table, with the same meaning as an empty Asset alt. The alt is a summary read before the cells, which stay readable, so it is most useful for a large or dense table; validate does not require one and does not report a missing one.

    alt.json
    {
      "alt": "North America grew 46% to $18.1M in Q4, ahead of EMEA at 40%."
    }

    highlight

    typeobjectrequirednodefault—

    Optional emphasis: the body rows that carry the message, named by their first-column (key) text exactly as 'chart.highlight' names categories, as text; a key shared by several rows highlights each of them. The engines draw a highlighted row on an accent tint of the table surface (15% of the deck's primary color, mixed less where the cell text would fall under 4.5:1); a cell with its own 'style.fill' keeps it. Absent, the engines highlight the rows the slide's other texts name (its title, a sentence, a list entry, a quote or a chart's alt) when they agree on some rows but not all; an empty 'rows' list turns that off. PPTX export writes the tint as each cell's fill and import restores the list. A name no row has is a 'table-highlight-unknown-name' error.

    highlight.json
    {
      "highlight": {
        "rows": [
          "Southeast",
          "Southwest"
        ]
      }
    }
    Complete definition constraints
    Schema constraints
    {
      "type": "object",
      "description": "Table content, inline or dataset-backed. An inline table has 'rows' (required) and optional 'columns'. A dataset-backed table has 'dataset' (required) and optional 'fields', and no 'rows' or 'columns': it takes its headers, rows and column formats from the dataset (per-cell styles need an inline table).",
      "additionalProperties": false,
      "if": {
        "required": [
          "dataset"
        ]
      },
      "then": {
        "properties": {
          "rows": false,
          "columns": false
        }
      },
      "else": {
        "required": [
          "rows"
        ],
        "properties": {
          "fields": false
        }
      },
      "properties": {
        "columns": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/TextRun"
                }
              },
              {
                "$ref": "#/$defs/StyledTableCell"
              },
              {
                "$ref": "#/$defs/DataColumn"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": "Optional column labels. Labels may be strings, rich runs, styled cell objects or DataColumn objects ({ \"name\", \"format\" }). A header's 'format' (DataColumn or StyledTableCell) is the column's number format; a body cell's own format wins. Null is an empty label or a placeholder covered by a preceding column span.",
          "examples": [
            [
              "Region",
              "Q3 Revenue",
              "Q4 Revenue",
              "YoY %"
            ]
          ]
        },
        "rows": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/TableCell"
            }
          },
          "description": "Two-dimensional table row data; each row aligns by index with columns when columns are supplied.",
          "examples": [
            [
              [
                "North America",
                12.4,
                18.1,
                "46%"
              ],
              [
                "EMEA",
                8.2,
                11.5,
                "40%"
              ]
            ]
          ]
        },
        "dataset": {
          "$ref": "#/$defs/DatasetId",
          "description": "Id of a top-level dataset that supplies this table's headers, rows and column formats. Excludes 'rows' and 'columns'. An unknown id is a 'dataset-unknown' error."
        },
        "fields": {
          "$ref": "#/$defs/DatasetFields",
          "description": "Dataset tables only: the dataset columns to show, by name and in order. Absent shows every column. An unknown name is a 'dataset-field-unknown' error."
        },
        "alt": {
          "type": "string",
          "description": "Text alternative for the table: what it shows (the point and the key numbers), not 'a table'. The preview exposes it as the table's accessible name (role group with aria-label; the cells stay readable) and the PowerPoint export writes it as the table frame's alternative text (descr); import reads it back. An empty string hides a purely decorative table, with the same meaning as an empty Asset alt. The alt is a summary read before the cells, which stay readable, so it is most useful for a large or dense table; validate does not require one and does not report a missing one.",
          "examples": [
            "North America grew 46% to $18.1M in Q4, ahead of EMEA at 40%."
          ]
        },
        "highlight": {
          "type": "object",
          "additionalProperties": false,
          "description": "Optional emphasis: the body rows that carry the message, named by their first-column (key) text exactly as 'chart.highlight' names categories, as text; a key shared by several rows highlights each of them. The engines draw a highlighted row on an accent tint of the table surface (15% of the deck's primary color, mixed less where the cell text would fall under 4.5:1); a cell with its own 'style.fill' keeps it. Absent, the engines highlight the rows the slide's other texts name (its title, a sentence, a list entry, a quote or a chart's alt) when they agree on some rows but not all; an empty 'rows' list turns that off. PPTX export writes the tint as each cell's fill and import restores the list. A name no row has is a 'table-highlight-unknown-name' error.",
          "required": [
            "rows"
          ],
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Key texts (the first cell of each body row, as text) of the rows to highlight."
            }
          },
          "examples": [
            {
              "rows": [
                "Southeast",
                "Southwest"
              ]
            }
          ]
        }
      }
    }