home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsr
/
sprfil
/
SPRFILES.TXT
Wrap
Text File
|
1992-10-06
|
25KB
|
855 lines
Series 3/MC Spreadsheet File Format
This document describes the structure of .SPR files used
by the MC and Series 3 spreadsheets. It is based around a
similar document produced specifically for V1.07f and
1.08f of the MC spreadsheet.
Header
The spreadsheet starts with the following header:
TEXT fid[16]="SPREADSHEET" packed with zeros
UWORD vers=0
UWORD offset=0
UWORD rtvers=0
This header must be supplied exactly for current versions
of the spreadsheet to load the file.
Records
The remainder of the file consists of type/length
records:
UWORD type the type of the following record
UWORD len the length of the following record
Record Data len bytes
The structure of the record data is dependent on the
record type and currently the following types are defined
1 Formula
2 Cell contents
3 Column width
4 Default column width
5 Status information
6 Display information
7 Named range
8 Print range
9 Database/criteria ranges
10 Table
11 Print setup (MC)
12 Font (MC)
13 Graph (S3)
14 Current graph index (S3)
15 Font palette (S3)
16 Print data (S3)
17 Printer model (S3)
Page - 1
Series3/MC spreadsheet file format
18 Header text (S3)
19 Footer text (S3)
20 Screen extras (S3)
As indicated some of the above types are specific to the
MC version and some to the Series 3.
By and large records can appear in any order, there are
currently just two exceptions to this. All formulae
records (type 1) must appear before the cells (type 2)
that access them, and the order in which they appear
should be preserved. The Screen Extras record (type 20),
when present, should immediately precede the Display
information record (type 6), if not it will be ignored.
Some record types may appear many times and not all
record types need be present, an indication of which are
which is given in the following sections.
Withinrecords range references specify top left, botton
right cells in terms of columns and rows. These refernces
are inclusive, i.e. {{0,0},{1,2}} is a range A1:B3.
Formula record (type 1, length variable)
Formulae are stored seperately from the cells that use
them. This allows memory savings to be made by storing
only one copy of a commonly used formula.
The record data for a formula is structured as follows:
UWORD use usage count
UBYTE len formula length
UBYTE form[len]
The formula is stored in Reverse Polish Notation. All
operands are preceeded by a byte that identifies their
type. There is no difference between the way functions
and operators are treated; both are identified by a
single byte following the operands they act on.
Brackets are stored as entered and are ignored when
evaluating formulae. They are supplied only so that
formulae can be reproduced as typed in.
The RPN structure is broken for one set of functions.
These are the functions acting upon variable length lists
(AVG, COUNT, MAX, MIN, STD, SUM and VAR). The have Start
and End tokens either side of the arument list and each
operand within the list is preceded by a special token.
The tokens used in formulae are as follows:
Page - 2
Series3/MC spreadsheet file format
Operators
0x01 Less than
0x02 Less than or equal
0x03 Greater than
0x04 Greater than or equal
0x05 Not equal
0x06 Equal
0x07 Add
0x08 Subtract
0x09 Multiply
0x0a Divide
0x0b Power
0x0c Unary plus
0x0d Unary minus
0x0e Logical not
0x0f Logical and
0x10 Logical or
0x11 String concatinate
Delimiters
0x12 Open bracket
0x13 Close bracket
0x14 Comma
0x15 End of formula
Operands
0x16 Double constant (IEEE floating point number)
0x17 Integer constant (WORD)
0x18 Text string (Leading byte counted string)
0x19 Cell reference (WORD col, WORD row)
0x1a Range reference (WORD tlCol, WORD tlRow, WORD
brCol, WORD brRow)
Column or row references can either be absolute or
relatuve, dependent on the top bit of the WORD. If the
top bit is set (TRUE) the reference is relative,
otherwise, the reference is absolute. Relative references
are treated as a signed offset (ignoring the top bit)
from the cell which uses the formula. NOTE cell A1 is
0,0.
Functions
In the following, 'x' refers to a numeric argument, 'str'
a string and 'range' a range reference.
0x1b Err
0x1c False
0x1d Na
0x1e Pi
0x1f Rand
0x20 Now
Page - 3
Series3/MC spreadsheet file format
0x21 True
0x22 Abs(x)
0x23 Acos(x)
0x24 Asin(x)
0x25 At(str)
0x26 Atan(x)
0x27 Cellpointer(x)
0x28 Char(x)
0x29 Code(str)
0x2a Cols(range)
0x2b Cos(x)
0x2c Datevalue(str)
0x2d Day(x)
0x2e Exp(x)
0x2f Hour(x)
0x30 Int(x)
0x31 Iserr(range)
0x32 Isna(range)
0x33 Isnum(range)
0x34 Isstr(range)
0x35 Len(str)
0x36 Ln(x)
0x37 Log(x)
0x38 Lower(str)
0x39 Minute(x)
0x3a Month(x)
0x3b N(range)
0x3c Proper(str)
0x3d Rows(range)
0x3e S(range)
0x3f Second(x)
0x40 Sin(x)
0x41 Sqrt(x)
0x42 Tan(x)
0x43 Timevalue(str)
0x44 Trim(str)
0x45 Upper(str)
0x46 Value(str)
0x47 Year(x)
0x48 Atan2(x,x)
0x49 Cell(x,range)
0x4a Exact(str,str)