Text is addressed by character position (CP), counted from 0 across all the parts of the
document. The parts follow each other in CP order; see
Stories. The bytes of the text
are in the WordDocument stream, in pieces in any order.
The Clx
fcClx and lcbClx in the
FIB locate the Clx in the
table stream. It is zero or more Prc records, then one Pcdt.
Prc1 byte tag 01, a 16-bit size, then a grpprl: formatting shared by piecesrepeatsPcdt1 byte tag 02, a 32-bit size, then a PlcPcdvaries
The piece table
A PlcPcd is a PLC: for n pieces, n + 1 CPs, then
n Pcd structures.
CPn + 1 values, 4 bytes each: the first CP of each piece, then the end4 × (n + 1)Pcdn values, 8 bytes each: where each piece’s text is8 × n
00 00 00 00 · 0C 00 00 00 for one piece of 12 characters.| Bytes in a Pcd | Field | Meaning |
|---|---|---|
| 0–1 | flags | Not needed to read the text |
| 2–5 | fc | Where the text starts. Bit 30 is fCompressed. |
| 6–7 | prm | A property modifier or a pointer to a Prc |
If fCompressed is 1, the piece is 8-bit text: mask the top two bits and halve
the value to get the offset in WordDocument, and read one byte per CP in
the Windows-1252 code page. If it is 0, the piece is UTF-16LE at the offset given, two
bytes per CP.
Prc
A Prc stores a grpprl used by pieces through their prm
field, usually for fast-saved documents. A document may have none.
Special characters in the text
| Value | Meaning |
|---|---|
0x0D | Paragraph end |
0x07 | End of a table cell, or of a table row when sprmPFTtp is set on it |
0x0C | Page or section break |
0x0B | Line break within a paragraph |
0x13, 0x14, 0x15 | Field begin, separator and end |
0x01 | Picture or embedded object position, with sprmCFSpec |
0x02 | Footnote or endnote reference, with sprmCFSpec |
0x05 | Comment reference, with sprmCFSpec |
0x08 | Drawn object, with sprmCFSpec |
0x1E, 0x1F | Non-breaking and optional hyphens |