The Invisible Assumption
Most business documents start as Office files: DOCX, PPTX, XLSX. Yet the usual approach is to export to PDF, then parse. That throws away structured data, then spends compute trying to recover it.
A DOCX file is a ZIP archive of structured XML, defined by the ECMA-376 standard. Track changes carry an author and a timestamp. Tables say which cells are merged. Comments are threaded. Each section has its own headers and footers. All of this is right there in the XML.
What Gets Lost
| Feature | Direct XML Parsing | After PDF Conversion |
|---|---|---|
| Track changes | Author, date and change type kept | Lost. You get the accepted or the rejected view only |
| Merged cells | Exact colspan/rowspan, read from the XML | Flattened, or guessed wrongly from the layout |
| Comments | Author, thread and the text each comment is attached to | Dropped |
| Headers / footers | Kept per section, with first, even and odd pages separate | Mixed into body text or ignored |
| Text boxes | Position, content and stacking order kept | Lost or garbled |
| Metadata | Title, author, dates, keywords, revision count | Stripped or only partly kept |
| Footnotes | Numbered and linked to where they are cited | Detached from the text they belong to |
| Hyperlinks | Link text together with its URL | Blue text only. The URL is lost |
Why Parsers Use PDF
The OOXML specification is over 5,000 pages. Track changes alone span several XML namespaces, with moves and ranges that cross paragraph boundaries. Merged cells in DOCX tables do not work like HTML colspan: they use vMerge and gridSpan attributes that point to a separate grid definition. Numbered lists are worked out through several layers of numbering definitions and style overrides.
Writing a correct parser from scratch is a very large job. The cheaper choice was to convert to PDF, which LibreOffice already does, and parse the PDF, which has mature tools. Losing the structure was the price.
What changed
AILANG made it practical. AI agents write the parsing code from the ECMA-376 spec, and Z3 formal verification catches edge cases that manual testing would miss. The result: 63 verified contracts across 31 modules.
The same process handles new cases. When a new OOXML edge case turns up, an AI agent reads the relevant part of the spec and writes the parsing code, and Z3 checks it against its contracts. A fix takes hours, not weeks.
The Numbers
OfficeDocBench is an open benchmark built for Office document parsing. It tests track changes, merged cells, comments, headers and footers, text boxes, images and metadata across 87 test files in 11 formats.
How parsers compare:
Overall score, counting files a tool cannot read as zero:
Most of the gap comes from track changes, merged cells, comments and the formats most tools skip. These are the features that don't survive PDF conversion.
We build against this benchmark: the tests come first, and the parser is written to pass them. So 95.0% is the score we work towards, not a hand-picked result. How we build against the benchmark →
Works Alongside Your Existing Pipeline
AILANG Parse reads Office formats directly from XML. For PDFs, scanned documents, and images, tools like Unstructured, Docling, and LlamaParse have mature OCR pipelines and layout analysis.
Many tools return the text of an Office file without its tracked changes, comments or notes, and some skip Office formats altogether. AILANG Parse keeps that structure. Use it on its own or next to your existing PDF pipeline.
With Unstructured
Send DOCX, PPTX and XLSX to AILANG Parse. Send PDFs to Unstructured for layout analysis. Combine the results into one list of blocks.
With Docling
Use AILANG Parse for Office formats. Use Docling for scientific papers and documents that start as PDF, where its table detection is strong.
With LlamaParse
Parse Office files locally with AILANG Parse, with no API calls. Send only PDFs and images to LlamaParse's cloud API, which cuts cost and waiting time.
Standalone
AILANG Parse also reads PDFs: without AI when they contain text, and with an AI model you choose (Gemini, Claude or a local Ollama model) for scans. One tool for every format.
See for Yourself
Upload a DOCX with track changes, or an XLSX with merged cells, or a PPTX with speaker notes. Compare the output to what your current parser returns. The structural data is either there or it is not.
Frequently Asked Questions
Why does converting DOCX to PDF lose data?
A DOCX is structured XML. Converting it to PDF keeps only how the page looks, so track changes, merged-cell information and comments are lost. AILANG Parse reads the XML directly.
How should I parse Office documents for a RAG pipeline?
AILANG Parse returns typed blocks that keep heading levels, table structure and metadata. That gives cleaner chunks than flat text.
Is DOCX or PDF better for AI ingestion?
DOCX is better when the source was written in Word or Google Docs. AILANG Parse reads the DOCX XML directly, with no AI calls and no per-page billing. PDF conversion pipelines run OCR on every page and lose structure such as merged cells, track changes and comments.
What problems does PDF conversion cause for LLM document processing?
PDF conversion flattens tables, drops track changes and makes reading order unreliable. AILANG Parse avoids all three by reading the Office XML directly.
What is structural document extraction?
It means keeping a document's structure (headings, table cells, merged cells, tracked changes), not just its text. AILANG Parse returns typed blocks, so a heading, a table and a tracked change each come back as their own kind of element.