Fast Table Format

The fast table format, XlTable, is designed to maximize the DDE transfer speed of Microsoft Excel. XlTable consists of a sequence of data blocks that represent a rectangular selection of cells (a table). Each data block has three parts:

WORD tdt            /* the table data type */
WORD cb            /* the size (count of bytes) of the data */
BYTE data[cb]    /* the data */

The first data block is always of type tdtTable, which specifies the number of rows and the number of columns in the table. The data blocks that follow tdtTable represent all the cells in the table. Microsoft Excel renders the reference of the cells in the table (for example, R1C1:R2C4) as the item part of the DDE message.

The cells are always rendered row-wise. In other words, all the cells in the first row of the table appear first, then all the cells in the second row, and so on. To minimize overhead, adjacent cells of the same type (tdt) are represented together in one data block, even if the cells are in different rows. In other words, one tdtFloat can contain several numbers, one tdtString can contain several strings, one tdtBool can contain several Boolean values, and so on. For examples, see the following sections, "XlTable Example 1," and "XlTable Example 2."

The data block types are described in the following table.

Data block type

Value

Description

tdtTable

0x0010

The size of the table. The data (4 bytes, cb=4) consists of two words. The first word is the number of rows, and the second word is the number of columns.

tdtFloat

0x0001

IEEE-format floating-point number. The size of the number is 8 bytes per cell.

tdtString

0x0002

String in st (byte-counted) format. The first byte contains the length of the string (cch). The string is not null-terminated.

tdtBool

0x0003

Boolean value: 1 = TRUE
0 = FALSE

The length of the data is 2 bytes per cell.

tdtError

0x0004

Error value: 0 = #NULL!
7 = #DIV/0!
15 = #VALUE!
23 = #REF!
29 = #NAME?
36 = #NUM!
42 = #N/A

The length of the data is 2 bytes per cell.


Data block type

Value

Description

tdtBlank

0x0005

A count of the number of consecutive undefined (blank) cells. The data (2 bytes, cb=2) contains the number of consecutive blank cells.

tdtInt

0x0006

Unsigned integer. The length of the data is 2 bytes per cell. Microsoft Excel can read a number in this format, but it never writes a number in this format.

tdtSkip

0x0007

Number of cells to skip. A skipped cell is a cell that retains its previous value. In other words, a skipped cell is not changed by a WM_DDE_DATA message. You can use tdtSkip to increase DDE performance if your application changes only one or two cells in the middle of a large table. Microsoft Excel does not support tdtSkip when the new cell data is part of a WM_DDE_POKE message. The length of the data is 2 bytes (cb=2).