Introduction
This is the format of Word 97, 2000, 2002 and 2003, and of most .doc files
in circulation. Word 2007 and later still open and save it as “Word 97–2003 Document”.
It added Unicode text to the Word 6.0
and 95 design and moved the document’s tables into a stream of their own.
Microsoft publishes the format in full as [MS-DOC], one of its Office open specifications.
Structure
The file is a compound file, which starts with the signature
D0 CF 11 E0 A1 B1 1A E1 and holds named streams like files in a small file
system. The WordDocument stream begins with the File Information Block
(FIB), whose wIdent is 0xA5EC and nFib is 193
(0x00C1), followed by the text. A flag in the FIB says whether the table
stream is named 0Table or 1Table; it holds the piece table,
which says where each run of text is and whether it is 8-bit or UTF-16, together with
the styles, fonts, lists and formatting. Pictures live in the Data stream
and embedded objects in ObjectPool.
cfbWordDocument the FIB, then the text and formatting runsstreamcfb0Table or 1Table piece table, styles, fonts, listsstreamcfbData pictures and other binary dataoptionalcfbObjectPool embedded OLE objectsoptionalcfbSummaryInformation, DocumentSummaryInformation title, author, datesstreams
The pages in the side menu describe each structure: the container, the File Information Block, the text and piece table, formatting, styles and fonts, stories, fields, pictures and objects, and the summary properties. The explorer reads all of them. Not covered here: the DOP’s many options, revision marks, table styles, and the Office Art drawing records beyond naming the image type. Those need [MS-DOC] and [MS-ODRAW].
Variants
- Word 6.0 and 95 document – single-byte text in one compound file stream
- Word 97–2003 document – Unicode text, with the document’s tables in a separate stream
- Word for Windows 1.x and 2.0 document – a plain file with single-byte text
Links
Software
- Microsoft Word – Microsoft’s word processor, which opens and saves “Word 97–2003 Document” (Windows, macOS, web, mobile)
- LibreOffice Writer – free office suite’s word processor, which opens and saves .doc (Windows, macOS, Linux)
- Google Docs – online word processor that imports and exports .doc (web browsers)
- Apple Pages – Apple’s word processor, which imports .doc (macOS, iOS)
Developers
- Apache POI – library for Office files, reading Word documents through its HWPF classes (Java)
Reference
- [MS-DOC]: Word (.doc) Binary File Format – Microsoft’s full specification of this format
- [MS-CFB]: Compound File Binary File Format – Microsoft’s specification of the compound file container