XLSX I/O header file for reading .xlsx files. More...
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
Go to the source code of this file.
Macros | |
#define | XLSXIOCHAR char |
character type used (usually char, but when XML_UNICODE is defined wchar_t) | |
XLSXIOREAD_SKIP_* | |
possible values for the flags parameter of xlsxioread_process()
| |
#define | XLSXIOREAD_SKIP_NONE |
don't skip any rows or cells | |
#define | XLSXIOREAD_SKIP_EMPTY_ROWS |
skip empty rows (note: cells may appear empty while they actually contain data) | |
#define | XLSXIOREAD_SKIP_EMPTY_CELLS |
skip empty cells | |
#define | XLSXIOREAD_SKIP_ALL_EMPTY |
skip empty rows and cells | |
#define | XLSXIOREAD_SKIP_EXTRA_CELLS |
skip extra cells to the right of the rightmost header cell | |
Typedefs | |
typedef struct xlsxio_read_struct * | xlsxioreader |
read handle for .xlsx object | |
typedef int(* | xlsxioread_list_sheets_callback_fn )(const XLSXIOCHAR *name, void *callbackdata) |
type of pointer to callback function for listing worksheets More... | |
typedef int(* | xlsxioread_process_cell_callback_fn )(size_t row, size_t col, const XLSXIOCHAR *value, void *callbackdata) |
type of pointer to callback function for processing a worksheet cell value More... | |
typedef int(* | xlsxioread_process_row_callback_fn )(size_t row, size_t maxcol, void *callbackdata) |
type of pointer to callback function for processing the end of a worksheet row More... | |
typedef struct xlsxio_read_sheetlist_struct * | xlsxioreadersheetlist |
read handle for list of worksheet names | |
typedef struct xlsxio_read_sheet_struct * | xlsxioreadersheet |
read handle for worksheet object | |
Functions | |
DLL_EXPORT_XLSXIO void | xlsxioread_get_version (int *pmajor, int *pminor, int *pmicro) |
get xlsxio_write version More... | |
DLL_EXPORT_XLSXIO const XLSXIOCHAR * | xlsxioread_get_version_string () |
get xlsxio_write version string More... | |
DLL_EXPORT_XLSXIO xlsxioreader | xlsxioread_open (const char *filename) |
open .xlsx file More... | |
DLL_EXPORT_XLSXIO xlsxioreader | xlsxioread_open_filehandle (int filehandle) |
open .xlsx file More... | |
DLL_EXPORT_XLSXIO xlsxioreader | xlsxioread_open_memory (void *data, uint64_t datalen, int freedata) |
open .xlsx from memory buffer More... | |
DLL_EXPORT_XLSXIO void | xlsxioread_close (xlsxioreader handle) |
close .xlsx file More... | |
DLL_EXPORT_XLSXIO void | xlsxioread_list_sheets (xlsxioreader handle, xlsxioread_list_sheets_callback_fn callback, void *callbackdata) |
list worksheets in .xlsx file More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_process (xlsxioreader handle, const XLSXIOCHAR *sheetname, unsigned int flags, xlsxioread_process_cell_callback_fn cell_callback, xlsxioread_process_row_callback_fn row_callback, void *callbackdata) |
process all rows and columns of a worksheet in an .xlsx file More... | |
DLL_EXPORT_XLSXIO xlsxioreadersheetlist | xlsxioread_sheetlist_open (xlsxioreader handle) |
open list of worksheet names More... | |
DLL_EXPORT_XLSXIO void | xlsxioread_sheetlist_close (xlsxioreadersheetlist sheetlisthandle) |
close worksheet More... | |
DLL_EXPORT_XLSXIO const XLSXIOCHAR * | xlsxioread_sheetlist_next (xlsxioreadersheetlist sheetlisthandle) |
get next worksheet name More... | |
DLL_EXPORT_XLSXIO size_t | xlsxioread_sheet_last_row_index (xlsxioreadersheet sheethandle) |
get index of last row read from worksheet (returns 0 if no row was read yet) More... | |
DLL_EXPORT_XLSXIO size_t | xlsxioread_sheet_last_column_index (xlsxioreadersheet sheethandle) |
get index of last column read from current row in worksheet (returns 0 if no column was read yet) More... | |
DLL_EXPORT_XLSXIO unsigned int | xlsxioread_sheet_flags (xlsxioreadersheet sheethandle) |
get flags used to open worksheet More... | |
DLL_EXPORT_XLSXIO xlsxioreadersheet | xlsxioread_sheet_open (xlsxioreader handle, const XLSXIOCHAR *sheetname, unsigned int flags) |
open worksheet More... | |
DLL_EXPORT_XLSXIO void | xlsxioread_sheet_close (xlsxioreadersheet sheethandle) |
close worksheet More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_sheet_next_row (xlsxioreadersheet sheethandle) |
get next row from worksheet (to be called before each row) More... | |
DLL_EXPORT_XLSXIO XLSXIOCHAR * | xlsxioread_sheet_next_cell (xlsxioreadersheet sheethandle) |
get next cell from worksheet More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_sheet_next_cell_string (xlsxioreadersheet sheethandle, XLSXIOCHAR **pvalue) |
get next cell from worksheet as a string More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_sheet_next_cell_int (xlsxioreadersheet sheethandle, int64_t *pvalue) |
get next cell from worksheet as an integer More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_sheet_next_cell_float (xlsxioreadersheet sheethandle, double *pvalue) |
get next cell from worksheet as a floating point value More... | |
DLL_EXPORT_XLSXIO int | xlsxioread_sheet_next_cell_datetime (xlsxioreadersheet sheethandle, time_t *pvalue) |
get next cell from worksheet as date and time data More... | |
XLSX I/O header file for reading .xlsx files.
Include this header file to use XLSX I/O for reading .xlsx files and link with -lxlsxio_read. This header provides both advanced methods using callback functions and simple methods for iterating through data.
typedef int(* xlsxioread_list_sheets_callback_fn)(const XLSXIOCHAR *name, void *callbackdata) |
type of pointer to callback function for listing worksheets
name | name of worksheet |
callbackdata | callback data passed to xlsxioread_list_sheets |
typedef int(* xlsxioread_process_cell_callback_fn)(size_t row, size_t col, const XLSXIOCHAR *value, void *callbackdata) |
type of pointer to callback function for processing a worksheet cell value
row | row number (first row is 1) |
col | column number (first column is 1) |
value | value of cell (note: formulas are not calculated) |
callbackdata | callback data passed to xlsxioread_process |
typedef int(* xlsxioread_process_row_callback_fn)(size_t row, size_t maxcol, void *callbackdata) |
type of pointer to callback function for processing the end of a worksheet row
row | row number (first row is 1) |
maxcol | maximum column number on this row (first column is 1) |
callbackdata | callback data passed to xlsxioread_process |
DLL_EXPORT_XLSXIO void xlsxioread_get_version | ( | int * | pmajor, |
int * | pminor, | ||
int * | pmicro | ||
) |
get xlsxio_write version
pmajor | pointer to integer that will receive major version number |
pminor | pointer to integer that will receive minor version number |
pmicro | pointer to integer that will receive micro version number |
DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_get_version_string | ( | ) |
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open | ( | const char * | filename | ) |
open .xlsx file
filename | path of .xlsx file to open |
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_filehandle | ( | int | filehandle | ) |
open .xlsx file
filehandle | file handle of .xlsx file opened with read access in binary mode |
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_memory | ( | void * | data, |
uint64_t | datalen, | ||
int | freedata | ||
) |
open .xlsx from memory buffer
data | memory buffer containing .xlsx file (data must remain valid as long as any xlsxioread_ functions are called) |
datalen | size of memory buffer containing .xlsx file |
freedata | if non-zero data will be freed by xlsxioread_close() |
DLL_EXPORT_XLSXIO void xlsxioread_close | ( | xlsxioreader | handle | ) |
DLL_EXPORT_XLSXIO void xlsxioread_list_sheets | ( | xlsxioreader | handle, |
xlsxioread_list_sheets_callback_fn | callback, | ||
void * | callbackdata | ||
) |
list worksheets in .xlsx file
handle | read handle for .xlsx object |
callback | callback function called for each worksheet |
callbackdata | custom data as passed to quickmail_add_body_custom/quickmail_add_attachment_custom |
DLL_EXPORT_XLSXIO int xlsxioread_process | ( | xlsxioreader | handle, |
const XLSXIOCHAR * | sheetname, | ||
unsigned int | flags, | ||
xlsxioread_process_cell_callback_fn | cell_callback, | ||
xlsxioread_process_row_callback_fn | row_callback, | ||
void * | callbackdata | ||
) |
process all rows and columns of a worksheet in an .xlsx file
handle | read handle for .xlsx object |
sheetname | worksheet name (NULL for first sheet) |
flags | XLSXIOREAD_SKIP_ flag(s) to determine how data is processed |
cell_callback | callback function called for each cell |
row_callback | callback function called after each row |
callbackdata | callback data passed to xlsxioread_process |
DLL_EXPORT_XLSXIO xlsxioreadersheetlist xlsxioread_sheetlist_open | ( | xlsxioreader | handle | ) |
open list of worksheet names
handle | read handle for .xlsx object |
DLL_EXPORT_XLSXIO void xlsxioread_sheetlist_close | ( | xlsxioreadersheetlist | sheetlisthandle | ) |
close worksheet
sheetlisthandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_sheetlist_next | ( | xlsxioreadersheetlist | sheetlisthandle | ) |
get next worksheet name
sheetlisthandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_row_index | ( | xlsxioreadersheet | sheethandle | ) |
get index of last row read from worksheet (returns 0 if no row was read yet)
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_column_index | ( | xlsxioreadersheet | sheethandle | ) |
get index of last column read from current row in worksheet (returns 0 if no column was read yet)
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO unsigned int xlsxioread_sheet_flags | ( | xlsxioreadersheet | sheethandle | ) |
get flags used to open worksheet
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO xlsxioreadersheet xlsxioread_sheet_open | ( | xlsxioreader | handle, |
const XLSXIOCHAR * | sheetname, | ||
unsigned int | flags | ||
) |
open worksheet
handle | read handle for .xlsx object |
sheetname | worksheet name (NULL for first sheet) |
flags | XLSXIOREAD_SKIP_ flag(s) to determine how data is processed |
DLL_EXPORT_XLSXIO void xlsxioread_sheet_close | ( | xlsxioreadersheet | sheethandle | ) |
close worksheet
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_row | ( | xlsxioreadersheet | sheethandle | ) |
get next row from worksheet (to be called before each row)
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell | ( | xlsxioreadersheet | sheethandle | ) |
get next cell from worksheet
sheethandle | read handle for worksheet object |
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_string | ( | xlsxioreadersheet | sheethandle, |
XLSXIOCHAR ** | pvalue | ||
) |
get next cell from worksheet as a string
sheethandle | read handle for worksheet object |
pvalue | pointer where string will be stored if data is available (caller must free the result) |
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_int | ( | xlsxioreadersheet | sheethandle, |
int64_t * | pvalue | ||
) |
get next cell from worksheet as an integer
sheethandle | read handle for worksheet object |
pvalue | pointer where integer will be stored if data is available |
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_float | ( | xlsxioreadersheet | sheethandle, |
double * | pvalue | ||
) |
get next cell from worksheet as a floating point value
sheethandle | read handle for worksheet object |
pvalue | pointer where floating point value will be stored if data is available |
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_datetime | ( | xlsxioreadersheet | sheethandle, |
time_t * | pvalue | ||
) |
get next cell from worksheet as date and time data
sheethandle | read handle for worksheet object |
pvalue | pointer where date and time data will be stored if data is available |