Lotus DIF

Also Known As: DIF, Data Interchange Format


Type Vector
Colors NA
Compression None
Maximum Image Size Unknown
Multiple Images Per File No
Numerical Format NA
Originator Software Arts
Platform MS-DOS
Supporting Applications Spreadsheets, others
See Also Microsoft SYLK

Usage
Exchange of numerical data often associated with spreadsheets.

Comments
Not usually considered a graphics format but often a carrier of graphics data. Big- and little-endian issues are moot because data is stored as 7-bit ASCII.


The Lotus DIF (Data Interchange Format) is used for the storage and exchange of numeric data between applications such as spreadsheets. Although DIF is not usually considered a graphics file format, it is vector-based and often carries information used to generate both bitmap and vector images. It is of interest because the data is always stored in ASCII format.

Contents:
File Organization
File Details
For Further Information

DIF was developed by Software Arts and originally appeared along with the VisiCalc spreadsheet program, which was first released in 1979. Because most spreadsheet applications have their own native file format for storing information, it is usually not possible for a single application to support every other format. DIF has become one of the commonly used interchange formats, perhaps because it has been around so long.

A spreadsheet is a 2D matrix of storage cells, each of which contains numeric data, text data, and formulas. Stored along with the data item in each cell is a unique identifier, usually the coordinates associated with the cell itself. Spreadsheet files also may contain information relevant only to the originating application, which is normally ignored by an application seeking to extract the data for other uses.

Popular software applications that support DIF include Lotus 1-2-3 and Borland's Quattro Pro. Since DIF files contain only 7-bit ASCII characters, they can be edited using a simple text editor. DIF is also independent of any hardware issues.

File Organization

A DIF file consists of a header followed by a block of data. The header starts with the ASCII text:

TABLE
0,1
"string"

where string is any ASCII string, often the name of the file or other identifying information. The header ends with the following:

DATA
0,0
""

Following this is the actual spreadsheet cell data and records containing information to be used in modifying this data.

File Details

This section describes the format of the DIF header and the different types of records.

Header

The header consists of a number of entries, each consisting of a record type keyword, a numeric value, and an optional text string. These are arranged as follows:

Record Type
Vector, value
"string"

The Record Type field identifies the data following the field to the rendering or manipulating application. The Vector value affects the interpretation of the value data and indicates the spreadsheet column to which the value data is to apply. A value of zero means that the data applies to the entire spreadsheet. The value field must be zero if data in the Vector field is nonzero. The string field is contained in double quotes, with empty double quotes ("") indicating an empty string.

Record Types

Possible record types are as follows:

TABLE
VECTORS
TUPLES
DATA
COMMENT
LABEL
UNITS
TRUELENGTH
MINORSTART
MAJORSTART
PERIODICITY
SIZE
DISPLAYUNITS

Only the first four record types must appear in every header: TABLE, VECTORS, TUPLES, and DATA.

Data following TABLE entries has the following format:

0,1
"string"

where string is any ASCII string.

Data following VECTORS entries has the following format:

0,columns
""

where columns is the number of columns in the spreadsheet.

Data following TUPLES entries has the following format:

0,rows
""

where rows is the number of rows in the spreadsheet.

Data following DATA entries has the following format:

0,0
""

and marks the end of the header.

Data following COMMENT entries has the following format:

column,lines
"string"

which is similar to the definition of LABEL.

Data following LABEL entries has the following format:

column,lines
"string"

where column is the starting column of the LABEL stored as string, and lines is the number of columns spanned by LABEL, usually one.

Data following UNITS entries has the following format:

columns,0
"string"

where string denotes the units of measurement associated with the values in the columns of the spreadsheet.

Data following TRUELENGTH entries has the following format:

column-number,rows
""

where rows is the number of rows containing actual data.

Data following MINORSTART entries has the following format:

column-number,time-value
""

where time-value is the month, day, hour, or second relevant to the start of the data in the column referred to.

Data following MAJORSTART entries has the following format:

column-number,first-year
""

where first-year denotes the year data in the column referred to.

Data following PERIODICITY entries has the following format:

columns,period
""

where period is the time duration of time-oriented data.

Data following SIZE entries has the following format:

column-number,bytes
""

where bytes is the width of columns in bytes.

Data following DISPLAYUNITS entries has the following format:

columns,0
"string"

where string denotes information associated with display devices.

Data

Data record structures have the following format:

data-type,data
"string"

data-type can be SPECIAL, NUMERIC, and STRING, denoted by -1, 0, and 1, respectively.

SPECIAL data appears as follows:

-1,0
BOT
 
.
.
.
-1,0 EOD

where BOT and EOD are strings (without quotes) denoting beginning-of-table and end-of-data, respectively.

NUMERIC data appears as follows:

0,data
value-indicator

where value-indicator indicates the type of data stored in data:

TRUE

1

FALSE

0

V

any numeric value

NA

not known

ERROR

0

String data appears as follows:

1,0
"string"

where string is any text string.

For Further Information

For further information about the Lotus DIF file format, you might try contacting Lotus at:

Lotus Development Corporation
55 Cambridge Parkway
Cambridge, MA 02142
Voice: 617-577-8500
Voice: 800-831-9679
FAX: 617-225-1197

Information for this article came from the DIF Technical Specification published by:

DIF Clearinghouse
P.O. Box 638
Newton Lower Falls, MA 02162

The Clearinghouse apparently no longer exists, but you may be able to find this document in archives and libraries under their authorship. It is our understanding that responsibility for DIF maintenance has devolved to Lotus, though it is not clear whether Lotus owns or has access to the original DIF Clearinghouse documents. Lotus, of course, is now owned by IBM.

An interesting account of the DIF format, by Candace Kalish and Malinda Mayer, was published in the November 1981 issue of byte magazine.

The following publications also contain information about DIF:

Beil, Donald H., The DIF File, Reston Publishing Co., Reston, VA, 1983.

Walden, Jeffrey B., File Formats for Popular PC Software, John Wiley & Sons, New York, NY, 1986.



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.