WordPerfect 6.0 introduced the format that every later version still writes, marked by major version 2 in the WPC header. The prefix is an index of packets (fonts, styles, summary, graphics), and the document area is a stream of text and function codes like that of 5.x, but with different code ranges and group layouts. This page follows libwpd; numbers are little-endian. The bytes inside each group and packet are on the 6.x function and packet data page.
Index header and prefix packets
The index header starts at the offset in bytes 14–15 of the WPC header (at least 16).
| Offset | Size | Field | Meaning |
|---|---|---|---|
0 | 1 | Flags | 2. |
1 | 1 | Reserved | 0. |
2 | 2 | Number of indexes | How many 14-byte entries follow. |
4 | 10 | Reserved | – |
14 | 14 each | Index entries | See below. |
| Offset | Size | Field | Meaning |
|---|---|---|---|
0 | 1 | Flags | Bit 0: the packet has child packets. |
1 | 1 | Packet type | See packet types. |
2 | 2 | Use count | How many codes in the document refer to the packet. |
4 | 2 | Hide count | How many of those references are hidden. |
6 | 4 | Data size | Length of the packet’s data. |
10 | 4 | Data offset | Where the data is in the file. |
Function codes in the document refer to packets by their position in this index (their “prefix ID”).
Packet types
| Type | Packet |
|---|---|
0x02 | Document settings (descriptor pool) |
0x07 | Hyperlink |
0x08 | General WordPerfect text: text kept outside the main stream, such as headers, footnotes and box contents |
0x10 | Next total page count |
0x12 | Extended document summary (see below) |
0x1B | Comment (annotation) |
0x23 | Printer selection |
0x25 | Initial font |
0x30 | Style data |
0x31 | Outline style (numbering: 0 Arabic, 1 lower-case letters, 2 upper-case letters, 3 lower-case Roman, 4 upper-case Roman) |
0x34 | Shared and personal file dates |
0x40 | Graphics file name |
0x41 | Graphics box style |
0x43 | Fill style |
0x4E | Check-as-you-go (spelling) data |
0x55 | Desired font |
0x5E | Prefix time stamp |
0x69 | Table style |
0x6D | World Wide Web data |
0x6F | Cached graphics file data (the picture itself) |
0x77 | Undo information (WordPerfect 6.1) |
Many other packet types exist; libwpd names only these, and their full list is not public.
Document summary fields
Field numbers in the extended document summary packet:
| N | Field | N | Field | N | Field |
|---|---|---|---|---|---|
| 1 | Abstract | 2 | Account | 3 | Address |
| 4 | Attachments | 5 | Author | 6 | Authorisation |
| 7 | Bill to | 8 | Blind copy | 9 | Carbon copy |
| 10 | Category | 11 | Checked by | 12 | Client |
| 13 | Comments | 14 | Creation date | 15 | Date completed |
| 16 | Department | 17 | Descriptive name | 18 | Descriptive type |
| 19 | Destination | 20 | Disposition | 21 | Division |
| 22 | Document number | 23 | Editor | 24 | Forward to |
| 25 | Group | 26 | Keywords | 27 | Language |
| 28 | Mail stop | 29 | Matter | 30 | Office |
| 31 | Owner | 32 | Project | 33 | Publisher |
| 34 | Purpose | 35 | Received from | 36 | Recorded by |
| 37 | Recorded date | 38 | Reference | 39 | Revision date (unused) |
| 40 | Revision notes | 41 | Revision number | 42 | Section |
| 43 | Security | 44 | Source | 45 | Status |
| 46 | Subject | 47 | Telephone number | 48 | Typist |
| 49 | Version date | 50 | Version notes | 51 | Version number |
The document area
| Bytes | Meaning |
|---|---|
0x00 | Not used; ignored. |
0x01–0x20 | The 32 “default extended international characters”: see below. Note that 0x20 is not a space. |
0x21–0x7F | ASCII text. |
0x80–0xCF | Single-byte functions, including the space. |
0xD0–0xEF | Variable-length function groups. |
0xF0–0xFE | Fixed-length function groups. |
0xFF | Reserved; not a valid code. |
Default extended international characters
| Byte | Character | Byte | Character | Byte | Character | Byte | Character |
|---|---|---|---|---|---|---|---|
01 | å | 09 | â | 11 | è | 19 | Õ |
02 | Å | 0A | ã | 12 | ê | 1A | ö |
03 | æ | 0B | Ã | 13 | í | 1B | Ö |
04 | Æ | 0C | ç | 14 | ñ | 1C | ü |
05 | ä | 0D | Ç | 15 | Ñ | 1D | Ü |
06 | Ä | 0E | ë | 16 | ø | 1E | ú |
07 | á | 0F | é | 17 | Ø | 1F | ù |
08 | à | 10 | É | 18 | õ | 20 | ß |
Single-byte functions
“EOL” is end of line, “EOC” end of column, “EOP” end of page. Hard ones were typed; soft ones are where WordPerfect’s layout broke the line; deletable ones are hard codes the program may remove.
| Code | Function | Code | Function |
|---|---|---|---|
0x80 | Soft space (an ordinary space) | 0xBF | Table off |
0x81 | Hard (non-breaking) space | 0xC0 | Table row at hard EOP |
0x82 | Soft hyphen in a line | 0xC1 | Table row at hard EOC at hard EOP |
0x83 | Soft hyphen at EOL | 0xC2 | Table row at hard EOC |
0x84 | Hard hyphen | 0xC3 | Table row at EOC at EOP |
0x85 | Automatic hyphen | 0xC4 | Table row at EOC |
0x87 | Dormant hard return | 0xC5 | Table row |
0xB4 | Deletable hard EOP | 0xC6 | Table cell |
0xB5 | Deletable hard EOC at EOP | 0xC7 | Hard EOP (page break) |
0xB6 | Deletable hard EOC | 0xC8 | Hard EOC at EOP |
0xB7 | Deletable hard EOL at EOC at EOP | 0xC9 | Hard EOC (column break) |
0xB8 | Deletable hard EOL at EOC | 0xCA | Hard EOL at EOC at EOP |
0xB9 | Deletable hard EOL | 0xCB | Hard EOL at EOC |
0xBA | Deletable soft EOL at EOC at EOP | 0xCC | Hard EOL (hard return, end of paragraph) |
0xBB | Deletable soft EOL at EOC | 0xCD | Soft EOL at EOC at EOP |
0xBC | Deletable soft EOL | 0xCE | Soft EOL at EOC |
0xBD | Table off at EOC at EOP | 0xCF | Soft EOL (wrapped line) |
0xBE | Table off at EOC |
0x86 and 0x88 to 0xB3 are single-byte
functions that libwpd does not name.
Variable-length function groups
Layout of a group, as libwpd reads it:
| Size | Field | Meaning |
|---|---|---|
| 1 | Code | 0xD0–0xEF. |
| 1 | Sub-code | Which function of the group. |
| 2 | Size | Length of the whole group, both code bytes included. |
| 1 | Flags | Bit 7: prefix IDs follow. |
| 1 + 2n | Prefix IDs | If bit 7: a count, then that many 16-bit packet numbers. |
| 2 | Non-deletable size | Length of the data that must be kept; what follows it, up to the end, may be dropped by programs that do not understand it. |
| … | Data | Depends on the group and sub-code. |
| 2 | Size | The size again. |
| 1 | Code | The code again. |
| Code | Group | Sub-codes named by libwpd |
|---|---|---|
0xD0 | End of line | 1 soft EOL; 2 soft EOC; 3 soft EOC at EOP; 4 hard EOL; 5 hard EOL at EOC; 6 hard EOL at EOP; 7 hard EOC; 8 hard EOC at EOP; 9 hard EOP; 10 table cell; 11 table row and cell; 12 table row at EOC; 13 table row at EOP; 14 table row at hard EOC; 15 table row at hard EOC at hard EOP; 16 table row at hard EOP; 17 table off; 18 table off at EOC; 19 table off at EOC at EOP; 20–28 the deletable forms (soft EOL, soft EOC, soft EOC at EOP, hard EOL, hard EOL at EOC, hard EOL at EOP, hard EOC, hard EOC at EOP, hard EOP). Data items inside: 128 row information (5 bytes), 129 cell formula, 130 top gutter (4), 131 bottom gutter (4), 132 cell information (9), 133 cell spanning (4), 134 cell fill colours (10), 135 cell line colour (6), 136 cell number type (6), 137 cell floating-point number (11), 139 cell prefix flag (3), 140 recalculation error number (3), 141 do not end a paragraph style here (1) |
0xD1 | Page | 0 top margin; 1 bottom margin; 2 suppress page features (flags 1 page number, 2 page number at bottom centre, 4 header A, 8 header B, 16 footer A, 32 footer B, 64 watermark A, 128 watermark B); 3 page number position; 17 paper size and type (form) |
0xD2 | Column | 0 left margin; 1 right margin; column definitions with type 0 newspaper, 1 newspaper balanced, 2 parallel, 3 parallel with block protect |
0xD3 | Paragraph | 1 line spacing; 4 tab set; 5 justification (0 left, 1 full, 2 centre, 3 right, 4 full including the last line, 5 reserved); 10 spacing after paragraph; 11 first-line indent; 12 left margin adjustment; 13 right margin adjustment; 14 outline definition |
0xD4 | Character | 0 alignment character; 24 colour; 25 shading; 26 font face; 27 font size; 29 comment; 30 dot leader characters; 42 table definition on; 43 table definition off; 44 table column; 50 paragraph number on; 51 paragraph number off |
0xD5 | Cross-reference | – |
0xD6 | Header, footer, watermark | 0 header A; 1 header B; 2 footer A; 3 footer B; 4 watermark A; 5 watermark B (pages: bit 1 odd, 2 even); the text is in a general text packet |
0xD7 | Footnote, endnote | 0 footnote on; 1 footnote off; 2 endnote on; 3 endnote off |
0xD8 | Set number | 0 user counter; 1 box; 2 page; 3 secondary page; 4 chapter; 5 volume; 6 paragraph; 7 footnote; 8 endnote; 9 line |
0xD9 | Numbering method | The same ten counters; page methods 0 Arabic, 1 lower-case letters, 2 upper-case letters, 3 lower-case Roman, 4 upper-case Roman |
0xDA | Display number | Even sub-codes start, odd ones end, the display of: 0/1 user counter, 2/3 box, 4/5 page, 6/7 secondary page, 8/9 chapter, 10/11 volume, 12/13 paragraph, 14/15 footnote, 16/17 endnote, 18/19 line, 20/21 total pages |
0xDB | Increment number | The same ten counters as set number |
0xDC | Decrement number | The same ten counters |
0xDD | Style | 4 paragraph style begin on (part 1); 5 begin off (part 1); 6 begin on (part 2); 7 begin off (part 2); 8 end on; 9 end off; 10 global on; 11 global off |
0xDE | Merge | – |
0xDF | Box | 0 box anchored to a character; 1 to a paragraph; 2 to the page; 3 graphics line. Flags say which data follows: 0x8000 counter, 0x4000 position, 0x2000 content, 0x1000 caption, 0x0800 border, 0x0400 fill, 0x0200 wrapping, 0x0100 hypertext, 0x0080 HTML, 0x0040 grouping, 0x0020 drawing object |
0xE0 | Tab | The tab type, which libwpd describes as bits 3 to 8 of the tab group |
0xE1 | Platform | 0/1 DDE start/end; 2/3 publish start/end; 4/5 subscribe start/end; 6 subtitle mark; 7 subtitle text; 8 subtitle option; 9 subtitle text options; 10 suppress subtitle; 11 third party; 12/13 pen foreground colour (32/64-bit); 14/15 pen background colour; 16 pen style; 17 pen pattern; 18/19 pen size (16/32-bit); 20/21 brush gradient; 22/23 brush foreground colour; 24/25 brush background colour; 26 brush pattern; 27 miscellaneous attributes; 28 Presentations slide options; 29 Presentations organisation chart node; 30 hide for conversions; 31 hide off; 32 SGML start tag; 33 start tag end; 34 end tag; 35 end tag end; 36 character reference; 37 end character reference; 38 entity reference; 39 end entity reference; 40/41 ignore on/off; 42/43 marked section on/off; 44/45 processing instruction on/off |
0xE2 | Formatter | – |
“–” means the group exists but libwpd names none of its sub-codes. Groups
0xE3 to 0xEF are not described. The layout of each sub-code’s
data is only partly known from libwpd; what is known is on the
6.x data page.
Fixed-length function groups
A fixed-length group starts and ends with its code; the sizes below include both.
| Code | Size | Function |
|---|---|---|
0xF0 | 4 | Extended character: character number, character set |
0xF1 | 5 | Undo: 0 invalid text start, 1 invalid text end, 2 valid text start, 3 valid text end |
0xF2 | 3 | Attribute on: one attribute |
0xF3 | 3 | Attribute off |
0xF4 | 3 | Unknown |
0xF5 | 3 | Unknown |
0xF6 | 4 | Unknown |
0xF7 | 4 | Unknown |
0xF8 | 4 | Unknown |
0xF9 | 5 | Unknown |
0xFA | 5 | Unknown |
0xFB | 6 | Highlight on |
0xFC | 6 | Highlight off |
0xFD | 8 | Unknown |
0xFE | 8 | Unknown |
Attributes
0 extra large, 1 very large, 2 large, 3 small, 4 fine, 5 superscript, 6 subscript, 7 outline, 8 italic, 9 shadow, 10 redline, 11 double underline, 12 bold, 13 strikeout, 14 underline, 15 small caps, 16 blink.
Tab types
| Value | Meaning | Value | Meaning |
|---|---|---|---|
0x00 | Back tab | 0x08 | Centre between margins |
0x01 | Table tab | 0x09 | Centre on current position |
0x02 | Left tab | 0x0A | Centre tab |
0x04 | Bar tab | 0x10 | Flush right |
0x06 | Left indent | 0x12 | Right tab |
0x07 | Left and right indent | 0x1A | Decimal tab |
Character sets
Extended characters (F0 character set F0) use WordPerfect’s character
sets: 0 ASCII, 1 multinational, 2 phonetic symbols, 3 box drawing, 4 typographic
symbols, 5 iconic symbols, 6 maths and science, 7 maths and science extended, 8 Greek,
9 Hebrew, 10 Cyrillic, 11 Japanese, 12 Tibetan, 13 Arabic, 14 Arabic script. libwpd
maps each character to Unicode.
Units
Lengths such as margins and tab positions are in WordPerfect units, 1,200 to the inch.
48 65 6C 6C 6F 80 F2 0C F2 77 6F 72 6C 64 F3 0C F3 CC
“Hello”, a space (0x80), bold on, “world”, bold off, hard return.