Docling OCRIndependent Docling guide

Table output

When Docling's table output is wrong

TableFormer gets most tables right and fails in a small number of recognisable ways. Knowing which one you are looking at decides whether a flag will fix it or whether the page needs a person.

Updated 2026-11-01 · 3 min read

The short version

  • –A collapsed column almost always means the wrong PDF backend: docling-parse keeps a 15-column table at 15 columns where a pdfium-based backend reports 5.
  • –Merged cells are the second commonest failure. DOCX and XLSX exports can carry real spans; Markdown cannot, so a merge becomes a repeated value or an empty cell.
  • –A row that vanishes is nearly always a page break: the continuation page has no header, so the reader starts a new table and loses the alignment.
  • –None of these are visible in the text. You find them by counting columns and rows against the page, which is what the last section is about.

Four failures, and the signature of each

Docling reconstructs a table as a grid of cells with coordinates, then writes that grid out. Every failure below happens at the reconstruction step, before anything is exported, so the same fault appears in Markdown, JSON and XLSX alike.

FailureHow it shows in the outputUsual cause
A column collapsed into anotherA 12-column table exports with 6 columns; two values sit in one cell separated by a spaceThe PDF backend, or a table with no vertical rules that was read as prose
Two cells mergedOne cell holds what should be two values; the row below is short by oneCell matching over-reaching, which happens more often in dense financial tables
A row missing at a page breakThe table has one row fewer than the page, and the numbers below the break belong to the next pageThe continuation page had no header row, so it was read as a new table
The header read as dataThe first data row is a repeat of the column names, and sums doubleA header that spans two lines, or a repeated header on a second page
What goes wrong, what it looks like, and the usual cause

The backend matters more than any flag

On the same arXiv paper, two PDF backends disagree by an order of magnitude on column count. With docling-parse, the table has 2, 14, 3, 2 and 2 columns across its five tables, which is what the paper prints. With a pdfium-based backend the same tables come out as 2, 5, 1, 1 and 2 — a 15-column table collapsed to 5, a 3-column table to 1, whole rows of numbers pushed into one cell.

That is why switching backends is the first thing to try when a table is wrong, and why image scale and model size are the wrong places to look: neither changes the column count in that test.

Python — pin the parser before blaming the model
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.backend.docling_parse_backend import DoclingParseDocumentBackend

opts = PdfPipelineOptions()
opts.do_table_structure = True
opts.table_structure_options.do_cell_matching = True   # measured better than False

conv = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(
        pipeline_options=opts, backend=DoclingParseDocumentBackend)}
)
doc = conv.convert("report.pdf").document
print(doc.export_to_markdown())

Cell matching: leave it on

TableFormer predicts cell boundaries geometrically and then matches the text it read to those boundaries. With matching on, the model fills the grid it predicted. With it off, the raw text keeps its own arrangement, which sounds safer and measured worse: in our test a 7-column table came out with 8 columns, the header repeated, and an extra empty row.

One exception is a known case where a PDF stores an entire row of numbers as a single text object. A second pass at a higher image scale with matching disabled recovers those rows; running that pass on every page, rather than on the failures, is what makes it cheap.

Model size is not the lever people assume

The table structure model is available in a fast and an accurate configuration, and the larger one is not automatically better on every document. On a Chinese bank statement, the two read the same values; the difference was that the larger model kept spaces inside a cell that had swallowed two adjacent columns. On an English bank statement, a newer generation of the model swallowed the entire date column into the description, which is why the older, slower generation is still the one in use.

The lesson generalises: a table failure is a structural problem, and structural problems are settled by looking at the page, not by turning a dial until the numbers look familiar.

How to tell which failure you have

1

Count the columns against the page

One column missing is a collapse; two cells in one is a merge. Both are visible without reading any value.

2

Count the rows

A table with one row fewer than the page has lost a row at a continuation, or read a wrapped cell as part of its neighbour.

3

Look at the page break

If the fault is at a page boundary, the fix is about headers and continuation, not about the model.

4

Then check the figures

Only after the grid is right does the value check mean anything. A right number in the wrong column is still wrong.

Frequently asked questions

Why does Docling collapse columns?+

Most often the PDF backend. Backends differ in how they cut a page into text blocks, and a table with faint rules can be handed to TableFormer as one wide block, which then reads as one column. Pinning docling-parse is the first thing to test.

Can Docling keep merged cells?+

It predicts them, and the DOCX and XLSX exports can carry real spans. Markdown has no merge syntax, so a merge becomes a repeated value or an empty cell there; the underlying grid in the JSON still holds the span.

Why is a row missing after a page break?+

Because the continuation page usually has no header, so the grid on that page has no columns to align to and is read as a separate table, sometimes dropped or merged into the paragraph text.

Does a bigger model fix a wrong table?+

Not reliably. In our measurements the larger table model changed spacing inside cells and occasionally merged adjacent columns where the smaller one did not. A structural fault is fixed by the page and the backend, not by the model size.

Try it online

Run the same pipeline in the browser — no install, no uploads stored.

Try it in the browser

Keep reading