A style gives each paragraph and run its base look. The file then records only the differences, as lists of small instructions called Sprms. These lists are stored in 512-byte pages looked up through bin tables.
PLCs
A PLC is an array of positions and an array of data: n + 1 positions (4 bytes each) and n data elements. n is worked out from the total size and the size of a data element.
Bin tables
PlcBteChpx and PlcBtePapx, located through the FIB, are PLCs
whose positions are byte offsets (FCs) in WordDocument and whose data are
page numbers of 4 bytes. Page n starts at byte n × 512 of
WordDocument.
Formatted disk pages
An FKP is one 512-byte page. Its last byte is crun, the number of runs.
rgfccrun + 1 byte offsets: where each run starts, and the end of the last4 × (crun + 1)rgbone entry per runvariesPropertiesChpx or PapxInFkp records, at the back of the pagevariescrunthe number of runs1
In a character page each rgb entry is one byte: half the offset of the run’s
Chpx, or zero for no properties. In a paragraph page each entry is a 13-byte BxPap: one
byte, half the offset of the run’s PapxInFkp, then 12 bytes of height information.
Chpx
A Chpx is one byte, its size, then a grpprl (a list of Sprms with their operands).
PapxInFkp
A PapxInFkp is a first byte, cb. If it is not zero, 2 × cb − 1
bytes follow; if it is zero, the next byte, cb′, says 2 × cb′
bytes follow. The bytes start with a 16-bit istd, the paragraph’s style, and
continue with a grpprl.
A long list is placed in the Data stream: the grpprl is then one
sprmPHugePapx, whose operand is an offset in Data of a 16-bit
size and the bytes.
Sprms
A Sprm is a 16-bit code, then its operand. Its bits are: bits 0–8 ispmd,
bit 9 fSpec, bits 10–12 sgc (1 paragraph, 2 character, 3 picture,
4 section, 5 table) and bits 13–15 spra, the operand size.
| spra | Operand |
|---|---|
| 0 | 1 byte, a toggle: 0 off, 1 on, 128 the style’s value, 129 the opposite of it |
| 1 | 1 byte |
| 2, 4, 5 | 2 bytes |
| 3 | 4 bytes |
| 6 | Variable: the first byte is the size of the rest. sprmTDefTable has a 16-bit size counting the rest, plus one. sprmPChgTabs has its own layout when the size byte is 255. |
| 7 | 3 bytes |
A few of the codes:
| Code | Name | Meaning |
|---|---|---|
0x0835 | sprmCFBold | Bold |
0x0836 | sprmCFItalic | Italic |
0x083C | sprmCFVanish | Hidden text |
0x0855 | sprmCFSpec | The characters are special (a picture, a note reference) |
0x6A03 | sprmCPicLocation | The picture’s offset in Data |
0x4600 | sprmPIstd | The paragraph style |
0x2640 | sprmPOutLvl | The outline level |
0x460B, 0x260A | sprmPIlfo, sprmPIlvl | The list and its level |
0x2416 | sprmPFInTable | The paragraph is in a table |
0x2417 | sprmPFTtp | The end of a table row |
0x6646 | sprmPHugePapx | The grpprl is in Data |
0xD608 | sprmTDefTable | A table row’s cells |
[MS-DOC] section 2.6 lists every code and operand.
Lists
sprmPIlfo gives a 1-based index into the list format overrides
(PlfLfo), and sprmPIlvl a level. The override gives the list
definition, in PlfLst, and each level’s number format, where 23 is a
bullet.
Tables
A table is a run of paragraphs with sprmPFInTable set. Each cell ends with
a 0x07 mark, and the row ends with a 0x07 mark on a paragraph
with sprmPFTtp set, which also carries the row’s table sprms, such as
sprmTDefTable for the cell widths.