8.1 Write-File Header

The Write-file header describes the content of the file. It contains data, pointers to subdivisions of the formatting section, and information about the length of the file. The file header has the following form:

Word Name Description

0 wIdent Must be 0137061 octal (or 0137062 octal if the file contains OLE objects)
1 dty Must be zero
2 wTool Must be 0125400 octal
3   Reserved; must be zero
4   Reserved; must be zero
5   Reserved; must be zero
6   Reserved; must be zero
7–8 fcMac Number of bytes of actual text plus 128, the bytes in one sector (low-order word first)
9 pnPara Page number for start of paragraph information
10 pnFntb Page number of footnote table (FNTB) or pnSep, if none
11 pnSep Page number of section property (SEP) or pnSetb, if none
12 pnSetb Page number of section table (SETB) or pnPgtb, if none
13 pnPgtb Page number of page table (PGTB) or pnFfntb, if none
14 pnFfntb Page number of font face-name table (FFNTB) or pnMac, if none
15–47 szSsht Reserved for Microsoft Word compatibility
48 pnMac Count of pages in whole file (last page number plus 1)

In the preceding list, a “page number” means an offset in 128-byte blocks from the start of the file. For example, if pnPara equals 10, the paragraph information is at offset 10*128 = 1280 in the file.

The starting page number of character information (pnChar) is not stored but is computable, as follows:

pnChar = (fcMac + 127) / 128

Examining the value of word 48 of the header is a good way to distinguish Write files from Microsoft Word files. If pnMac equals zero, the file originated in Word. Any other value identifies a Write file.