Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(scripts): paragraph cells inherit defaults.run like plain text; header align parity reads the centred export default

hugohe37b76a53fbfd5
diff --git a/skills/ppt-master/scripts/docs/native-data.md b/skills/ppt-master/scripts/docs/native-data.md
index 9e1d06af..778bccb6 100644
--- a/skills/ppt-master/scripts/docs/native-data.md
+++ b/skills/ppt-master/scripts/docs/native-data.md
@@ -21,9 +21,9 @@ one child `<metadata type="application/json">` (attribute `data-pptx-json` is re
Every payload carries that exact `schema`. Native tables are rectangular grids: `columns` for the optional header row, `rows` for body rows (shorter rows padded unless `strict_grid: true`; at most 1000 resolved rows and columns); `column_widths` / `row_heights` are finite non-negative relative weights matching the grid with one positive value (a row's top and bottom padding shrink to what its resolved height can hold beside the text line, since PowerPoint would otherwise grow the row past the drawn one); `header_rows` is an integer in range; `strict_grid`, `style.band_row`, and `bold` are JSON booleans. Exact repetition may be factored into `defaults.cell` / `defaults.paragraph` / `defaults.run` and kebab-case `cell_styles` selected by `cell_style` (precedence: cell defaults → named style → cell fields; object-valued `padding` merges, everything else replaces; `<style>` and `class` remain forbidden).
-Cells accept `text`, `fill`, `fill_opacity`, `color`, `align` (`l` / `ctr` / `r`), `valign` (`top` / `middle` / `bottom`), `bold`, `font_size`, `padding` and side-specific `padding_*`, `border_color`, `border_width`, `borders`, `lang`, `anchor_center`, `horizontal_overflow`. Multi-paragraph text replaces `text` with a non-empty `paragraphs` list of strings or objects — empty paragraph strings are preserved as blank lines — (`align` plus exactly one of `text` or non-empty `runs`; runs carry required `text` and optional `bold`, `italic`, `underline`, `strike`, `color`, `font_size`, one-typeface `font_family`, `lang`, `alt_lang`); unknown fields, wrong types, empty runs, multi-typeface families, and unsupported colors fail. Per-side borders use `borders.left|right|top|bottom|diagonal_down|diagonal_up` as `{ "style": "none" }` or `{ "style": "solid", "color": "#RRGGBB", "width": <positive-px> }`, overriding a uniform `border_color` / `border_width` on style or cell. A missing `lang` derives `zh-CN` for CJK and `en-US` otherwise. `style.band_row: false` disables banding and materialized alternating fills. Typography mirrors the fallback: `style.font_family` and `style.font_size` from the drawn table text, `style.header_font_size` or per-cell `font_size` only where the fallback differs; with no explicit table font, Default uses the deck body family and anchor, Quick its active-context values.
+Cells accept `text`, `fill`, `fill_opacity`, `color`, `align` (`l` / `ctr` / `r`; header cells export centred unless `align` is set, so SVG-first parity reports a left- or right-anchored fallback header whose payload leaves `align` unset), `valign` (`top` / `middle` / `bottom`), `bold`, `font_size`, `padding` and side-specific `padding_*`, `border_color`, `border_width`, `borders`, `lang`, `anchor_center`, `horizontal_overflow`. Multi-paragraph text replaces `text` with a non-empty `paragraphs` list of strings or objects — empty paragraph strings are preserved as blank lines — (`align` plus exactly one of `text` or non-empty `runs`; runs carry required `text` and optional `bold`, `italic`, `underline`, `strike`, `color`, `font_size`, one-typeface `font_family`, `lang`, `alt_lang`); unknown fields, wrong types, empty runs, multi-typeface families, and unsupported colors fail. Per-side borders use `borders.left|right|top|bottom|diagonal_down|diagonal_up` as `{ "style": "none" }` or `{ "style": "solid", "color": "#RRGGBB", "width": <positive-px> }`, overriding a uniform `border_color` / `border_width` on style or cell. A missing `lang` derives `zh-CN` for CJK and `en-US` otherwise. `style.band_row: false` disables banding and materialized alternating fills. Typography mirrors the fallback: `style.font_family` and `style.font_size` from the drawn table text, `style.header_font_size` or per-cell `font_size` only where the fallback differs; with no explicit table font, Default uses the deck body family and anchor, Quick its active-context values.
-`style` accepts `font_family`, `font_size`, `header_font_size`, `band_row`, `padding`, `valign`, `border_color`, `border_width`, `lang`, `table_style_id`, and the table-wide colours `header_fill`, `header_text`, `body_fill`, `body_text`, `band_fill`. Fills are only what the payload resolves: a cell with no `fill` takes `style.header_fill` (header rows) or `style.band_fill` / `style.body_fill` (body rows), and when none of those is set it exports as `noFill` so the slide background shows through — the same as a fallback that draws no cell rect. Text colour never falls to nothing: a plain-text cell without `color` takes `defaults.run.color` (plain text is one run, so `defaults.run` `bold` / `color` / `font_size` reach it when the cell and `defaults.cell` leave them unset), then `style.body_text` / `style.header_text`, then `#1F2937` (`header_text` defaults to `#FFFFFF` only when `header_fill` is set). SVG-first parity reports a body text colour drawn in the fallback that none of those layers would carry.
+`style` accepts `font_family`, `font_size`, `header_font_size`, `band_row`, `padding`, `valign`, `border_color`, `border_width`, `lang`, `table_style_id`, and the table-wide colours `header_fill`, `header_text`, `body_fill`, `body_text`, `band_fill`. Fills are only what the payload resolves: a cell with no `fill` takes `style.header_fill` (header rows) or `style.band_fill` / `style.body_fill` (body rows), and when none of those is set it exports as `noFill` so the slide background shows through — the same as a fallback that draws no cell rect. Text colour never falls to nothing: a cell without `color` takes `defaults.run.color` (plain text is one run, and a `paragraphs` cell whose paragraphs are strings or `text` objects inherits the same way at cell level, so `defaults.run` `bold` / `color` / `font_size` reach both when the cell and `defaults.cell` leave them unset; `paragraphs[].runs` take the run defaults directly), then `style.body_text` / `style.header_text`, then `#1F2937` (`header_text` defaults to `#FFFFFF` only when `header_fill` is set). SVG-first parity reports a body text colour drawn in the fallback that none of those layers would carry.
**Hard rule — the table payload is complete**: a payload holding only `font_size` and a uniform border is not complete when the fallback draws a header band, row or column fills, first-column emphasis, non-uniform row heights, or sparse rules — every row, summary line, value, and cell style that must survive `--native-charts-and-tables` is in `columns` / `rows`, because fallback text is discarded on that route. Numeric or currency columns use cell objects with `align: "r"` (`text-anchor="end"` does not carry). **Merged cells — canonical rectangular contract only**: positive integer `row_span` / `col_span` on the anchor, every covered cell blank as `{"merge_continuation": true}` (a bare `{"text": ""}` is blank only while no `defaults.cell` adds fields), spans inside the grid and non-overlapping; the exporter writes `rowSpan` / `gridSpan` / `hMerge` / `vMerge`. CamelCase aliases, raw OOXML merge fields, top-level merge lists, nonblank covered cells, invalid spans, and overlaps fail.
diff --git a/skills/ppt-master/scripts/semantic_table.py b/skills/ppt-master/scripts/semantic_table.py
index f899f15d..c4e30986 100644
--- a/skills/ppt-master/scripts/semantic_table.py
+++ b/skills/ppt-master/scripts/semantic_table.py
@@ -235,12 +235,13 @@ def _expand_cell(
style = cell_styles[style_name]
expanded = _format_layers(defaults["cell"], style, cell)
- if "paragraphs" not in expanded:
- # A plain-text cell is one run: run defaults reach it unless the
- # cell (or its cell_style / cell defaults) already set the field.
- for field in _PLAIN_TEXT_RUN_FIELDS:
- if field not in expanded and field in defaults["run"]:
- expanded[field] = copy.deepcopy(defaults["run"][field])
+ # A plain-text cell is one run, and a text-only paragraph is one run in
+ # the cell's colour: run defaults reach both through the cell unless the
+ # cell (or its cell_style / cell defaults) already set the field. Runs
+ # spelled out under paragraphs[].runs take the same defaults directly.
+ for field in _PLAIN_TEXT_RUN_FIELDS:
+ if field not in expanded and field in defaults["run"]:
+ expanded[field] = copy.deepcopy(defaults["run"][field])
if "paragraphs" in expanded:
paragraphs = expanded["paragraphs"]
if not isinstance(paragraphs, list):
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
index 5933cd6d..ef2e5d35 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
@@ -949,12 +949,20 @@ def _native_table_header_warnings(
for record, row_idx, col_idx in header_text_cells
):
missing.append("columns[].bold")
- if any(
- _cell_payload(table_rows[row_idx][col_idx]).get("align")
- != _fallback_table_alignment(record.anchor)
+ # Header cells export centred unless the payload sets align, so a missing
+ # align only matches a fallback whose header text is centred.
+ unmatched_anchors = sorted({
+ _fallback_table_alignment(record.anchor)
for record, row_idx, col_idx in header_text_cells
- ):
- missing.append("columns[].align")
+ if (_cell_payload(table_rows[row_idx][col_idx]).get("align") or "ctr")
+ != _fallback_table_alignment(record.anchor)
+ })
+ if unmatched_anchors:
+ missing.append(
+ "columns[].align "
+ + "/".join(f'"{value}"' for value in unmatched_anchors)
+ + " (header cells export centred unless align is set)"
+ )
if not missing:
return []
return [
diff --git a/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py b/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py
index c7286e8f..6a050829 100644
--- a/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py
+++ b/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py
@@ -448,6 +448,25 @@ class NativeTableFillAndTextDefaultsTests(unittest.TestCase):
# defaults.cell wins over defaults.run for a shared field
self.assertEqual(body_a["font_size"], 20)
+ def test_paragraph_cells_inherit_run_defaults_like_plain_text(self) -> None:
+ expanded = expand_semantic_table_payload({
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 0, "y": 0, "width": 200, "height": 80,
+ "column_widths": [100, 100],
+ "row_heights": [40, 40],
+ "defaults": {"run": {"color": "#1F2933", "bold": False}},
+ "columns": ["A", "B"],
+ "rows": [[
+ {"paragraphs": ["line one", "line two"]},
+ {"paragraphs": [{"runs": [{"text": "run"}]}], "color": "#B4342C"},
+ ]],
+ })
+ strings, runs = expanded["rows"][0]
+ self.assertEqual(strings["color"], "#1F2933")
+ self.assertFalse(strings["bold"])
+ self.assertEqual(runs["color"], "#B4342C")
+ self.assertEqual(runs["paragraphs"][0]["runs"][0]["color"], "#1F2933")
+
def test_body_text_color_parity_warns_when_no_layer_carries_it(self) -> None:
def marker(rows_json: str, style_json: str = "") -> ET.Element:
return ET.fromstring(f"""
@@ -496,6 +515,61 @@ class NativeTableFillAndTextDefaultsTests(unittest.TestCase):
))
self.assertNotIn("body text color", via_run_defaults)
+ paragraph_strings = "\n".join(native_object_projection_warnings(
+ marker(
+ '[{"paragraphs": ["Altar"]}, {"paragraphs": ["Cosmos"]}]',
+ '"defaults": {"run": {"color": "#DAD5CA"}},',
+ )
+ ))
+ self.assertNotIn("body text color", paragraph_strings)
+
+ def test_header_align_parity_reads_the_centred_export_default(self) -> None:
+ def marker(header_anchor: str, columns_json: str) -> ET.Element:
+ x = {"start": 10, "middle": 50, "end": 90}[header_anchor]
+ return ET.fromstring(f"""
+ <g data-pptx-replace-with="table" data-pptx-bounds="0 0 200 80">
+ <metadata type="application/json">
+ {{
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 0, "y": 0, "width": 200, "height": 80,
+ "header_rows": 1,
+ "column_widths": [100, 100],
+ "row_heights": [40, 40],
+ "defaults": {{"run": {{"color": "#DAD5CA"}}}},
+ "columns": [{columns_json}],
+ "rows": [["Altar", "Cosmos"]]
+ }}
+ </metadata>
+ <line x1="0" y1="0" x2="200" y2="0" stroke="#999999"/>
+ <line x1="0" y1="40" x2="200" y2="40" stroke="#999999"/>
+ <line x1="0" y1="80" x2="200" y2="80" stroke="#999999"/>
+ <g fill="#DAD5CA" text-anchor="{header_anchor}">
+ <text x="{x}" y="25">Level</text>
+ <text x="{x + 100}" y="25">Meaning</text>
+ </g>
+ <g fill="#DAD5CA">
+ <text x="10" y="65">Altar</text>
+ <text x="110" y="65">Cosmos</text>
+ </g>
+ </g>
+ """)
+
+ left_without_align = "\n".join(native_object_projection_warnings(
+ marker("start", '"Level", "Meaning"')
+ ))
+ self.assertIn('columns[].align "l"', left_without_align)
+ self.assertIn("export centred unless align is set", left_without_align)
+
+ left_with_align = "\n".join(native_object_projection_warnings(
+ marker("start", '{"text": "Level", "align": "l"}, {"text": "Meaning", "align": "l"}')
+ ))
+ self.assertNotIn("columns[].align", left_with_align)
+
+ centred_without_align = "\n".join(native_object_projection_warnings(
+ marker("middle", '"Level", "Meaning"')
+ ))
+ self.assertNotIn("columns[].align", centred_without_align)
+
if __name__ == "__main__":
unittest.main()