00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00036 #ifndef INCLUDED_XLSXIO_READ_H
00037 #define INCLUDED_XLSXIO_READ_H
00038
00039 #include <stdlib.h>
00040 #if defined(_MSC_VER) && _MSC_VER < 1600
00041 typedef signed __int64 int64_t;
00042 typedef unsigned __int64 uint64_t;
00043 #else
00044 #include <stdint.h>
00045 #endif
00046 #include <time.h>
00047
00049 #ifndef XLSXIOCHAR
00050 #if defined(XML_UNICODE_WCHAR_T)
00051 #warning Building with XML_UNICODE_WCHAR_T and -fshort-wchar is not supported unless all other linked libraries and programs are also compiled with -fshort-wchar
00052 #elif !defined(XML_UNICODE)
00053 #define XLSXIOCHAR char
00054 #else
00055 #include <wchar.h>
00056 #define XLSXIOCHAR wchar_t
00057 #endif
00058 #endif
00059
00061 #ifndef DLL_EXPORT_XLSXIO
00062 #ifdef _WIN32
00063 #if defined(BUILD_XLSXIO_DLL) || defined(BUILD_XLSXIO_SHARED) || defined(xlsxio_write_SHARED_EXPORTS)
00064 #define DLL_EXPORT_XLSXIO __declspec(dllexport)
00065 #elif !defined(STATIC) && !defined(BUILD_XLSXIO_STATIC) && !defined(BUILD_XLSXIO)
00066 #define DLL_EXPORT_XLSXIO __declspec(dllimport)
00067 #else
00068 #define DLL_EXPORT_XLSXIO
00069 #endif
00070 #else
00071 #define DLL_EXPORT_XLSXIO
00072 #endif
00073 #endif
00074
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079
00086 DLL_EXPORT_XLSXIO void xlsxioread_get_version (int* pmajor, int* pminor, int* pmicro);
00087
00092 DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_get_version_string ();
00093
00095 typedef struct xlsxio_read_struct* xlsxioreader;
00096
00102 DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open (const char* filename);
00103
00109 DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_filehandle (int filehandle);
00110
00118 DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_memory (void* data, uint64_t datalen, int freedata);
00119
00124 DLL_EXPORT_XLSXIO void xlsxioread_close (xlsxioreader handle);
00125
00126
00127
00134 typedef int (*xlsxioread_list_sheets_callback_fn)(const XLSXIOCHAR* name, void* callbackdata);
00135
00142 DLL_EXPORT_XLSXIO void xlsxioread_list_sheets (xlsxioreader handle, xlsxioread_list_sheets_callback_fn callback, void* callbackdata);
00143
00144
00145
00152 #define XLSXIOREAD_SKIP_NONE 0
00153
00154 #define XLSXIOREAD_SKIP_EMPTY_ROWS 0x01
00155
00156 #define XLSXIOREAD_SKIP_EMPTY_CELLS 0x02
00157
00158 #define XLSXIOREAD_SKIP_ALL_EMPTY (XLSXIOREAD_SKIP_EMPTY_ROWS | XLSXIOREAD_SKIP_EMPTY_CELLS)
00159
00160 #define XLSXIOREAD_SKIP_EXTRA_CELLS 0x04
00161
00172 typedef int (*xlsxioread_process_cell_callback_fn)(size_t row, size_t col, const XLSXIOCHAR* value, void* callbackdata);
00173
00182 typedef int (*xlsxioread_process_row_callback_fn)(size_t row, size_t maxcol, void* callbackdata);
00183
00195 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);
00196
00197
00198
00200 typedef struct xlsxio_read_sheetlist_struct* xlsxioreadersheetlist;
00201
00207 DLL_EXPORT_XLSXIO xlsxioreadersheetlist xlsxioread_sheetlist_open (xlsxioreader handle);
00208
00213 DLL_EXPORT_XLSXIO void xlsxioread_sheetlist_close (xlsxioreadersheetlist sheetlisthandle);
00214
00220 DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_sheetlist_next (xlsxioreadersheetlist sheetlisthandle);
00221
00222
00223
00225 typedef struct xlsxio_read_sheet_struct* xlsxioreadersheet;
00226
00231 DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_row_index (xlsxioreadersheet sheethandle);
00232
00237 DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_column_index (xlsxioreadersheet sheethandle);
00238
00243 DLL_EXPORT_XLSXIO unsigned int xlsxioread_sheet_flags (xlsxioreadersheet sheethandle);
00244
00253 DLL_EXPORT_XLSXIO xlsxioreadersheet xlsxioread_sheet_open (xlsxioreader handle, const XLSXIOCHAR* sheetname, unsigned int flags);
00254
00259 DLL_EXPORT_XLSXIO void xlsxioread_sheet_close (xlsxioreadersheet sheethandle);
00260
00266 DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_row (xlsxioreadersheet sheethandle);
00267
00274 DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet sheethandle);
00275
00284 DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_string (xlsxioreadersheet sheethandle, XLSXIOCHAR** pvalue);
00285
00293 DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_int (xlsxioreadersheet sheethandle, int64_t* pvalue);
00294
00302 DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_float (xlsxioreadersheet sheethandle, double* pvalue);
00303
00311 DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_datetime (xlsxioreadersheet sheethandle, time_t* pvalue);
00312
00313
00314
00320 DLL_EXPORT_XLSXIO void xlsxioread_free (XLSXIOCHAR* data);
00321
00322 #ifdef __cplusplus
00323 }
00324 #endif
00325
00326 #endif