Adapted for 0.2.24 from changes in https://github.com/viest/xlsxio From 2ca1dd9967982dc3f4b5b4d49e019b95250893bf Mon Sep 17 00:00:00 2001 From: viest Date: Sat, 29 Feb 2020 22:15:15 +0800 Subject: [PATCH] Feat: get read sheet information --- .gitignore | 2 ++ include/xlsxio_read.h | 12 +++++++++ lib/xlsxio_read.c | 63 +++++++++++++++++++++++++------------------ 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/include/xlsxio_read.h b/include/xlsxio_read.h index b3d05a0..9ae382d 100644 --- a/include/xlsxio_read.h +++ b/include/xlsxio_read.h @@ -224,6 +224,18 @@ DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_sheetlist_next (xlsxioreadersheet /*! \brief read handle for worksheet object */ typedef struct xlsxio_read_sheet_struct* xlsxioreadersheet; +/*! \brief get the index of the last column of the current worksheet row + * \param sheethandle read handle for worksheet object + * \sa xlsxioread_sheet_open() + */ +DLL_EXPORT_XLSXIO int xlsxioread_sheet_last_column_index(xlsxioreadersheet sheethandle); + +/*! \brief get worksheet open flags + * \param sheethandle read handle for worksheet object + * \sa xlsxioread_sheet_open() + */ +DLL_EXPORT_XLSXIO unsigned int xlsxioread_sheet_flags(xlsxioreadersheet sheethandle); + /*! \brief open worksheet * \param handle read handle for .xlsx object * \param sheetname worksheet name (NULL for first sheet) diff --git a/lib/xlsxio_read.c b/lib/xlsxio_read.c index 5d33705..2c63237 100644 --- a/lib/xlsxio_read.c +++ b/lib/xlsxio_read.c @@ -1262,6 +1262,17 @@ struct xlsxio_read_sheet_struct { size_t paddingcol; }; +DLL_EXPORT_XLSXIO int xlsxioread_sheet_last_column_index(xlsxioreadersheet sheethandle) +{ + return (int)sheethandle->lastcolnr; +} + + +DLL_EXPORT_XLSXIO unsigned int xlsxioread_sheet_flags(xlsxioreadersheet sheethandle) +{ + return (int)sheethandle->processcallbackdata.flags; +} + 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) { int result = 0;