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): first-column table parity honours style.body_text

hugohe3a42dbe150dc9
diff --git a/skills/ppt-master/scripts/docs/native-data.md b/skills/ppt-master/scripts/docs/native-data.md
index 778bccb6..dc20a2d2 100644
--- a/skills/ppt-master/scripts/docs/native-data.md
+++ b/skills/ppt-master/scripts/docs/native-data.md
@@ -23,7 +23,7 @@ Every payload carries that exact `schema`. Native tables are rectangular grids:
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 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.
+`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, and a first-column colour that neither the cell nor `style.body_text` resolves to.
**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/svg_to_pptx/native_objects/table.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
index ef2e5d35..c6414ca3 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
@@ -1086,7 +1086,15 @@ def _native_table_first_column_warnings(
table_rows: list[list[Any]],
header_rows: int,
text_cells: list[tuple[Any, int, int]],
+ *,
+ style_body_text: str | None = None,
) -> list[str]:
+ """Report first-column emphasis the payload would not carry.
+
+ A first column drawn in the table's own body text colour is carried by
+ ``style.body_text`` even when the other columns are coloured per cell, so
+ only a colour no layer resolves to is reported.
+ """
body_records = [item for item in text_cells if item[1] >= header_rows]
first_column = [item for item in body_records if item[2] == 0]
if not first_column:
@@ -1112,9 +1120,10 @@ def _native_table_first_column_warnings(
if (
record.fill is not None
and record.fill != body_color
- and _table_cell_parity_text_style(
- table_rows[row_idx][col_idx]
- )[1] != record.fill
+ and (
+ _table_cell_parity_text_style(table_rows[row_idx][col_idx])[1]
+ or style_body_text
+ ) != record.fill
)
})
if missing_colors:
@@ -1309,11 +1318,13 @@ def _native_table_warnings(
shape_records,
)
)
+ table_style = payload.get("style") if isinstance(payload.get("style"), dict) else {}
warnings.extend(
_native_table_first_column_warnings(
table_rows,
header_rows,
text_cells,
+ style_body_text=_hex_or_none(table_style.get("body_text")),
)
)
warnings.extend(
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 6a050829..408fc28f 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
@@ -523,6 +523,53 @@ class NativeTableFillAndTextDefaultsTests(unittest.TestCase):
))
self.assertNotIn("body text color", paragraph_strings)
+ def test_first_column_in_body_text_colour_is_carried_by_style(self) -> None:
+ def marker(style_json: str) -> ET.Element:
+ return ET.fromstring(f"""
+ <g data-pptx-replace-with="table" data-pptx-bounds="0 0 300 80">
+ <metadata type="application/json">
+ {{
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 0, "y": 0, "width": 300, "height": 80,
+ "header_rows": 1,
+ "column_widths": [100, 100, 100],
+ "row_heights": [40, 40],
+ {style_json}
+ "columns": [
+ {{"text": "Task", "color": "#F5F7F2", "align": "l"}},
+ {{"text": "Old", "color": "#F5F7F2", "align": "l"}},
+ {{"text": "uv", "color": "#F5F7F2", "align": "l"}}
+ ],
+ "rows": [[
+ "Create env",
+ {{"text": "venv", "color": "#9EACB8"}},
+ {{"text": "uv venv", "color": "#D7FF64"}}
+ ]]
+ }}
+ </metadata>
+ <line x1="0" y1="0" x2="300" y2="0" stroke="#3A4651"/>
+ <line x1="0" y1="40" x2="300" y2="40" stroke="#3A4651"/>
+ <line x1="0" y1="80" x2="300" y2="80" stroke="#3A4651"/>
+ <g fill="#F5F7F2">
+ <text x="10" y="25">Task</text>
+ <text x="110" y="25">Old</text>
+ <text x="210" y="25">uv</text>
+ </g>
+ <text x="10" y="65" fill="#E7ECEF">Create env</text>
+ <text x="110" y="65" fill="#9EACB8">venv</text>
+ <text x="210" y="65" fill="#D7FF64">uv venv</text>
+ </g>
+ """)
+
+ carried = "\n".join(native_object_projection_warnings(
+ marker('"style": {"body_text": "#E7ECEF"},')
+ ))
+ self.assertNotIn("first-column", carried)
+
+ uncarried = "\n".join(native_object_projection_warnings(marker("")))
+ self.assertIn("first-column text style not projected", uncarried)
+ self.assertIn("#E7ECEF", uncarried)
+
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]