8.3.3 Sections

A Write document has only one section. If the section properties of a Write document differ from the defaults, the document contains a section property (SEP) section and a section table (SETB) section. If not, then neither section is present and pnSep and pnSetb are both equal to pnPgtb.

Following is the format of an SEP:

Byte Name Description

0 cch Count of bytes used, excluding this byte (all properties at byte positions greater than cch are set to their default values)
1–2   Reserved; must be zero
3–4 yaMac Page length, in 20ths of a point (default is 11*1440=15840)
5–6 xaMac Page width, in 20ths of a point (default is 8.5*1440=12240)
7–8   Reserved; must be 0xFFFF
9–10 yaTop Top margin, in 20ths of a point (default is 1440)
11–12 dyaText Height of text, in 20ths of a point (default is 9*1440=12960)
13–14 xaLeft Left margin, in 20ths of a point (default is 1.25*1440=1800)
15–16 dxaText Width of text area, in 20ths of a point (default is 6*1440=8640)

The page length (yaMac) is equal to yaTop+dyaText. The page width (xaMac) is equal to xaLeft+dxaText+(right margin, not stored).

If all the above properties are set to their defaults, no SEP or SETB is needed. Otherwise, the count of characters (cch) is greater than or equal to 1 and less than or equal to 16.

The SETB section contains an array of section descriptors (SEDs), described later in this section. Following is the structure of an SETB:

Word Name Description

0 csed Number of sections (always 2 for Write documents)
1 csedMax Undefined
n rgsed Array of SEDs plus zero-padding to fill the sector

Following is the structure of an SED:

Word Name Description

0–1 cp Byte address of first character following section
2 fn Undefined
3–4 fcSep Byte address of associated SEP

A Write document always has exactly two SED entries. The cp value of the first entry indicates that it affects all the characters in the document. The fcSep value of the first entry points to the one SEP in the file. The second SED entry is a dummy with fcSep set to 0xFFFFFFFF.

The PGTB section (optional) is on the page immediately after the SEP section.

Note:

The term “page” used in the rest of this section refers to printed pages of a Write document, not 128-byte “pages” of a disk file.

The page table (PGTB) contains an array of page descriptors (PGDs), which are described later in this section. Following is the structure of a PGTB:

Word Name Description

0 cpgd Number of PGDs (1 or more)
1 cpgdMac Undefined
n rgpgd Array of PGDs plus zero padding to fill the sector

Following is the structure of a PGD:

Word Name Description

0 pgn Page number in printed Word documents
1–2 cpMin Byte address of first character on printed page