Repository navigation
PDF to Word: keep a ruled table whose text runs past a cell - #986
Merged
Merged
Conversation
A spreadsheet printed to PDF cuts long text off at its cell, and the PDF only clips the rest, so the hidden part still reads as part of the word. That word then sat across the cell's right rule, and the table finder took any rule through a word as a sign of a chart, dropping the whole 40-row measurement table from #138 to plain text. A word that runs on past a vertical rule now stays in the cell it starts in, for up to one in twenty words of the grid (at least one). A rule through a word's height (a strike-through) still means no table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #138. The sample from @cache51 there (
input_p2.pdf, a garment measurement sheet printed from a spreadsheet) has every cell ruled, yet PDF → DOCX gave no table: 63 loose paragraphs.Cause
The grid was found (40 rows × 17 columns), then thrown away because of one word. "Front NK Drop (from HPS to Edge)@ COLLAR NOTCH" is longer than its column:
Change
PdfDocumentReader.Tables:Result on the sample
1/8and3 1/2Merged cells, shading and the heavy frame come through too. Still different from the PDF, not part of this fix:
Test
PdfTableTests.Long_text_running_past_its_cell_stays_in_that_celldraws a 4 × 3 grid in code, with one label whose last word straddles its cell's right rule. It checks that the label, its tolerance and its value each land in their own cell. The 27 existing PDF table tests still pass, including Boxes, underlines and empty grids stay text.🤖 Generated with Claude Code