Skip to content

A table on a slide is read one cell per line #1023

Closed

Description

@Maya-Kid

#750 laid DOCX, spreadsheet and CSV tables on the grid that #744 built for HTML, so a table reaches the chunker with its header and its rows. A table on a slide was not part of it.

parsers::pptx reads a slide with extract_xml_text(&xml, "a:t", "a:p"). That collects the text of every paragraph in document order, and a table cell's text is paragraphs (a:tbl › a:tr › a:tc › a:txBody › a:p). So each cell becomes a line, and the table's shape is gone.

What happens (dev 798fb24)

A slide with a title and a 3 × 4 table, in the p:graphicFrame › a:tbl shape PowerPoint writes, reads:

## Slide 1
2024 年各季度营收
季度
营收(万元)
同比
Q1
1,200
+12%
Q2
1,350
+9%
Q3
1,410
+7%

The same table in a Word file reads:

| 季度 | 营收(万元) | 同比 |
| --- | --- | --- |
| Q1 | 1,200 | +12% |
| Q2 | 1,350 | +9% |
| Q3 | 1,410 | +7% |

From the slide, the model sees twelve short lines. Which figure is Q2's growth is left to it to guess, and the block parser sees no table, so the rules of #744 do not apply:

  • a continuation repeats the header;
  • a caption travels with the table;
  • a row is never split.

Decks carry much of an organisation's numbers this way: quarterly results, KPIs, plans.

What I think is right

Read a:tbl into the same grid the DOCX parser builds (table::render_grid), and leave the text outside tables as it is:

  • Each a:tr is a row, and each a:tc a cell whose text is its paragraphs joined by spaces, as in a DOCX cell.
  • gridSpan is the cell's span.
  • A cell covered by a horizontal merge (hMerge="1") is skipped, since the span already covers it.
  • A cell covered by a vertical merge (vMerge="1") stays empty, as DOCX's w:vMerge continuation does.
  • a:tblPr firstRow="1" means PowerPoint styles the first row as a header. It could pass first_is_header; without it the rows are classified by what they hold.

Since this is a new reading of a format rather than a fix, I'm asking before writing it. I'm glad to take it if the direction is right.

Activity

  1. WaylandYang commented on Oct 1, 2026

    @WaylandYang
    Contributor

    Fixed by #1042, merged into dev as 62e49ed. Thanks @Harbor404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions