Lotus published the layout of its worksheet files in 1984, in a document called
Worksheet File Format, which covers 1-2-3 Release 1A (.wks) and
Symphony (.wrk). Release 2 (.wk1, 1985) kept the same records
and added more, which that document does not describe. This page lists every record the
document defines. All numbers are little-endian; rows and columns count from 0, so
cell A1 is column 0, row 0, and column IV is 255.
Record header
| Offset | Size | Field | Meaning |
|---|---|---|---|
0 | 2 | type | The record type (opcode). |
2 | 2 | length | Length of the body that follows, in bytes. |
The file is just records one after another, from BOF to
EOF. A reader can skip any record it does not know by its length. Below,
offsets are within the body, and a range is four 2-byte values: start
column, start row, end column, end row.
BOF and EOF
| Type | Name | Length | Body |
|---|---|---|---|
0x00 | BOF | 2 | Revision: 0x0404 1-2-3 Release 1A (.wks), 0x0405 Symphony, 0x0406 1-2-3 Release 2 (.wk1). |
0x01 | EOF | 0 | None; the last record. |
The Lotus document lists only the first two revision numbers; 0x0406
is the value Release 2 writes, as found in WK1 files.
Worksheet settings
| Type | Name | Length | Body |
|---|---|---|---|
0x02 | CALCMODE | 1 | 0x00 manual recalculation, 0xFF automatic. |
0x03 | CALCORDER | 1 | 0x00 natural order, 0x01 by column, 0xFF by row. |
0x04 | SPLIT | 1 | Window split: 0x00 none, 0x01 vertical, 0xFF horizontal. |
0x05 | SYNC | 1 | Split windows scroll together: 0x00 no, 0xFF yes. |
0x06 | RANGE | 8 | The range that holds data; start column −1 if the sheet is empty. |
0x07 | WINDOW1 | 31 | Window 1 settings. |
0x08 | COLW1 | 3 | Column (2 bytes) and its width in characters (1 byte), window 1. |
0x09 | WINTWO | 31 | Window 2 settings, as WINDOW1. |
0x0A | COLW2 | 3 | Column width in window 2. |
0x0B | NAME | 24 | Named range: 16-byte zero-terminated name, then the range. |
0x24 | PROTEC | 1 | Global protection: 0 off, 1 on. |
0x29 | LABELFMT | 1 | Default label alignment: 0x27 (') left, 0x22 (") right, 0x5E (^) centre. |
0x2F | CALCCOUNT | 1 | Number of recalculation iterations. |
0x31 | CURSORW12 | 1 | Cursor in window 1 or 2. |
WINDOW1 and WINTWO
| Offset | Size | Field |
|---|---|---|
0 | 2 | Cursor column |
2 | 2 | Cursor row |
4 | 1 | Default cell format |
5 | 1 | Unused, 0 |
6 | 2 | Default column width |
8 | 2 | Columns on screen |
10 | 2 | Rows on screen |
12 | 2 | Left column shown |
14 | 2 | Top row shown |
16 | 2 | Number of title columns |
18 | 2 | Number of title rows |
20 | 2 | Left title column |
22 | 2 | Top title row |
24 | 2 | Border width, column |
26 | 2 | Border width, row |
28 | 2 | Window width |
30 | 1 | Unused, 0 |
Cell records
| Type | Name | Length | Body |
|---|---|---|---|
0x0C | BLANK | 5 | Format, column, row. Written only for empty cells that are protected or have a non-default format. |
0x0D | INTEGER | 7 | Format, column, row, signed 16-bit value. |
0x0E | NUMBER | 13 | Format, column, row, IEEE 754 double. |
0x0F | LABEL | varies | Format, column, row, zero-terminated text (up to 240 bytes) starting with its prefix character. |
0x10 | FORMULA | varies | Format, column, row, the last result (double), the formula length (2 bytes) and the compiled formula (up to 2,048 bytes). |
Their contents are described on Cells and formulas.
Ranges for commands
| Type | Name | Length | Body |
|---|---|---|---|
0x18 | TABLE | 25 | Data table: 1 byte table type (0 none, 1 Table 1, 2 Table 2), the table range, input cell 1 and input cell 2 (each 8 bytes in range form). |
0x19 | QRANGE | 25 | Query: input, output and criteria ranges, then the last command (0 none, 1 find, 2 extract, 3 delete, 4 unique). |
0x1A | PRANGE | 8 | Print range. |
0x1B | SRANGE | 8 | Sort range. |
0x1C | FRANGE | 8 | Fill range. |
0x1D | KRANGE | 9 | Primary sort key: range, then order (0x00 descending, 0xFF ascending). |
0x20 | HRANGE | 16 | Distribution: values range and bin range. |
0x23 | KRANGE2 | 9 | Secondary sort key, as KRANGE. |
Printing
| Type | Name | Length | Body |
|---|---|---|---|
0x25 | FOOTER | 242 | Footer text, zero-terminated. |
0x26 | HEADER | 242 | Header text, zero-terminated. |
0x27 | SETUP | 40 | Printer setup string, zero-terminated. |
0x28 | MARGINS | 10 | Left, right, page length, top and bottom, 2 bytes each. |
0x2A | TITLES | 16 | Print borders: row range and column range. |
0x30 | UNFORMATTED | 1 | 0 formatted, 1 unformatted output. |
GRAPH and NGRAPH
0x2D GRAPH (437 bytes) holds the current graph; 0x2E
NGRAPH (453 bytes) a named graph, with a 16-byte name in front and the same fields
16 bytes further on. GRAPH:
| Offset | Size | Field |
|---|---|---|
0 | 8 | X range |
8 | 8 × 6 | Data ranges A to F |
56 | 8 × 6 | Data label ranges A to F |
104 | 1 | Type: 0 XY, 1 bar, 2 pie, 4 line, 5 stacked bar |
105 | 1 | Grid: 0 none, 1 horizontal, 2 vertical, 3 both |
106 | 1 | 0 black and white, 0xFF colour |
107 | 6 | Line format for A to F: 0 none, 1 line, 2 symbol, 3 both |
113 | 6 | Data label position for A to F: 0 centre, 1 right, 2 below, 3 left, 4 above |
119 | 1 | X scale: 0 automatic, 0xFF manual |
120 | 8 + 8 | X lower and upper limits (doubles) |
136 | 1 | Y scale: 0 automatic, 0xFF manual |
137 | 8 + 8 | Y lower and upper limits |
153 | 40 × 4 | First and second titles, X axis and Y axis titles |
313 | 20 × 6 | Legends A to F |
433 | 1 | X axis number format |
434 | 1 | Y axis number format |
435 | 2 | Skip factor (label every nth X value) |
The Lotus document’s NGRAPH table has gaps and numbering slips (it lists the first title from offset 209 while the Y limits end at 168); a reader is safest taking NGRAPH as the 16-byte name followed by a GRAPH body.
Symphony-only records
These appear in Symphony worksheets (.wrk, .wr1), not in
1-2-3 files; they are listed so a reader recognises them.
| Type | Name | Length | Purpose |
|---|---|---|---|
0x32 | WINDOW | 144 | A named Symphony window: type (sheet, doc, graph, comm, form), ranges, display and document settings. |
0x33 | STRING | varies | Text result of a string formula: format, column, row, zero-terminated text. |
0x37 | PASSWORD | 4 | File lock checksum (not documented). |
0x38 | LOCKED | 1 | 0 off, 1 on. |
0x3C | QUERY | 127 | Named query settings. |
0x3D | QUERYNAME | 16 | Current query name. |
0x3E | 679 | Named print settings. | |
0x3F | PRINTNAME | 16 | Current print settings name. |
0x40 | GRAPH2 | 499 | Named Symphony graph. |
0x41 | GRAPHNAME | 16 | Current graph name. |
0x42 | ZOOM | 9 | Zoom flag, x, y, column and row depth. |
0x43 | SYMSPLIT | 2 | Number of split windows. |
0x44 | NSROWS | 2 | Screen rows. |
0x45 | NSCOLS | 2 | Screen columns. |
0x46 | RULER | 25 | Named ruler: name, range, single cell or range. |
0x47 | NNAME | 25 | Named sheet range, as RULER. |
0x48 | ACOMM | 65 | Path of the communications file to load automatically. |
0x49 | AMACRO | 8 | Range of the macro to run on loading. |
0x4A | PARSE | 16 | Query parse and review ranges. |
Release 2 additions
Release 2 (.wk1) adds record types and formula function codes that
Lotus did not include in the published 1984 document, and no other public
description of them was found for this page, so they are not listed here. A reader that skips unknown records by
length can still read every cell of a WK1 file.