fix(pptx): use DrawingML tags when extracting slide tables - #30
Open
xusyang wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bea:tblp:tr→ should bea:trp:tc→ should bea:tcAdditionally,
gridSpanwas 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
a:tbl/a:tr/a:tcinextractTables().gridSpanviatc.getAttribute("gridSpan").Test
Added a unit test that builds a slide DOM containing an
<a:tbl>(including a<a:tc gridSpan="2">) and asserts:["Name", "Score"]),colspan: 2is resolved from thegridSpanattribute.The test fails on current
main(table silently missing) and passes with this fix.pnpm vitest run packages/pptx→ 5/5 passing;tsc --noEmitclean.