Chart Record Data



This section describes the format for the chart data records. The record types are contained within the WPG Chart_Data record, type 17 (0x11), and make up the data description. See Record Type 17 (0x11) Chart_Data in Record Descriptions in the Record Area section of this manual for the complete format of this record.

All records in this section begin with a short integer that indicates the type of record, followed by a short integer that indicates the size of the record body.


Record Descriptions

The following is a short list of the Chart_Data record types. Detailed information about each record type follows this list.



Type # Record Description
0 (0x00) External Link/Import (must be first section)
1 (0x01) Spreadsheet Information
2 (0x02) Reserved
3 (0x03) Column Information
4 (0x04) Row Information
5 (0x05) Reserved
6 (0x06) Start of Cells Marker (must be last section)
7 (0x07) Reserved
8 (0x08) Reserved
9 (0x09) Reserved
10 (0x0A) Chart Titles
11 (0x0B) Reserved
12 (0x0C) Reserved
13 (0x0D) Reserved
14 (0x0E) Reserved
15 (0x0F) Reserved
16 (0x10) Reserved
17 (0x11) Reserved
18 (0x12) Reserved
19 (0x13) Reserved
20 (0x14) Custom Date Format code




The first record type must be the External Link/Import record. If it is not the first record, the Hot-Linking feature will not work properly. There can be more than one record of each type except for the Start of Cells Marker record.


Record Type 0 (0x00)

External Link/Import

Description

Contains external linking/importing information.

Structure

[beginning row of imported block]

[ending row of imported block]

[beginning column of imported block]

[ending column of imported block]

<beginning sheet of imported block>

<ending sheet of imported block>

[row # for insertion point of import]

[column # for insertion point of import]

[MS-DOS date of file when last imported]

[MS-DOS time of file when last imported]

[link status (0 - no link, 1 - warm-link)]

[clear status (1 - clear spreadsheet before importing)]

[transpose status (1 - transpose data on import)]

[chart link #]

If # = 0, not linked to a chart

If # > 0, chart # linked to

<range name to import (ASCII null terminated)> x 21

<full path of import filename (ASCII null terminated)> x 81


Record Type 1 (0x01)

Spreadsheet Information

Description

Contains current spreadsheet global settings.

Structure

[column # of upper-left cell in display window]

[row # of upper-left cell in display window]

[default column width (in characters)]

[current row]

[current column]

[top, left, bottom, and right of current selection block] x 4

[current blocking mode]

0 = none

1 = cells

2 = rows

3 = columns

4 = sheet

<auto redraw flag (0 = none, 1 = auto redraw)>


Record Type 2 (0x02)

Reserved


Record Type 3 (0x03)

Column Information

Description

Contains column information for a single column.

Structure

[column #]

<column status bits>

bit 0: If 0, include column

If 1, exclude column

<reserved>

[format/type of column data (see Status Definition later in this section)]

[reserved]

[length of column formula (in short integers, not bytes)]

[column formula (stored as a series of short integers)] x ? See Row/Column Formula Definition later in this section


Record Type 4 (0x04)

Row Information

Description

Contains row information for a single row.

Structure

[row #]

<row status bits>

bit 0: If 0, include row

If 1, exclude row

<reserved>

[format/type of Row data (see Status Definition later in this section)]

[reserved]

[length of Row formula (in short integers, not bytes)]

[row formula (stored as a series of short integers, see Row/Column Formula Definition later in this section)]


Record Type 5 (0x05)

Reserved


Record Type 6 (0x06)

Start of Cells Marker

Description

Signals the beginning of the cell data. Cells are stored in row order in the file beginning with 0,0. Only cells that contain data are saved in the file. Each cell is stored in the following format:

Structure

<cell Type (see Cell Type Flags later in this section)>

[cell row (zero offset)]

[cell column (zero offset)]

[cell format (see Status Definition later in this section)]

cell value (see Notes)

Notes

If the current cell is not adjacent to the previous cell (see Cell Type Flags later in this section), the Cell Row and Cell Column fields follow.

If the current cell format is different from the previous cell format (see Cell Type Flags later in this section), the Cell Format field follows.

"Cell value" does not exist if "Cell Type" is none. The cell value is stored last in one of the formats shown in the table below.



Cell Type Cell Value Format
Word string [length of string (in short integers, not bytes)]

[cell string (word string)] x ?

Byte string

(standard string)

[length of string (in bytes)]

<cell string> x ?

Double value IEEE 8-byte floating-point value
Floating-point value {IEEE 4-byte floating-point value}
Integer value [signed 2-byte cell value]




A row and column number of -1 (0xFFFF) signals the end of the cell data and the end of the chart data section.


Record Type 10 (0x0A)

Chart Titles

Description

Contains all titles for the associated chart.

Structure

<# of titles in this record (for now, always = 6)>

<size of chart title 1 (in short integers, not bytes)>

[chart title 1 (word string)] x ?

<size of chart title 2 (in short integers, not bytes)>

[chart title 2 (word string)] x ?

..

..

..

Notes

Titles are stored in the following order:

1 - Main chart title

2 - Chart subtitle

3 - Y1 Axis title

4 - Y2 Axis title

5 - X Axis title

6 - Legend title


Record Type 20 (0x14)

Custom Date Format Code

Description

Contains WordPerfect date codes for the custom date format.

Structure

<# of strings in this record>

<length of WPCorp date string 1>

<WPCorp date format string 1> x ?

<length of WPCorp date string 2>

<WPCorp date format string 2> x ?

..

..

..


Status Definition

A short integer associated with each cell (and each row and column) indicates the type of value stored in the cell and the formatting options that apply to that value.



Bit

Meaning

0-3 If cell type is NUMBER: # of digits to display (see bit 4).
If cell type is DATE: Specifies one of the 16 date format types.
4 If cell type is NUMBER: If bit 4 is set, use precision indicated in bits 0-3.

If bit 4 is not set, use floating precision.

If cell type is DATE: If bit 4 is set, use date format indicated in bits 0-3.

If bit 4 is not set, use default date format.

5 If set, display # in exponential notation
6 If set, display cell as a DATE
7 Reserved
8 If set, display # with a dollar sign
9 If set, display # with thousands separators
10 If set, display # as a percent
11 If set, display negative #s in parentheses
12 Reserved
13-15 Cell type: 0 - NULL cell.

1 - NUMBER cell.

2 - STRING cell.

3 - ERROR cell.

7 - ROW/COL FORMULA (only in rows or columns).






Row/Column Formula Definition

Row/Column formulas apply to an entire row or column. They are stored as a series of tokens as defined below. Each token is a short integer.

[Function Tokens]

Single tokens (no data follows).



Token Meaning
1 (0x01) Absolute value
2 (0x02) Average
3 (0x03) Cosine
4 (0x04) Cumulative total
5 (0x05) Difference
6 (0x06) Exponential curve fit
7 (0x07) Linear curve fit
8 (0x08) Log curve fit
9 (0x09) Polynomial curve fit
10 (0x0A) Power curve fit
11 (0x0B) Maximum
12 (0x0C) Minimum
13 (0x0D) Moving average
14 (0x0E) Percent of total
15 (0x0F) Sine
16 (0x10) Sum




[Reference Tokens]

Refer to rows (or columns) in the spreadsheet.



Token Related Arguments
100 (0x64) [relative row (or column)]
101 (0x65) [absolute row (or column)]
102 (0x66) [relative row (or column) range (beginning)]

[relative row (or column) range (ending)]

103 (0x67) [absolute row (or column) range (beginning)]

[absolute row (or column) range (ending)]





[Misc. Tokens]



Token Meaning Related Arguments
106 (0x6A) Value [a # (used as an argument)]
120 (0x78) Missing


The "Missing" token represents a missing argument that was optional.

Examples

Example 1 shows a formula in row 5 that sums rows 1:4 would be stored as follows:



Value Size/Meaning
16 (0x10) [sum]
102 (0x66) [relative row range]
-4 (0xFFFC) [four rows back from current row]
-1 (0xFFFF) [one row back from current row]




Example 2 shows a formula in row 5 that fits a 2nd order polynomial of rows 4 with a forecast of 5 would be stored as follows:



Value Size/Meaning
9 (0x09) [polynomial curve fit]
100 (0x64) [relative row]
-1 (0xFFFF) [one row back from current row]
106 (0x6A) [value]
2 (0x02) [2nd order]
106 (0x6A) [value]
5 (0x05) [forecast 5 periods]





Cell Type Flags

The first byte of each cell is the Cell Type. The bits in this byte allow standard chart data to be stored in a compact format. Most chart data are together in a block and have the same format. Therefore, only the Cell Type byte and the data need to be written in these cases. Whenever there is a break in the block of cells, bit 5 and 6 are clear and the row and column for the cell have to be written. Also, whenever there is a break in the format, bit 7 is clear and the cell format needs to be written.



Bit

Meaning

0-4 Data type: 0 = None (no cell data exists, only formatting information).

1 = DOUBLE - cell contains an IEEE 8-byte double value

2 = FLOAT - cell contains an IEEE 4-byte floating-point value

3 = INT - cell contains a signed-integer value

4 = WORDSTR - cell contains a WP WORD string

5 = BYTESTR - cell contains a BYTE string.

5 If set, the column for this cell is the same as the previous cell plus 1. If this bit is set, no row or column is stored in the file for this cell.
6 If set, the row for this cell is the same as the previous cell plus 1. If this bit is set, no row or column is stored in the file for this cell.
7 If set, the format of this cell is the same as the format for the previous cell. If this bit is set, the format word is not stored in the file for this cell.