docboss.dev

Examples

The file, and the pages docboss drew from it.

Every page on this page was rendered by the docboss CLI at scale 2 from a file committed to the docboss repository, with no manual step; some are cropped to the part with content. Next to each is what docboss extracts from the same file. The second half shows before and after renders of layout bugs fixed in docboss.

Word 95

A two-page price list from 1999.

word95-tables.doc is Apache POI’s Bug49933.doc (Apache License 2.0), saved by Microsoft Word for Windows 95. docboss reads Word 6 and 95 files with their formatting, sections, headers, footers and tables, and guesses the Cyrillic code page from the bytes, which it reports as an approximation.

~/examples
$ docboss info word95-tables.doc
format:          DOC (Word 97-2003 binary)
title:           Вина Молдовы для Вас!!!
subject:         прайс-лист
author:          Aндрей
last author:     A
revision:        1
created:         1999-09-30T01:48:00Z
modified:        1999-10-28T15:28:00Z
application:     Microsoft Word for Windows 95
company:         Aскат М
pages:           2
sections:        1
page size:       595.3 x 841.9 pt
paragraphs:      232
tables:          4
styles:          30
headers/footers: 0
footnotes:       0
endnotes:        0
comments:        0
images:          0
fonts:           5
diagnostics:     0 dropped, 1 approximated
$ docboss diagnostics word95-tables.doc
approximated WordDocument: text decoded as code page 1251, guessed from its bytes
Page 1 of the Word 95 price list rendered by docboss
Page 2 of the Word 95 price list rendered by docboss

DOCX written by LibreOffice

Header, footnote, endnote, comment, list and table.

libreoffice-rich.docx is a fixture converted from a .fodt source with soffice --headless --convert-to docx. The render shows the top of page 1: the running header, the bold run, the footnote mark, the picture, the bullets in StarOffice’s starbats font and the endnote.

~/examples
$ docboss text libreoffice-rich.docx --headers-footers --comments
Running header
Fixture Heading
Text with bold words and a note[1] here.
Commented[c1] word.
Picture:
• Item one
• Item two
A1	B1
Span
Endnote section
Ends here[i].
Page 1

[1] Footnote text.
[i] Endnote text.

[c1] Reviewer: A comment body.
The top of page 1 of libreoffice-rich.docx rendered by docboss: a header, a heading, a red picture, a bulleted list, a table and an endnote

Floating objects

Text wrapped around pictures, a frame and a table.

wrap.docx is written by a script in the docboss repository: pictures wrapped square and tight, a text frame, a floating table and a VML shape wrapped top and bottom. Body text wraps around each of them, and diagnostics --layout reports nothing approximated.

~/examples
$ docboss text wrap.docx
Text flows around the floating objects of this document. Text flows ...
Text flows around the floating objects of this document. Text flows ...
A text frame at the right margin.
Text flows around the floating objects of this document. Text flows ...
a0	b0
a1	b1
a2	b2
Text flows around the floating objects of this document. Text flows ...
$ docboss diagnostics wrap.docx --layout
$ echo $?
0
wrap.docx rendered by docboss: paragraphs of text flowing around two red pictures, a text frame at the right margin, a small floating table and a blue shape

DOCX written by macOS

Lists, a link and a table from TextEdit.

textutil-lists.docx was written by macOS’s textutil from an HTML file. Its headings are bold paragraphs with no heading style and its list labels are literal text, so the Markdown keeps them as bold paragraphs and text labels: docboss writes what the file states.

~/examples
$ docboss md textutil-lists.docx
**Main Heading**

A paragraph with **bold**, *italic* and a link. Ümlauts & ünïcödé — “quotes”.

**Lists**

• First bullet

• Second bullet

◦ Nested bullet

1 One

2 Two

3 Three

**Table**
textutil-lists.docx rendered by docboss: a heading, a paragraph with bold, italic and a blue link, bulleted and numbered lists and a table

Failure modes

Fifteen layout bugs, before and after the fix.

Each pair is docboss render at the parent of the commit that fixed the bug and at the commit, mostly on files from the LibreOffice and Apache POI test corpora. SSIM is scored against LibreOffice’s rendering of the same file. The descriptions are condensed from failure-modes/README.md.

before
Shape fills from the theme, before the fix
after
Shape fills from the theme, after the fix
Shape fills from the theme. 52a6825 A text box with no fill of its own takes it from wps:style, a theme slot such as accent1, and neither that nor a:schemeClr was resolved. LibreOffice's LineStyle_DashType.docx now paints its rectangles blue with red outlines. SSIM 0.7461 to 0.9779.
before
Line height of single spacing, before the fix
after
Line height of single spacing, after the fix
Line height of single spacing. d0a7e13 Single-spaced 12 pt Arial and Times New Roman lines came out 13.4 pt where Word and LibreOffice set 13.8 pt, so every page held about one line more. Apache POI's Bug50936_1.doc: its first five pages score 0.47, 0.46, 0.39, 0.38, 0.69 before and 0.98, 0.80, 0.97, 0.97, 0.97 after.
before
Tables wider than the text area, before the fix
after
Tables wider than the text area, after the fix
Tables wider than the text area. 492fa76 Autofit tables wider than the text area were scaled down to fit, which neither Word nor LibreOffice does. Apache POI's Bug47287.doc wrapped its first column and ran to 2 pages where LibreOffice sets 1. Grids now keep their widths: 1 page, SSIM 0.647 to 0.683.
before
Table style paragraph properties, before the fix
after
Table style paragraph properties, after the fix
Table style paragraph properties. ea482a4 A table style's paragraph and run properties never reached the paragraphs in its cells. LibreOffice's tdf64264.docx has a 40-row table with no spacing after; every row took the document defaults' spacing and the table ran to 4 pages where LibreOffice sets 2. Now 2 pages.
before
Text boxes laid out, before the fix
after
Text boxes laid out, after the fix
Text boxes laid out. 15fd825 Text box content was read but never laid out: every text box painted a grey placeholder with a cross. On the floating.doc fixture the two lines now sit inside the shape's insets, with its white fill and black 0.75 pt line. SSIM 0.9888 to 0.9982.
before
Calibri and Cambria substitutes, before the fix
after
Calibri and Cambria substitutes, after the fix
Calibri and Cambria substitutes. 4a16833 Calibri resolved to Arial and Cambria to Times New Roman when Carlito and Caladea were not in a system font directory, so every line broke at a different word. With LibreOffice's and macOS's font directories searched, cell-grid-span.docx goes from SSIM 0.547 to 0.683.
before
Word 2000 table borders, before the fix
after
Word 2000 table borders, after the fix
Word 2000 table borders. 2f78cdd A TC80 cell border of four zero bytes states nothing, but was read as an explicit none border, so Bug47287.doc's 14-row form drew no rules. The borders now show as in LibreOffice; SSIM falls slightly (0.672 to 0.647) because the row heights do not yet match LibreOffice's.
before
Auto-fit text boxes shrink, before the fix
after
Auto-fit text boxes shrink, after the fix
Auto-fit text boxes shrink. 8ee5700 a:spAutoFit only grew a shape too short for its text. In LibreOffice's autofit.docx the auto-fit box holding one line was drawn 139 pt tall; it now shrinks to its line plus insets, and the a:noAutofit box keeps its height. SSIM 0.9794 to 0.9843.
before
Pictures and line spacing, before the fix
after
Pictures and line spacing, after the fix
Pictures and line spacing. 0d1f78e Auto line spacing multiplied the whole line, so a line holding a 173.25 pt picture grew by 1.15 as well and the picture was drawn 26 pt too low. Word scales only the text part of a line; the picture now sits at the top of its box. SSIM 0.8735 to 0.8760.
before
Symbol-font bullets, before the fix
after
Symbol-font bullets, after the fix
Symbol-font bullets. 6174d98 A bullet stored as a symbol font's code in the U+F000 range drew the missing-glyph box when that font was not installed. The libreoffice-rich.docx fixture's StarOffice starbats bullets now draw as the character they stand for, from a face that has it.
before
Automatic text color on dark fills, before the fix
after
Automatic text color on dark fills, after the fix
Automatic text color on dark fills. ddbfd3d Text and list labels whose color is auto were always black. On tdf64264.docx's dark red rows, auto now resolves against the shading behind the run and turns white when that fill's Rec.601 luminance is below 128.
before
Word binary cell margins, before the fix
after
Word binary cell margins, after the fix
Word binary cell margins. 456cd22 The DOC reader ignored sprmTDxaGapHalf, so every cell took DOCX's 108-twip default margins and AIOOB-Tap.doc wrapped 'Versie nummer' and its dates. The gap is now each cell's left and right margin. Page 1: SSIM 0.58 to 0.70.
before
Page number formats, before the fix
after
Page number formats, after the fix
Page number formats. 3bb1dda PAGE fields always showed decimal numbers. tdf166510_sectPr_bottomSpacing.docx numbers its first section in upper-case Roman: the footer showed 1 where LibreOffice shows I. Section number formats and the field's format switch are now read.
before
Paragraph border groups, before the fix
after
Paragraph border groups, after the fix
Paragraph border groups. c8c30dc Each paragraph drew its own top and bottom border, so a header of three paragraphs with the same bottom border showed three rules where Word and LibreOffice draw one. Consecutive paragraphs with equal borders now form one group. SSIM 0.896 to 0.955.
before
Borders inside merged cells, before the fix
after
Borders inside merged cells, after the fix
Borders inside merged cells. 6968855 The rows of a vertically merged cell drew the inside horizontal border across the merged cell between every two of its rows. On AIOOB-Tap.doc page 4 that border is now left out. SSIM 0.637 to 0.642.

The fixtures live in the docboss crates. Install with pip install docboss or cargo install docboss-cli.