FreeXL  1.0.0a
Data Fields
FreeXL_CellValue_str Struct Reference

Container for a cell value. More...

#include <freexl.h>

Data Fields

unsigned char type
 The type of data stored in this cell.
union {
   int   int_value
 if type is FREEXL_CELL_INT, then the corresponding value will be returned as int_value
   double   double_value
 if type is FREEXL_CELL_DOUBLE, then the corresponding value will be returned as double_value
   const char *   text_value
 if type is FREEXL_CELL_TEXT, FREEXL_CELL_SST_TEXT, FREEXL_CELL_DATE, FREEXL_CELL_DATETIME or FREEXL_CELL_TIME the corresponding value will be returned as text_value
value
 The value of the data stored in the cell.

Detailed Description

Container for a cell value.

freexl_get_cell_value() takes a pointer to this structure, and fills in the appropriate values.

        FreeXL_CellValue val;
        freexl_get_cell_value(..., &val);
        switch (val.type)
        {
            case FREEXL_CELL_INT:
                printf("Int=%d\n", val.value.int_value;
                break;
            case FREEXL_CELL_DOUBLE:
                printf("Double=%1.2f\n", val.value.double_value;
                break;
            case FREEXL_CELL_TEXT:
            case FREEXL_CELL_SST_TEXT:
                printf("Text='%s'\n", val.value.text_value;
                break;
            case FREEXL_CELL_DATE:
            case FREEXL_CELL_DATETIME:
            case FREEXL_CELL_TIME:
                printf("DateOrTime='%s'\n", val.value.text_value;
                break;
            case FREEXL_CELL_NULL:
                printf("NULL\n");
                break;
            default:
                printf("Invalid data-type\n");
                break;
        }
Examples:
xl2sql.c.

Field Documentation

The type of data stored in this cell.

Can be one of the following:

  • FREEXL_CELL_NULL the cell contains a NULL value.
  • FREEXL_CELL_INT the cell contains an INTEGER value.
  • FREEXL_CELL_DOUBLE the cell contains a DOUBLE value.
  • FREEXL_CELL_TEXT or FREEXL_CELL_SST_TEXT the cell contains a text string (always UTF-8 encoded)
  • FREEXL_CELL_DATE the cell contains a date, encoded as a 'YYYY-MM-DD' string value
  • FREEXL_CELL_DATETIME the cell contains a date and time, encoded as a 'YYYY-MM-DD HH:MM:SS' string value
  • FREEXL_CELL_TIME the cell contains a time, encoded as a 'HH:MM:SS' string value
Examples:
xl2sql.c.

The value of the data stored in the cell.

Which part of the union is valid is determined by the type value.

Examples:
xl2sql.c.

The documentation for this struct was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Defines