WordPerfect 5.1 Document Format
This section describes the WordPerfect file format for WordPerfect 5.0 (WP5.0 DOS, UNIX,
Data General, VAX), WordPerfect 5.1 (WP5.1 DOS, UNIX, VAX), and WordPerfect 5.1/5.2 for
Windows (WPWin 5.1/5.2) documents.
Note: WP5.1 (without an extension) refers collectively to WP5.1 DOS, WP5.1 VAX, WP5.1
UNIX, and WPWin 5.1/5.2.
WordPerfect documents are binary files that contain both ASCII characters and special
formatting codes. Each document has two major sections: a prefix area and a document area.
The prefix area contains:
Information that identifies the file as a WP5.1/5.0 document
Default values for margins, fonts, and other format settings
Information about the selected printer
Graphic images contained in the document
The document area contains the actual text and formatting codes that make up the bulk of the
file.
Sizes are referred to as bytes, short (for short integers), or long (for long integers). Depending on
the environment and operating system you are working on, these can be translated using the
information in the following table.
Table WPF.1: Size Definitions | |||
Byte | character (char) | byte | 8 bits |
Short | integer | word | 16 bits |
Long | long integer | double word | 32 bits |
All Wordperfect document files follow the Intel "byte reversed" method of storing short and long integer values. In this storage method the high byte of a short integer comes first, and the high short integer comes first in a long integer value. The following two block diagrams represent this storage format.
<------------------------ short integer ------------------------> | ||||||||||||||||
[low byte] | [high byte] | |||||||||||||||
(high nibble) | (low nibble) | (high nibble) | (low nibble) | |||||||||||||
Bit # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
<--------------------------------------- long integer ----------------------------------------> | |||||||||||||||||||||||||||||||
[low short integer] | [high short integer] | ||||||||||||||||||||||||||||||
(low byte) | (high byte) | (low byte) | (high byte) | ||||||||||||||||||||||||||||
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Decimal numbers larger than 9 are followed, in parentheses "( )", by a number that begins with
"0x". This represents the equivalent value in the hexadecimal number system. Single-digit
decimal numbers stand alone, because such numbers have the same value in either hexadecimal
or decimal. In most cases values are unsigned. An example of how unsigned values are
documented is "255 (0xFF)." An example of how signed values are documented is "1 (0xFF)."
Measurements and positions can be stored in one of two units:
wpu = WordPerfect units (1 = 1/1200th of an inch, or 0.02117 mm)
su = Screen pitch units (1 = 1 screen display column)
The file format for the WP4.2 version contains only a document body with function codes.
WP4.2 files do not have a prefix header. The WP42FF.TXT file on the Toolkit diskette (PC
Developer's Toolkit only) contains the function codes for WP4.2.
WordPerfect Prefix Area
Prefix Area
The prefix area of a WP5.1 document consists of a 16-byte file prefix followed by additional
prefix information that is specific to the document. This can be any length, depending on the
WordPerfect document and file prefix contents.
File Prefix
All files created by WPCorp products begin with a 16-byte file prefix that identifies the file type,
product, and version.
The file prefix has the following structure:
Field Size Value for WP5.1 Document
WPCorp File ID 4 bytes 1 (0xFF),"WPC"
Start of Document long File position of start of document
Product Type 1 byte 1
File Type 1 byte 10 (0xA)
Major Version # 1 byte 0
Minor Version # 1 byte 0 in WP5.0, 1 in WP5.1
Encryption Key short 0 = not encrypted
Reserved short 0
The following diagram illustrates the prefix area structure of a WP5.0, WP5.1, and WPWin 5.1
document. The shaded section of the diagram is the 16-byte file prefix that identifies a WPCorp
file. The definitions of the 16-byte length are in byte, short, or long lengths.
1 | W | P | C | Pointer to Document Area | Prd | File | MjV | Mnv | Encrypt | Reserved | |||||||||||||
65531 (0xFFFB) | # Indexes | Indx Bk Size | Pointer to Next Block | Packet Type | Length | ||||||||||||||||||
Pointer to Data 1 | Packet Type | Length | Ptr to Data 2 | . . . | |||||||||||||||||||
. . . | Data 1 Data 1 Data 1 Data 1 Data 1 | Data 2 Data 2 | |||||||||||||||||||||
Data 2 Data 2 Data 2 | . . . | ||||||||||||||||||||||
Prefix continued | |||||||||||||||||||||||
Document Area
|
The WPCorp File ID fields are the first four bytes of a file and have the same values for all files produced by WPCorp
products (excluding WP4.2). It is displayed as "1WPC" or "FF 57 50 43" in hexadecimal value. If you look at a WPCorp
file in any binary program editor or ASCII editor, this ID ought to be there. If you do not see this ID, the file is not a
WPCorp 5.x file.
The Start of Document field is a long value that begins at offset 4 in the 16-byte file prefix heading. This is a pointer to
the beginning of the document area. Short integers and long integers are saved in a byte-reversed order.
Please note that if you place any codes such as margins, tabs, font changes, or a specific page size at the beginning of
your document, those codes appear before the actual text begins.
The Product Type field is one byte in length and is the ninth byte from the beginning of the file. It contains a value that
identifies the WPCorp software product used to create the file. The field type can have one of the following values:
Value Product
1 WordPerfect
2 Shell
3 Notebook
4 Calculator
5 File Manager
6 Calendar
7 Program Editor/Ed Editor
8 Macro Editor
9 PlanPerfect
10 (0xA) DataPerfect
11 (0xB) Mail
12 (0xC) Printer (PTR.EXE)
13 (0xD) Scheduler
14 (0xE) WordPerfect Office
15 (0xF) DrawPerfect
16 (0x10) LetterPerfect
Please remember that other product type values may be added in the future.
The File Type field is one byte in length and is the tenth byte from the beginning of the file. The value depends on the
Product Type (WPCorp software product) used to create the file. The first ten values (0-9) are reserved for general
purpose files that have application across all WPCorp products. The values 10 and above are available for
product-specific file types and are listed below in the WordPerfect File Types subsection.
These general purpose file types are documented for your information only. These files types are specified for the use of
WPCorp software.
Value File
1 Macro file
2 Help file
3 Keyboard definition file
4 VAX keyboard definition file added for WP5.1 (3-30-90)
Note: The Help file does not have a prefix, but the 2 value is still reserved for the help file. Any third-party software or
application can thus disregard the help file types.
The file type for WPCorp products is one byte in length and identifies what type of file it is. The values are 16 (0x10)
and above, and the file may not specifically be a document file.
The following file types are specific to WP5.0 and are also used for WP5.1.
The following file types are specific to WPCorp:
Value File
10 (0xA) WordPerfect document
11 (0xB) Dictionary file
12 (0xC) Thesaurus file
13 (0xD) Block
14 (0xE) Rectangular block
15 (0xF) Column block
16 (0x10) Printer resource file (.PRS)
17 (0x11) Setup file (contains the system values for WP{WP}.SET [Setup values, Shift-F1])
18 (0x12 Reserved
19 (0x13) Printer resource file (.ALL)
20 (0x14) Display resource file (.DRS)
21 (0x15) Overlay file (WP.FIL)
22 (0x16) WP graphic file (.WPG)
23 (0x17) Hyphenation code module
24 (0x18) Hyphenation data module
25 (0x19) Macro resource file (.MRS)
26 (0x1A) WP5.0 Graphics/Text Drivers
27 (0x1B) Hyphenation lex module
The following file types were added to the WordPerfect file type for WP5.1:
Value File
28 (0x1C) Printer Q codes (used by VAX/DG)
29 (0x1D) Spell code module--word list
30 (0x1E) WP.QRS file (WP5.1 equation resource file)
31 (0x1F) Reserved
32 (0x20) VAX .SET
33 (0x21) Spell code module--rules
34 (0x22) Dictionary--rules
35 (0x23) Reserved
36 (0x24) WP5.1 Graphics/Text Drivers
37 (0x25) Rhymer word file (WPCorp product, TSR)
38 (0x26) Rhymer pronunciation file
39 - 40 (0x27 - 0x28) Reserved
41 (0x29) WP51.INS file (install options file)
Value File
42 (0x2A) Mouse driver for WP5.1
43 (0x2B) UNIX Setup file for WP5.0
44 (0x2C) MAC WP2.0 document
45 (0x2D) VAX file (WP4.2 document)
46 (0x2E) External Spell Code Module (WP5.1)
(This file type is set aside for third parties to create their own speller code modules in WP5.1 DOS)
47 (0x2F) External Spell Dictionary
(This file type is set aside for third parties to create their own dictionary ".LEX" files to be read by their speller code.)
48 (0x30) MAC SOFT graphics file
(SOFT(Sequential Object FormaT) graphics file for the MAC WP)
49 - 50 (0x31 - 0x37) Reserved
51 (0x38) WPWin 5.1 Application Resource Library added for WPWin 5.1
The Major and Minor Version fields are each one byte in length. The value in the fields indicates the version number
that the file type was created for. The value may or may not correspond to the product's published revision number. The
Major version number for WordPerfect 5.x files is 0.
Note: The "Minor Version #" for WP5.0 is 0. The "Minor Version #" was incremented for WordPerfect 5.1 (the value is
1). The "Minor Version #" for WPWin 5.1/5.2 is 1, the same number used for WP5.1.
The Encryption Key field is a short-integer value and occupies the 13th and 14th bytes. It must be a value 0 if the file is
not encrypted; otherwise, it must contain a hash value of the password. This hash value is used as a check-sum to see if
the user typed the correct password.
Do not use the Reserved field. It must be zero (0).
Additional Prefix Area
The additional prefix area follows the 16-byte file prefix. Its structure depends on the product and file type. The
additional prefix information for WP5.0 and WP5.1 documents is organized into index blocks and data packets. Each
index block contains several indexes that point to data packets. The first index in each block is a special header index
that gives the number of indexes in the block. It also gives the pointer to the next block. There can be more than one
block (five indexes) in a prefix header, depending on how much information is stored in the prefix.
WP5.0 and WP5.1 currently store five, and only five, indexes in each index block (the special header index plus four
general purpose indexes).
Each index block in a WP5.0/5.1 and WPWin 5.1/5.2 file consists of a special header index followed by four indexes that
point to data packets. The data packets immediately follow the index block. The prefix area of the file consists of a
sequence of index blocks and associated data chained together by the special header index in each index block.
Special Header Index
The special header index is 10 bytes long. It has the following structure (also illustrated in the shaded area of the diagram):
Offset Size Usage
0 short Packet type for header index 65531 (0xFFFB)
2 short # of indexes (including the special header, there are five in WP5.0 and WP5.1 documents.)
4 short Size of index block 50 (0x32) (# of indexes * 10)
6 long File position of next index block from beginning of file
1 | W | P | C | Pointer to Document Area | Prd | File | MjV | Mnv | Encrypt | Reserved
65531
(0xFFFB)
| # Indexes
| Indx Bk Size
| Pointer to Next Block
| Packet Type
| Length
| Pointer to Data 1
| Packet Type
| Length
| Ptr to Data 2
| . . .
| . . .
| Data 1 Data 1 Data 1 Data 1 Data 1
| Data 2 Data 2
| Data 2 Data 2 Data 2
| . . .
|
| Prefix continued
|
| Document Area
| |
The general packet types indexes in the index block are also 10 bytes long. They have the following structure and are
illustrated in the diagram below:
Offset Size Usage
0 short Packet type
2 long Length of data packet
6 long File position of data for packet type
1 | W | P | C | Pointer to Document Area | Prd | File | MjV | Mnv | Encrypt | Reserved
65531 (0xFFFB) # Indexes
| Indx Bk Size
| Pointer to Next Block
| Packet Type
| Length
| Pointer to Data 1
| Packet Type
| Length
| Ptr to Data 2
| . . .
| . . .
| Data 1 Data 1 Data 1 Data 1 Data 1
| Data 2 Data 2
| Data 2 Data 2 Data 2
| . . .
|
| Prefix continued
|
| Document Area
| |
The following special data packet types are defined for use by all file types:
Value Packet Type
0 End of prefix
65531 (0xFFFB) Header index for index block
65532 (0xFFFC) Reserved
65533 (0xFFFD) Reserved
65534 (0xFFFE) Reserved
65535 (0xFFFF) Deleted packet (may still exist in file)
Notes: The WP5.1 document prefix has the same structure as it does in WP5.0. However, some data packets have
different values in WP5.1 and add new packet types for WP5.1 additional features. Note the following changes listed
under packet types. WP5.0 and WP5.1 are forward and reverse compatible. When retrieved into WP5.0, additional
features of WP5.1 are recognized as [UNKNOWN] codes. When the document is again retrieved into WP5.1, the
[UNKNOWN] codes are recognized as their original features.
If Fast Save is not active in WordPerfect 5.1, the file prefix is purged of deleted packets (65535 [0xFFFF]) when the file is saved. If Fast Save is active, deleted packets can still exist in the file prefix after the file is saved.
WordPerfect Packet Types
The following are data packet types defined for WP5.0/5.1, and WPWin 5.1/5.2 documents that are found in the
additional prefix area. They are used or referred to in the general packet types structure.
Value Packet Type
1 Document summary packet
2 List of fonts used in document (WP5.0)
3 Document initial codes
4 Reserved
5 Reserved
6 Document specific flags
7 Font name string pool
8 Graphics information
9 Form hash table
10 (0xA) Reserved
11 (0xB) Reserved
12 (0xC) Document printer (.PRS file name, etc.)
13 (0xD) Reserved
14 (0xE) Supplemental dictionary compressed words
15 (0xF) List of fonts used in document (WP5.1)
16 (0x10) DDE link packet added for WPWin 5.1 (In UNIX 5.1 only, this packet # indicates the # of pages)
17 (0x11) Macro executable code added for WPWin 5.1
18 (0x12) Reserved
19 (0x13) Macro information block added for WPWin 5.1
20 (0x14) Reserved
21 (0x15) OLE prefix added for WPWIN 5.2
256 (0x100) First style packet # (use 256 packets for styles)
511 (0x1FF) Last style packet # (use 256 packets for styles)
512 (0x200) PS table packet -- first packet
767 (0x2FF) PS table packet -- last packet
The following are the related structures to the WordPerfect document prefix packet types:
Except for the fields marked and the last 3 fields in the WP5.1 format, all fields are null terminated strings.
If a user imports a 5.0 document file into the 11/6/89 release of WP5.1, and the file had a summary packet in it, the
following could happen: If the user never edited the summary information, this version of 5.1 would not rewrite the 5.0
summary packet. A document saved out of this version of 5.1, labeled as being a 5.1 document, but has a 5.0 formatted
summary packet. Keep this in mind if your program is reading WP5.1 files.
Field WP5.1 Max Len WP5.0 Max Len
Creation date (string form) 26 (w/null) 26 (w/null)
Descriptive name 68 (no null) 41 (w/null)
Descriptive type 21 (w/null) N/A
Lengths are padded with spaces to be exact, so that a document management program can change the name or type without completely rewriting the prefix packet.
Subject 161 40
Author 61 40
Typist 61 40
Abstract (comments in WP5.0) 781 780
End of WP5.0 Document Summary
Account 161 N/A
Key words 161 N/A
WP5.1 Format Marker 1 N/A (always equals -1 [FFh])
Creation date (10-byte) 10 N/A
WP5.1 Format Marker 1 N/A (always equals -1 [FFh])
Note:"WP5.1 Format Markers" are used by WP to determine whether the summary packet is in the format used by
WP5.0 (the markers don't exist) or the expanded format of WP5.1. If the end of the packet data has the value 0FFh (-1),
then it is a WP5.1 format. If the packet ends with zero, then it is a WP5.0 packet.
Packet Type 1 and the 10-byte Creation Date format for the Document Summary Packet is as follows:
Offset Size Meaning
0 short Year
2 1 byte Month
3 1 byte Day
4 1 byte Hour
5 1 byte Minute
The next four bytes are unused (0) in the Document Summary Packet, but are:
6 1 byte Second
7 1 byte Day_of_week
8 1 byte Time_zone
9 1 byte Unused
This packet is a variable-length list of records. To determine the number of these records, divide the size of the packet by
the size of the record structure below. The structure of these records is as follows:
Offset Size Usage
0 short Font ID (instance pointer)
2 short Cache ID of PS table (0xFF [1] = no PS table)
4 short Top shoulder height (psu)
6 short Bottom shoulder height (psu)
8 short Printed char width (wpu)
10 short Desired space width (wpu)
12 short Normal space width (wpu)
14 short Horizontal motion units
16 short Numerator for fractional units of horizontal motion
18 short Pointer into font string pool of font names
20 1 byte Flags
21 1 byte Available (to ensure short integer alignment)
22 short Printer point size in 3600ths (same as offset 26 if not scalable)
24 short Hash
26 24 bytes Offsets 0 - 20 of Font Descriptor (See Packet 15 [0xF] for format)
50 16 bytes AFC (Automatic Font Changes) list (attribute list)
66 16 bytes Character AFC list
82 4 bytes Orientation AFC list
This variable-length packet contains function codes as they appear inside a document. Setup Initial Codes inserts the
function codes originally, but you can modify them separately. They keep the system's setup environment and the
document together when both are moved to a different environment.
This packet contains information about the document itself at the time it was saved. The format of Packet Type 6 is as follows:
Offset Size Usage
0 1 byte Flag bits for document
bit 0:
0 = WPWIN Wysiwyg manual display pitch
1 = WPWIN Wysiwyg auto display pitch
bits 1 & 2:
0 = font change
1 = red color
2 = char in left margin
3 = char in alternating margins
bit 3 = 1 if document must be formatted
bit 4 = 1 if document must be (re)generated
bit 5 = 1 if manual display pitch
bit 6 = 1 if links must be updated on retrieval
bit 7 = 1 if links codes are not to be displayed
1 1 byte Low nibble = print quality
High nibble = graphics quality
For each nibble:
0 = don't print
1 = draft
2 = med
3 = high
2 short Redline character
4 short Width of screen character
6 short Binding width of document
8 1 byte Printer select cnt flag for eqn hash
9 1 byte Reserved
10 short Document display pitch. 0x100 = 100%
12 short Screen resolution
14 short Reserved
This variable-length packet contains the font names in the font list. The font list records each have a field that points to
an offset in this packet that indicates its font name. These are null-terminated, font-name strings.
Give special handling to the graphics image data (Packet Type 8). The index for this data packet must be the last index
in the prefix area (except for an End of Prefix index). The value of the long integer length given in the index is 2. The
graphic image data has the following structure:
Offset Size Usage
0 short Count of # of graphic images
2 long Size of first graphic image
6 long Size of second graphic image
10 long Size of third graphic image
.. .. ..
.. .. ..
(# graphics * 4)+2 variable Data for first graphic image (see the DrawPerfectsection of this manual for .WPG file formats)
+ size 1 variable Data for second graphic image
+ size 2 variable Data for third graphic image
.. .. ..
.. .. ..
.. .. ..
This variable-length packet is a list of hash values (short integers). The hash values correspond to each form that the user
defined. To determine the number of forms hashed, divide the packet size by 2.
This fixed-size packet contains information about the selected printer. The structure is as follows:
Offset Size Description
0 37 bytes Long name of .PRS file
37 13 bytes Actual .PRS filename
50 24 bytes Descriptor for initial font
74 short Minimum top margin
76 short Minimum bottom margin
78 short Minimum left margin
80 short Minimum right margin
82 1 byte Flags
bit 0 = used by printer selection to mark selected printer
bit 1 = initialize printer when WP starts
bit 3 = right hzone disabled
bits 4,5,6,7 = orientations supported
83 short Date of .PRS file
bits 0-4 = day (starting at 1)
bits 5-8 = month
bits 9-15 = year+80
85 short Time of .PRS file
bits 0-4 = seconds/2 (may not be too accurate)
bits 5-10 = minutes
bits 11-15 = hour (24 hour starting at 0)
87 short Point size of current font
89 1 byte Typeface flags
Structure of Prefix Font Information
The following 86-byte structure is repeated for each font in a document:
Offset Size Description In .PRS File
0 short Font ID (instance pointer) Font def
2 short Cache ID of PS table (1 [0xFF] = no PS table) Font def
4 short Top shoulder height (psu)
6 short Bottom shoulder height (psu)
8 short Printed char width (wpu)
10 short Optimal space width (wpu)
12 short Normal space width (wpu)
14 short Horizontal motion units
16 short Numerator for fraction units of horizontal motion Font def
18 short Pointer in font string pool of font name Font def
(see Packet 7)
20 1 byte Flags
21 short Hash of descriptor ("Match font hash value" in Function 209 (0xD1) Subfunction 1)
23 27 bytes Font descriptor (see Font Descriptor below)
50 16 bytes AFC list (prffont entry #'s, 1 (0xFF) = none)
66 16 bytes Char afc list
82 4 bytes Orientation afc list
Font Descriptor
Offset Size Description In .PRS File
0 short Cell height (5.0)(3600ths) Font def
2 short Optimal width (wpu) Font def
4 short Cap height (psu) Typeface def
6 short x height (psu) Typeface def
8 short Descender height (psu) Typeface def
10 short Italic adjustment (psu, ) Typeface def
12 3 bytes Typeface descriptor Typeface def
Low short integer:
bit 0 = 1 casual
bit 1 = 1 connected letters
bit 2 = 1 decorative
bit 3 = 1 formal
bit 4 = 1 future
bit 5 = 1 old style
bit 6 = 1 script or calligraphic
bit 7 = 1 cupped
bit 8 = 1 exaggerated
bit 9 = 1 hairline
bit 10 = 1 slab
bit 11 = 1 slanted
bit 12 = 1 transitional
bit 13 = 1 triangular
bit 14 = 1 curved or bowed diagonals
bit 15 = 1 nonconnecting enclosures
Offset Size Description In .PRS File
High byte:
bit 0 = 1 round
bit 1 = 1 square
bit 2 = 1 angular
bit 3 = 1 exaggerated
bit 4 = 1 uniform
bit 5 = 1 ball terminals
bit 6 = 1 tails
bit 7 = 1 reserved; must = 0
15 1 byte Typeface def flags; same format as offset 26, excluding the information added for WP5.1 (for WP5.0) Typeface def
16 1 byte Hash of typeface name Typeface def
17 1 byte Quality of the font (only relevant for .DRS fonts) Font def
18 short Hash of font name Font def
20 2 short Charset completeness bits Non-shareable font Def size
(The completeness bits are read from each of the 2 short integers.)
Low Short Int. High Short Int. Meaning
Bit n = Bit n =
0 0 Charset not supported
1 0 Charset supported 1%-25%
0 1 Charset supported 26%-59%
1 1 Charset supported 60%-100%
Note: The "n" in "Bit n =" equals the number of the character set. For example, if you wanted to check the completeness
of character set zero (the ASCII character set), you would look at bit zero (0) of the low and high short integers.
24 short Point size (5.1) (3600ths) Font def
26 1 byte Typeface def flags Typeface def
1 Small caps font
2 Shadow font
4 Outline font
8 Italic or oblique
16 (0x10) PS font (font descriptor only)
Weight -- high three bits
00000000b extra light
00100000b light
01000000b normal
01100000b demi-bold
10000000b bold
10100000b heavy added for WP5.1
11000000b black added for WP5.1
11100000b ultra-black added for WP5.1
The existence of this packet signifies that the document contains DDE links. The presence of this packet tells the Open
and Retrieve functions to scan the document and reestablish the links.
Offset Size Description
0 long # of pages
This packet is a part of every macro file.
Offset Size Description
0 10 bytes Creation date (if this is altered, the macro is recompiled at run-time)
Note: For creation date format, see Document Summary Packet (prefix packet 1).
10 short File type
12 short Major version
14 short Minor version
16 short Maintenance version
18 short Language (for example, US, UK, etc.)
19 short # of product types in macro
The following section is repeated for each product type in offset 19 (above):
.. 2 short int. Product (for example, WPWP)
.. short Product major version
.. short Product minor version
.. short Product maintenance version
Offset Size Description
0 1 byte Object Information Structure major version (currently always 1)
1 1 byte Object Information Structure minor version (currently always 0)
2 short Size of Object Information Structure (currently always 4)
4 short # of OLE objects
Note: The following information repeats for each object in the packet. Offset 4 determines how many times the
information will be repeated.
6 short Size of object name (includes the NULL)
8 variable Object name (null-terminated ANSI string)
.. variable Object information structure (currently contains only an unsigned long integer value. The value is the size of the OLE object)
.. variable OLE object
Prefix structure of style packet types. The style library file format is the same as the style prefix information.
A style is stored in the prefix in two parts:
PART_1: Name Type Description Unique#
sizes: 21 1 55 1
PART_2: BegSize BegHash EndSize EndHash XtrSize BegText EndText
sizes: 2 2 2 2 2 .. ..
Field Meaning
Name A short name for the style, the actual identifier for the style
Type Information about the style
bit 0 set = paired type style
bit 0 clear = global type style
bit 6,7
0 = Enter = HRt
2 = Enter = Off
3 = Enter = Off/On
Description A lengthy description for human use only
Unique# A # to identify this style from others
BegSize The size of the beginning text
BegHash The hash value of the beginning text
EndSize The size of the ending text
EndHash The hash value of the ending text
XtrSize The size of the extra text (auto-added to End_Text)
BegText Text and function codes in the Style On code
EndText Text and function codes in the Style Off code
Xtrtext Codes added to the Style Off code
Structure of Prefix PS Information
The first three fields uniquely identify a PS table entry:
Offset Size Meaning
0 1 byte PS status flag (0 = bytes, 1 = short int.)
1 1 byte Reserved
2 16 short Pointers to the 16-character sets (1 = pointer is being used)
34 variable Char widths
.. .. ._________________.
.. char set 1 | Last char or count | Note: last char + 1 = count
.. .. | char 0 width |
.. .. | char 1 width |
.. .. | .. |
.. .. | .. |
.. .. | .. |
.. .. ._________________.
.. char set 2 | Last char or count |
.. .. | char 0 width |
.. .. | char 1 width |
.. .. | .. |
.. .. | .. |
One of the following two conditions signals the end of the prefix data: when an index with a packet type of End of Prefix
(0) is encountered, or when the pointer to the next index block in the special header index is equal to 0.
To quickly create a simple but valid WordPerfect document prefix, use the following information. This abbreviated
prefix enables successful retrieval into WordPerfect. WordPerfect adds the remaining information when the document is
saved after bringing it into WordPerfect (The following values are all in hexadecimal).
FF 57 50 43 4C 00 00 00 01 0A 00 00 00 00 00 00
FB FF 05 00 32 00 00 00 00 00 06 00 08 00 00 00
42 00 00 00 08 00 02 00 00 00 4A 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 08 00 7C 00 78 00 00 00 00 00
Note:This generic prefix is on disk so you do not have to type it in. It is saved under the filename "PREFIX.QCK." Refer to the "Toolkit Diskette" section to find which disk this file is on.