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): native tables export unfilled cells as noFill and carry defaults.run colour into plain-text cells
hugohe38295ca1416ad
diff --git a/skills/ppt-master/scripts/docs/native-data.md b/skills/ppt-master/scripts/docs/native-data.mdindex b0ef67be..21b61a52 100644--- a/skills/ppt-master/scripts/docs/native-data.md+++ b/skills/ppt-master/scripts/docs/native-data.md@@ -23,6 +23,8 @@ Every payload carries that exact `schema`. Native tables are rectangular grids: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.+`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.+**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.## §2 Chart schemasdiff --git a/skills/ppt-master/scripts/semantic_table.py b/skills/ppt-master/scripts/semantic_table.pyindex fffb1b1a..f899f15d 100644--- a/skills/ppt-master/scripts/semantic_table.py+++ b/skills/ppt-master/scripts/semantic_table.py@@ -79,6 +79,7 @@ _PARAGRAPH_DEFAULT_FIELDS = ("line_spacing_percent",)_PARAGRAPH_FIELDS = set(_PARAGRAPH_DEFAULT_FIELDS) | {"text", "runs"}+_PLAIN_TEXT_RUN_FIELDS = ("bold", "color", "font_size")_RUN_DEFAULT_FIELDS = ("bold","italic",@@ -234,6 +235,12 @@ 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])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.pyindex bfa7a84f..9cad4549 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@@ -1034,6 +1034,44 @@ def _native_table_fill_warnings(return warnings+def _native_table_body_text_warnings(+ payload: dict[str, Any],+ table_rows: list[list[Any]],+ header_rows: int,+ text_cells: list[tuple[Any, int, int]],+) -> list[str]:+ """Report fallback body text colours the payload would not carry."""+ style = payload.get("style") if isinstance(payload.get("style"), dict) else {}+ style_body_text = _hex_or_none(style.get("body_text"))+ body_records = [item for item in text_cells if item[1] >= header_rows]+ if not body_records:+ return []+ body_colors = [+ record.fill+ for record, _, col_idx in body_records+ if col_idx != 0 and record.fill+ ]+ body_color = max(set(body_colors), key=body_colors.count) if body_colors else None+ missing_colors: set[str] = set()+ for record, row_idx, col_idx in body_records:+ if record.fill is None:+ continue+ if col_idx == 0 and record.fill != body_color:+ continue # first-column emphasis is reported separately+ cell_color = _table_cell_parity_text_style(table_rows[row_idx][col_idx])[1]+ if cell_color is None:+ cell_color = style_body_text+ if cell_color != record.fill:+ missing_colors.add(record.fill)+ if not missing_colors:+ return []+ return [+ "Native PPTX table body text color "+ + "/".join(f"#{color}" for color in sorted(missing_colors))+ + " is not projected to cell color, defaults.run.color, or style.body_text"+ ]++def _native_table_first_column_warnings(table_rows: list[list[Any]],header_rows: int,@@ -1268,6 +1306,14 @@ def _native_table_warnings(text_cells,))+ warnings.extend(+ _native_table_body_text_warnings(+ payload,+ table_rows,+ header_rows,+ text_cells,+ )+ )warnings.extend(_native_table_border_topology_warnings(payload,@@ -1619,11 +1665,18 @@ def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[strpreserve_source_style = native_import_source(elem) == "pptx"style = payload.get("style") if isinstance(payload.get("style"), dict) else {}- header_fill = _clean_hex(style.get("header_fill"), "#1F4E79")- header_text = _clean_hex(style.get("header_text"), "#FFFFFF")- body_fill = _clean_hex(style.get("body_fill"), "#FFFFFF")+ # Fills are only what the payload says: a cell that resolves to no fill+ # exports as noFill so the slide background shows through, matching a+ # fallback that draws no cell rect. Text colour keeps a legible default+ # because an invisible run is worse than a wrong one.+ header_fill = _hex_or_none(style.get("header_fill"))+ body_fill = _hex_or_none(style.get("body_fill"))+ band_fill = _hex_or_none(style.get("band_fill"))body_text = _clean_hex(style.get("body_text"), "#1F2937")- band_fill = _clean_hex(style.get("band_fill"), "#F3F6FA")+ header_text = _clean_hex(+ style.get("header_text"),+ "#FFFFFF" if header_fill is not None else body_text,+ )font_face = str(style["font_family"]) if style.get("font_family") else Nonebody_font_size = _font_size_hpt(style.get("font_size"), 18)band_rows_enabled = _table_bool(@@ -1709,14 +1762,17 @@ def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[str)align = str(cell_data.get("align") or "l")else:- fill = _clean_hex(- cell_data.get("fill"),- header_fill if is_header else (- band_fill- if band_rows_enabled and row_idx % 2 == 0 and row_idx- else body_fill- ),- )+ fill = _hex_or_none(cell_data.get("fill"))+ if fill is None:+ banded = (+ band_rows_enabled+ and band_fill is not None+ and row_idx % 2 == 0+ and row_idx+ )+ fill = header_fill if is_header else (+ band_fill if banded else body_fill+ )color = _clean_hex(cell_data.get("color"),header_text if is_header else body_text,@@ -1845,11 +1901,14 @@ def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[strstyle,ctx.theme_color_spec,)- fill_xml = _table_fill_xml(- fill,- _table_fill_opacity(cell_data),- ctx.theme_color_spec,- )+ if fill is None and not preserve_source_style:+ fill_xml = "<a:noFill/>"+ else:+ fill_xml = _table_fill_xml(+ fill,+ _table_fill_opacity(cell_data),+ ctx.theme_color_spec,+ )cells_xml.append(f"<a:tc{merge_attrs}>""<a:txBody><a:bodyPr/><a:lstStyle/>"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.pyindex 632abc47..bf5d67ef 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@@ -25,6 +25,7 @@ from svg_to_pptx.native_objects.table import ( # noqa: E402_table_border_xml,_validate_table_payload,)+from semantic_table import expand_semantic_table_payload # noqa: E402from svg_to_pptx.pptx_package.cli import ( # noqa: E402_native_object_projection_findings,)@@ -423,5 +424,78 @@ class NativeTablePayloadRoundTripTest(unittest.TestCase):expand_semantic_table_payload(payload) # must still expand cleanly+class NativeTableFillAndTextDefaultsTests(unittest.TestCase):+ def test_plain_text_cell_inherits_run_defaults(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": {+ "cell": {"font_size": 20},+ "run": {"color": "#DAD5CA", "bold": True, "font_size": 16},+ },+ "columns": ["A", {"text": "B", "color": "#FFFFFF"}],+ "rows": [["a", {"text": "b", "bold": False}]],+ })+ header_a, header_b = expanded["columns"]+ body_a, body_b = expanded["rows"][0]+ self.assertEqual(header_a["color"], "#DAD5CA")+ self.assertEqual(header_b["color"], "#FFFFFF")+ self.assertEqual(body_a["color"], "#DAD5CA")+ self.assertTrue(body_a["bold"])+ self.assertFalse(body_b["bold"])+ # defaults.cell wins over defaults.run for a shared field+ self.assertEqual(body_a["font_size"], 20)++ 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"""+ <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],+ {style_json}+ "columns": [+ {{"text": "Level", "color": "#98A0A9"}},+ {{"text": "Meaning", "color": "#98A0A9"}}+ ],+ "rows": [{rows_json}]+ }}+ </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="#98A0A9">+ <text x="10" y="25">Level</text>+ <text x="110" y="25">Meaning</text>+ </g>+ <g fill="#DAD5CA">+ <text x="10" y="65">Altar</text>+ <text x="110" y="65">Cosmos</text>+ </g>+ </g>+ """)++ bare = "\n".join(native_object_projection_warnings(+ marker('["Altar", "Cosmos"]')+ ))+ self.assertIn("body text color #DAD5CA is not projected", bare)++ via_style = "\n".join(native_object_projection_warnings(+ marker('["Altar", "Cosmos"]', '"style": {"body_text": "#DAD5CA"},')+ ))+ self.assertNotIn("body text color", via_style)++ via_run_defaults = "\n".join(native_object_projection_warnings(+ marker('["Altar", "Cosmos"]', '"defaults": {"run": {"color": "#DAD5CA"}},')+ ))+ self.assertNotIn("body text color", via_run_defaults)++if __name__ == "__main__":unittest.main()