Skip to main content

Module doc

Module doc 

Source
Expand description

Legacy Word 97-2003 binary .doc parser ([MS-DOC]).

Parses the binary format and synthesizes an in-memory [OoxmlPackage] (document.xml, styles.xml, numbering.xml, headers/footers, settings, rels, media assets) so the existing DOCX model-building pipeline is reused unchanged downstream.

Re-exports§

pub use build::parse_doc;
pub use cfb::is_cfb as is_doc_format;

Modules§

build
Document builder: walks the CP space of each subdocument (main text, headers/footers, footnotes, endnotes), reconstructs paragraphs, runs, fields and tables from the piece table + FKP formatting layers, and synthesizes a complete in-memory OOXML package.
cfb
Read-only parser for OLE2 / Compound File Binary (CFB) containers ([MS-CFB]). Legacy .doc files store their streams (WordDocument, 0Table/1Table, Data) inside this container format.
chp
Character properties (CHP): accumulated from style defaults plus CHPX sprm deltas, then emitted as OOXML <w:rPr> direct formatting.
fib
File Information Block ([MS-DOC] 2.5.1) — the versioned header at offset 0 of the WordDocument stream. All other structures are located through its (fc, lcb) pointer pairs into the Table stream.
fkp
Formatted disk pages ([MS-DOC] 2.9.74-2.9.79): 512-byte pages holding character (CHPX) and paragraph (PAPX) property deltas keyed by FC ranges, located through the PlcfBteChpx / PlcfBtePapx bin tables.
fmt
Shared primitives for mapping binary formatting structures (colors, borders, shading) onto their OOXML equivalents, plus XML string helpers.
fonts
Font table (SttbfFfn, [MS-DOC] 2.9.281): maps the ftc indices used by character sprms to font names.
images
Inline pictures: a run with fSpec and character 0x01 carries sprmCPicLocation, an offset to a PICF structure ([MS-DOC] 2.9.190) in the Data stream. Word 97+ stores the actual bitmap inside an OfficeArt ([MS-ODRAW]) record stream following the PICF header.
lists
List tables ([MS-DOC] 2.9.131 PlfLst / 2.9.130 PlfLfo): list definitions (LSTF + per-level LVL) and list-format overrides (LFO/LFOLVL), emitted as word/numbering.xml. A paragraph’s sprmPIlfo is a 1-based LFO index, which maps directly to the synthesized w:numId.
pap
Paragraph properties (PAP): style index plus PAPX sprm deltas, emitted as OOXML <w:pPr> direct formatting. Table-related flags (fInTable, fTtp, itap) drive table reconstruction in the document builder.
pieces
Piece table ([MS-DOC] 2.8.35 Clx / 2.8.36 PlcPcd): maps the logical character-position (CP) space onto WordDocument-stream byte offsets (FCs). Pieces are either 8-bit (Windows-1252) or 16-bit (UTF-16LE); both kinds can coexist in one document, and fast-saved files store text non-contiguously, so all text access must go through this table.
sep
Section properties (SEP): parsed from SEPX grpprls located via PlcfSed, emitted as OOXML <w:sectPr>. Page size/margins and the document grid (sprmSClm / sprmSDyaLinePitch) are the layout-fidelity-critical fields.
sprm
Sprm ([MS-DOC] 2.2.5.1): single property modifiers. Formatting in the binary format is stored as grpprls — byte arrays of sprms, each a 16-bit opcode followed by an operand whose size is encoded in the opcode’s spra bits.
stsh
Stylesheet (STSH, [MS-DOC] 2.9.271): STSHI header plus an array of STD style definitions whose formatting lives in UPX grpprls. Emitted as a synthesized word/styles.xml so the existing OOXML style-resolution code (basedOn chains, defaults) is reused as-is.
tap
Table properties (TAP): tables have no stored structure in the binary format — each row’s geometry lives in table sprms on the row-end paragraph’s PAPX (sprmTDefTable defines the cell boundaries and per-cell TC80 formatting). The document builder feeds those grpprls here.

Structs§

DocFile
The opened streams and core tables of a .doc file.