Skip to content

fix(pptx): use DrawingML tags when extracting slide tables - #30

Open
xusyang wants to merge 1 commit into
instax-dutta:mainfrom
xusyang:fix/pptx-drawingml-table-tags
Open

fix(pptx): use DrawingML tags when extracting slide tables#30
xusyang wants to merge 1 commit into
instax-dutta:mainfrom
xusyang:fix/pptx-drawingml-table-tags

Conversation

@xusyang

@xusyang xusyang commented Jul 28, 2026

Copy link
Copy Markdown

Problem

PptxConverter.extractTables() never finds any tables in real slides, so tables are silently dropped from the output.

Slide tables live in the DrawingML namespace (a:), but the extractor looked them up with presentation-namespace tags:

  • p:tbl → should be a:tbl
  • p:tr → should be a:tr
  • p:tc → should be a:tc

Additionally, gridSpan was read as a child element <a:gridSpan val="...">, while in DrawingML it is an attribute on <a:tc> (<a:tc gridSpan="2">), so colspans never resolved either.

Fix

  • Query a:tbl / a:tr / a:tc in extractTables().
  • Read gridSpan via tc.getAttribute("gridSpan").

Test

Added a unit test that builds a slide DOM containing an <a:tbl> (including a <a:tc gridSpan="2">) and asserts:

  • the table is found,
  • header row cells are extracted (["Name", "Score"]),
  • colspan: 2 is resolved from the gridSpan attribute.

The test fails on current main (table silently missing) and passes with this fix. pnpm vitest run packages/pptx → 5/5 passing; tsc --noEmit clean.

Slide tables live in the DrawingML namespace: rows/cells are
<a:tbl>/<a:tr>/<a:tc>, and gridSpan is an attribute on <a:tc> —
not a child element with a val attribute. The extractor looked up
p:tbl/p:tr/p:tc and a child <a:gridSpan>, so tables were silently
dropped and colspans never resolved.

Add a unit test that parses a slide DOM containing an a:tbl and
asserts rows, header cells, and the gridSpan colspan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant