Introduction
A .wpd file is a document from
WordPerfect, the word processor that led the
market on MS-DOS in the late 1980s. WordPerfect has belonged to Corel since 1996 and is
still sold, and it remains common in legal offices, especially in North America. Older
versions often saved documents with no extension or with one the user chose.
WordPerfect is known for its “reveal codes” view, which shows the formatting codes between the characters of the text, and the file format stores the document the same way: text with function codes between the characters. How those codes are framed has changed several times, so the format is treated here as four formats, each described as a format of its own with its own reference: the headerless 4.2 and earlier files of DOS, the Macintosh files, WordPerfect 5, and WordPerfect 6 and later.
Only the 4.2 format is described by its maker, in a 1986 document. For the others Corel has not published the layout; the reference pages follow libwpd, the open-source reader used by LibreOffice, and say where something is not known.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.WPD | WordPerfect 4.2 and earlier for DOS document | A headerless stream of text and function codes (DOS, 1986 and before). | Open |
.WPD | WordPerfect for Macintosh document | Version 1.x headerless; 2.x to 3.5e with a WPC header and resource fork. | Open |
.WPD | WordPerfect 5 document | WordPerfect 5.0 to 5.2: a WPC header, prefix packets, then text and function codes. | Open |
.WPD | WordPerfect 6 and later document | WordPerfect 6.0 and later: a WPC header, an index of packets, then text and codes. | Open |
WordPerfect 5 and later start with the same 16-byte header, which begins
FF 57 50 43 (0xFF then WPC). Its bytes 9 to 11
give the file type and the version, and they say which format the file is. The
Macintosh versions from 2.x use the same header with a different file type. A 4.2 file
and a Macintosh 1.x file have no header at all.
00000000 FF 57 50 43 D4 05 00 00 01 0A 02 01 00 00 00 02
| Starts with | File type | Major version | Format |
|---|---|---|---|
FF 57 50 43 | 0x0A | 0 | WordPerfect 5 (minor 0 is 5.0, minor 1 is 5.1 and 5.2) |
FF 57 50 43 | 0x0A | 2 | WordPerfect 6 and later (minor 0 is 6.0; from minor 1 the file has a size field) |
FF 57 50 43 | 0x2C | 2, 3 or 4 | WordPerfect for Macintosh 2.x, 3.0 to 3.5 and 3.5e |
| no signature | – | – | WordPerfect 4.2 and earlier, or WordPerfect for Macintosh 1.x |
WordPerfect 4.2 and earlier for DOS
A plain stream: ASCII text with function codes in between, no header and no
end-of-file marker. Single-byte functions are 0x80 to
0xBF; multiple-byte functions 0xC0 to 0xF8 are
closed by the same code after their data. WordPerfect Corporation described it in
its own 1986 document, which the reference follows.
To tell it apart: there is no WPC signature, and a reader checks that
the whole file is well-formed codes. A file that starts FE FF 61 61 is
password-protected. A Macintosh 1.x file looks the same but its multiple-byte
functions have different lengths, so a reader tries the Macintosh layout first.
WordPerfect for Macintosh
Version 1.x writes a headerless stream close to 4.2. Versions 2.x, 3.0 to 3.5 and
3.5e write the WPC header with file type 0x2C, then a Macintosh
resource fork that holds the pictures of graphics boxes, then a stream with codes of
their own. Numbers in the streams are big-endian.
To tell it apart: WPC with file type 0x2C and major
version 2, 3 or 4; or, for 1.x, a headerless file whose function lengths match the
Macintosh layout.
WordPerfect 5
The header, then a chain of index blocks listing prefix packets (the fonts used, the font names, the graphics), then the document area at the document pointer: single-byte functions, fixed-length groups and variable-length groups. Numbers are little-endian. Written by WordPerfect 5.0 and 5.1 for DOS and 5.1 and 5.2 for Windows.
To tell it apart: WPC, file type 0x0A, major version 0.
WordPerfect 6 and later
The header with an offset to an index header, an index of 14-byte packet entries, then the document area, with different code ranges and group layouts from 5.x. The layout of WordPerfect 6.0 is still written by every later version, up to today’s WordPerfect Office. From 6.1 the header has a document size field.
To tell it apart: WPC, file type 0x0A, major version 2.
Not described
Corel has not published the 5.x and later formats, and no viewer exists in the explorer for any of the four. What is not described, and what is unknown, is listed on each format’s own page: 4.2 and earlier, Macintosh, WordPerfect 5 and WordPerfect 6 and later.
Known, not yet covered
- Viewer: all four formats. A WPD file shows in the explorer as raw
bytes (the headered ones with their
WPCsignature); the reference pages describe the headers and codes, so a viewer can be built. - Reference: third-party or confidential descriptions that were not used: the Macintosh 3.5e manual (marked confidential), a 5.1 description and a 6.x development kit archive.
Unknown
- Reference: the encryption of 6.x files, header bytes 16 to 19 of 6.x files, the codes and packet contents that libwpd skips in every variant, and the minor version numbers of the 6.x releases.
Links
Software
- WordPerfect Office – Corel’s office suite, which makes the format (Windows)
- LibreOffice Writer – free office suite’s word processor, which imports WordPerfect documents (Windows, macOS, Linux)
Developers
- libwpd – library that reads WordPerfect documents, used by LibreOffice (C++)
Reference
- libwpd source code – the most complete public description of the format, in
WPXHeader,WP5FileStructure.handWP6FileStructure.h - WordPerfect File Information, Version 4.2 – WordPerfect Corporation’s own description of the 4.2 format (1986)