初始化PHP-Xlswrite扩展
This commit is contained in:
19
library/libxlsxio/LICENSE.txt
Normal file
19
library/libxlsxio/LICENSE.txt
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (C) 2016 Brecht Sanders All Rights Reserved
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
317
library/libxlsxio/include/xlsxio_read.h
Normal file
317
library/libxlsxio/include/xlsxio_read.h
Normal file
@ -0,0 +1,317 @@
|
||||
/*****************************************************************************
|
||||
Copyright (C) 2016 Brecht Sanders All Rights Reserved
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file xlsxio_read.h
|
||||
* @brief XLSX I/O header file for reading .xlsx files.
|
||||
* @author Brecht Sanders
|
||||
* @date 2016
|
||||
* @copyright MIT
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XLSXIO_READ_H
|
||||
#define INCLUDED_XLSXIO_READ_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
/*! \brief character type used (usually char, but when XML_UNICODE is defined wchar_t) */
|
||||
#ifndef XLSXIOCHAR
|
||||
#if defined(XML_UNICODE_WCHAR_T)
|
||||
#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
|
||||
#elif !defined(XML_UNICODE)
|
||||
#define XLSXIOCHAR char
|
||||
#else
|
||||
#include <wchar.h>
|
||||
#define XLSXIOCHAR wchar_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*! \cond PRIVATE */
|
||||
#ifndef DLL_EXPORT_XLSXIO
|
||||
#ifdef _WIN32
|
||||
#if defined(BUILD_XLSXIO_DLL) || defined(BUILD_XLSXIO_SHARED) || defined(xlsxio_write_SHARED_EXPORTS)
|
||||
#define DLL_EXPORT_XLSXIO __declspec(dllexport)
|
||||
#elif !defined(STATIC) && !defined(BUILD_XLSXIO_STATIC) && !defined(BUILD_XLSXIO)
|
||||
#define DLL_EXPORT_XLSXIO __declspec(dllimport)
|
||||
#else
|
||||
#define DLL_EXPORT_XLSXIO
|
||||
#endif
|
||||
#else
|
||||
#define DLL_EXPORT_XLSXIO
|
||||
#endif
|
||||
#endif
|
||||
/*! \endcond */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*! \brief get xlsxio_write version
|
||||
* \param pmajor pointer to integer that will receive major version number
|
||||
* \param pminor pointer to integer that will receive minor version number
|
||||
* \param pmicro pointer to integer that will receive micro version number
|
||||
* \sa xlsxiowrite_get_version_string()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxioread_get_version (int* pmajor, int* pminor, int* pmicro);
|
||||
|
||||
/*! \brief get xlsxio_write version string
|
||||
* \return version string
|
||||
* \sa xlsxiowrite_get_version()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_get_version_string ();
|
||||
|
||||
/*! \brief read handle for .xlsx object */
|
||||
typedef struct xlsxio_read_struct* xlsxioreader;
|
||||
|
||||
/*! \brief open .xlsx file
|
||||
* \param filename path of .xlsx file to open
|
||||
* \return read handle for .xlsx object or NULL on error
|
||||
* \sa xlsxioread_close()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open (const char* filename);
|
||||
|
||||
/*! \brief open .xlsx file
|
||||
* \param filehandle file handle of .xlsx file opened with read access in binary mode
|
||||
* \return read handle for .xlsx object or NULL on error
|
||||
* \sa xlsxioread_close()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_filehandle (int filehandle);
|
||||
|
||||
/*! \brief open .xlsx from memory buffer
|
||||
* \param data memory buffer containing .xlsx file (data must remain valid as long as any xlsxioread_ functions are called)
|
||||
* \param datalen size of memory buffer containing .xlsx file
|
||||
* \param freedata if non-zero data will be freed by xlsxioread_close()
|
||||
* \return read handle for .xlsx object or NULL on error
|
||||
* \sa xlsxioread_close()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxioreader xlsxioread_open_memory (void* data, uint64_t datalen, int freedata);
|
||||
|
||||
/*! \brief close .xlsx file
|
||||
* \param handle read handle for .xlsx object
|
||||
* \sa xlsxioread_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxioread_close (xlsxioreader handle);
|
||||
|
||||
|
||||
|
||||
/*! \brief type of pointer to callback function for listing worksheets
|
||||
* \param name name of worksheet
|
||||
* \param callbackdata callback data passed to xlsxioread_list_sheets
|
||||
* \return zero to continue, non-zero to abort
|
||||
* \sa xlsxioread_list_sheets()
|
||||
*/
|
||||
typedef int (*xlsxioread_list_sheets_callback_fn)(const XLSXIOCHAR* name, void* callbackdata);
|
||||
|
||||
/*! \brief list worksheets in .xlsx file
|
||||
* \param handle read handle for .xlsx object
|
||||
* \param callback callback function called for each worksheet
|
||||
* \param callbackdata custom data as passed to quickmail_add_body_custom/quickmail_add_attachment_custom
|
||||
* \sa xlsxioread_list_sheets_callback_fn
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxioread_list_sheets (xlsxioreader handle, xlsxioread_list_sheets_callback_fn callback, void* callbackdata);
|
||||
|
||||
|
||||
|
||||
/*! \brief possible values for the flags parameter of xlsxioread_process()
|
||||
* \sa xlsxioread_process()
|
||||
* \name XLSXIOREAD_SKIP_*
|
||||
* \{
|
||||
*/
|
||||
/*! \brief don't skip any rows or cells \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_NONE 0
|
||||
/*! \brief skip empty rows (note: cells may appear empty while they actually contain data) \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_EMPTY_ROWS 0x01
|
||||
/*! \brief skip empty cells \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_EMPTY_CELLS 0x02
|
||||
/*! \brief skip empty rows and cells \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_ALL_EMPTY (XLSXIOREAD_SKIP_EMPTY_ROWS | XLSXIOREAD_SKIP_EMPTY_CELLS)
|
||||
/*! \brief skip extra cells to the right of the rightmost header cell \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_EXTRA_CELLS 0x04
|
||||
/*! \brief skip hidden rows \hideinitializer */
|
||||
#define XLSXIOREAD_SKIP_HIDDEN_ROWS 0x08
|
||||
/*! @} */
|
||||
|
||||
/*! \brief type of pointer to callback function for processing a worksheet cell value
|
||||
* \param row row number (first row is 1)
|
||||
* \param col column number (first column is 1)
|
||||
* \param value value of cell (note: formulas are not calculated)
|
||||
* \param callbackdata callback data passed to xlsxioread_process
|
||||
* \return zero to continue, non-zero to abort
|
||||
* \sa xlsxioread_process()
|
||||
* \sa xlsxioread_process_row_callback_fn
|
||||
*/
|
||||
typedef int (*xlsxioread_process_cell_callback_fn)(size_t row, size_t col, const XLSXIOCHAR* value, void* callbackdata);
|
||||
|
||||
/*! \brief type of pointer to callback function for processing the end of a worksheet row
|
||||
* \param row row number (first row is 1)
|
||||
* \param maxcol maximum column number on this row (first column is 1)
|
||||
* \param callbackdata callback data passed to xlsxioread_process
|
||||
* \return zero to continue, non-zero to abort
|
||||
* \sa xlsxioread_process()
|
||||
* \sa xlsxioread_process_cell_callback_fn
|
||||
*/
|
||||
typedef int (*xlsxioread_process_row_callback_fn)(size_t row, size_t maxcol, void* callbackdata);
|
||||
|
||||
/*! \brief process all rows and columns of a worksheet in an .xlsx file
|
||||
* \param handle read handle for .xlsx object
|
||||
* \param sheetname worksheet name (NULL for first sheet)
|
||||
* \param flags XLSXIOREAD_SKIP_ flag(s) to determine how data is processed
|
||||
* \param cell_callback callback function called for each cell
|
||||
* \param row_callback callback function called after each row
|
||||
* \param callbackdata callback data passed to xlsxioread_process
|
||||
* \return zero on success, non-zero on error
|
||||
* \sa xlsxioread_process_row_callback_fn
|
||||
* \sa xlsxioread_process_cell_callback_fn
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
|
||||
/*! \brief read handle for list of worksheet names */
|
||||
typedef struct xlsxio_read_sheetlist_struct* xlsxioreadersheetlist;
|
||||
|
||||
/*! \brief open list of worksheet names
|
||||
* \param handle read handle for .xlsx object
|
||||
* \sa xlsxioread_sheetlist_close()
|
||||
* \sa xlsxioread_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxioreadersheetlist xlsxioread_sheetlist_open (xlsxioreader handle);
|
||||
|
||||
/*! \brief close worksheet
|
||||
* \param sheetlisthandle read handle for worksheet object
|
||||
* \sa xlsxioread_sheetlist_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxioread_sheetlist_close (xlsxioreadersheetlist sheetlisthandle);
|
||||
|
||||
/*! \brief get next worksheet name
|
||||
* \param sheetlisthandle read handle for worksheet object
|
||||
* \return name of worksheet or NULL if no more worksheets are available
|
||||
* \sa xlsxioread_sheetlist_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO const XLSXIOCHAR* xlsxioread_sheetlist_next (xlsxioreadersheetlist sheetlisthandle);
|
||||
|
||||
|
||||
|
||||
/*! \brief read handle for worksheet object */
|
||||
typedef struct xlsxio_read_sheet_struct* xlsxioreadersheet;
|
||||
|
||||
/*! \brief get index of last row read from worksheet (returns 0 if no row was read yet)
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \sa xlsxioread_sheet_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_row_index (xlsxioreadersheet sheethandle);
|
||||
|
||||
/*! \brief get index of last column read from current row in worksheet (returns 0 if no column was read yet)
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \sa xlsxioread_sheet_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO size_t xlsxioread_sheet_last_column_index (xlsxioreadersheet sheethandle);
|
||||
|
||||
/*! \brief get flags used to open worksheet
|
||||
* \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)
|
||||
* \param flags XLSXIOREAD_SKIP_ flag(s) to determine how data is processed
|
||||
* \return read handle for worksheet object or NULL in case of error
|
||||
* \sa xlsxioread_sheet_close()
|
||||
* \sa xlsxioread_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxioreadersheet xlsxioread_sheet_open (xlsxioreader handle, const XLSXIOCHAR* sheetname, unsigned int flags);
|
||||
|
||||
/*! \brief close worksheet
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \sa xlsxioread_sheet_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxioread_sheet_close (xlsxioreadersheet sheethandle);
|
||||
|
||||
/*! \brief get next row from worksheet (to be called before each row)
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \return non-zero if a new row is available
|
||||
* \sa xlsxioread_sheet_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_row (xlsxioreadersheet sheethandle);
|
||||
|
||||
/*! \brief get next cell from worksheet
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \return value (caller must free the result) or NULL if no more cells are available in the current row
|
||||
* \sa xlsxioread_sheet_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet sheethandle);
|
||||
|
||||
/*! \brief get next cell from worksheet as a string
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \param pvalue pointer where string will be stored if data is available (caller must free the result)
|
||||
* \return non-zero if a new cell was available in the current row
|
||||
* \sa xlsxioread_sheet_open()
|
||||
* \sa xlsxioread_sheet_next_cell()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_string (xlsxioreadersheet sheethandle, XLSXIOCHAR** pvalue);
|
||||
|
||||
/*! \brief get next cell from worksheet as an integer
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \param pvalue pointer where integer will be stored if data is available
|
||||
* \return non-zero if a new cell was available in the current row
|
||||
* \sa xlsxioread_sheet_open()
|
||||
* \sa xlsxioread_sheet_next_cell()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_int (xlsxioreadersheet sheethandle, int64_t* pvalue);
|
||||
|
||||
/*! \brief get next cell from worksheet as a floating point value
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \param pvalue pointer where floating point value will be stored if data is available
|
||||
* \return non-zero if a new cell was available in the current row
|
||||
* \sa xlsxioread_sheet_open()
|
||||
* \sa xlsxioread_sheet_next_cell()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_float (xlsxioreadersheet sheethandle, double* pvalue);
|
||||
|
||||
/*! \brief get next cell from worksheet as date and time data
|
||||
* \param sheethandle read handle for worksheet object
|
||||
* \param pvalue pointer where date and time data will be stored if data is available
|
||||
* \return non-zero if a new cell was available in the current row
|
||||
* \sa xlsxioread_sheet_open()
|
||||
* \sa xlsxioread_sheet_next_cell()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_datetime (xlsxioreadersheet sheethandle, time_t* pvalue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
77
library/libxlsxio/include/xlsxio_version.h
Normal file
77
library/libxlsxio/include/xlsxio_version.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*****************************************************************************
|
||||
Copyright (C) 2016 Brecht Sanders All Rights Reserved
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file xlsxio_version.h
|
||||
* @brief XLSX I/O header file with version information.
|
||||
* @author Brecht Sanders
|
||||
*
|
||||
* Only use this header file when version information is needed at compile
|
||||
* time. Otherwise the version functions in the libraries should be used.
|
||||
* \sa XLSXIO_VERSION_*
|
||||
* \sa XLSXIO_VERSION_STRING
|
||||
* \sa xlsxioread_get_version()
|
||||
* \sa xlsxioread_get_version_string()
|
||||
* \sa xlsxiowrite_get_version()
|
||||
* \sa xlsxiowrite_get_version_string()
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XLSXIO_VERSION_H
|
||||
#define INCLUDED_XLSXIO_VERSION_H
|
||||
|
||||
/*! \brief version number constants
|
||||
* \sa xlsxioread_get_version()
|
||||
* \sa xlsxiowrite_get_version()
|
||||
* \name XLSXIO_VERSION_*
|
||||
* \{
|
||||
*/
|
||||
/*! \brief major version number */
|
||||
#define XLSXIO_VERSION_MAJOR 0
|
||||
/*! \brief minor version number */
|
||||
#define XLSXIO_VERSION_MINOR 2
|
||||
/*! \brief micro version number */
|
||||
#define XLSXIO_VERSION_MICRO 27
|
||||
/*! @} */
|
||||
|
||||
/*! \cond PRIVATE */
|
||||
#ifndef XML_UNICODE_WCHAR_T
|
||||
#define XLSXIO_VERSION_STRINGIZE_(major, minor, micro) #major"."#minor"."#micro
|
||||
#else
|
||||
#define XLSXIO_VERSION_STRINGIZE_(major, minor, micro) L ## #major"."#minor"."#micro
|
||||
#endif
|
||||
#define XLSXIO_VERSION_STRINGIZE(major, minor, micro) XLSXIO_VERSION_STRINGIZE_(major, minor, micro)
|
||||
/*! \endcond */
|
||||
|
||||
/*! \brief string with dotted version number \hideinitializer */
|
||||
#define XLSXIO_VERSION_STRING XLSXIO_VERSION_STRINGIZE(XLSXIO_VERSION_MAJOR, XLSXIO_VERSION_MINOR, XLSXIO_VERSION_MICRO)
|
||||
|
||||
/*! \brief string with name of XLSX I/O reading library */
|
||||
#define XLSXIOREAD_NAME "libxlsxio_read"
|
||||
/*! \brief string with name of XLSX I/O writing library */
|
||||
#define XLSXIOWRITE_NAME "libxlsxio_write"
|
||||
|
||||
/*! \brief string with name and version of XLSX I/O reading library \hideinitializer */
|
||||
#define XLSXIOREAD_FULLNAME XLSXIOREAD_NAME " " XLSXIO_VERSION_STRING
|
||||
/*! \brief string with name and version of XLSX I/O writing library \hideinitializer */
|
||||
#define XLSXIOWRITE_FULLNAME XLSXIOWRITE_NAME " " XLSXIO_VERSION_STRING
|
||||
|
||||
#endif
|
164
library/libxlsxio/include/xlsxio_write.h
Normal file
164
library/libxlsxio/include/xlsxio_write.h
Normal file
@ -0,0 +1,164 @@
|
||||
/*****************************************************************************
|
||||
Copyright (C) 2016 Brecht Sanders All Rights Reserved
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file xlsxio_write.h
|
||||
* @brief XLSX I/O header file for writing .xlsx files.
|
||||
* @author Brecht Sanders
|
||||
* @date 2016
|
||||
* @copyright MIT
|
||||
*
|
||||
* Include this header file to use XLSX I/O for writing .xlsx files and
|
||||
* link with -lxlsxio_write.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XLSXIO_WRITE_H
|
||||
#define INCLUDED_XLSXIO_WRITE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
typedef signed __int64 int64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
/*! \cond PRIVATE */
|
||||
#ifndef DLL_EXPORT_XLSXIO
|
||||
#ifdef _WIN32
|
||||
#if defined(BUILD_XLSXIO_DLL) || defined(BUILD_XLSXIO_SHARED) || defined(xlsxio_write_SHARED_EXPORTS)
|
||||
#define DLL_EXPORT_XLSXIO __declspec(dllexport)
|
||||
#elif !defined(STATIC) && !defined(BUILD_XLSXIO_STATIC) && !defined(BUILD_XLSXIO)
|
||||
#define DLL_EXPORT_XLSXIO __declspec(dllimport)
|
||||
#else
|
||||
#define DLL_EXPORT_XLSXIO
|
||||
#endif
|
||||
#else
|
||||
#define DLL_EXPORT_XLSXIO
|
||||
#endif
|
||||
#endif
|
||||
/*! \endcond */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*! \brief get xlsxio_write version
|
||||
* \param pmajor pointer to integer that will receive major version number
|
||||
* \param pminor pointer to integer that will receive minor version number
|
||||
* \param pmicro pointer to integer that will receive micro version number
|
||||
* \sa xlsxiowrite_get_version_string()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_get_version (int* pmajor, int* pminor, int* pmicro);
|
||||
|
||||
/*! \brief get xlsxio_write version string
|
||||
* \return version string
|
||||
* \sa xlsxiowrite_get_version()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO const char* xlsxiowrite_get_version_string ();
|
||||
|
||||
/*! \brief write handle for .xlsx object */
|
||||
typedef struct xlsxio_write_struct* xlsxiowriter;
|
||||
|
||||
/*! \brief create and open .xlsx file
|
||||
* \param filename path of .xlsx file to open
|
||||
* \param sheetname name of worksheet
|
||||
* \return write handle for .xlsx object or NULL on error
|
||||
* \sa xlsxiowrite_close()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO xlsxiowriter xlsxiowrite_open (const char* filename, const char* sheetname);
|
||||
|
||||
/*! \brief close .xlsx file
|
||||
* \param handle write handle for .xlsx object
|
||||
* \return zero on success, non-zero on error
|
||||
* \sa xlsxiowrite_open()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO int xlsxiowrite_close (xlsxiowriter handle);
|
||||
|
||||
/*! \brief specify how many initial rows will be buffered in memory to determine column widths
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param rows number of rows to buffer in memory, zero for none
|
||||
* Must be called before the first call to xlsxiowrite_next_row()
|
||||
* \sa xlsxiowrite_add_column()
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_set_detection_rows (xlsxiowriter handle, size_t rows);
|
||||
|
||||
/*! \brief specify the row height to use for the current and next rows
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param height row height (in text lines), zero for unspecified
|
||||
* Must be called before the first call to any xlsxiowrite_add_ function of the current row
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_set_row_height (xlsxiowriter handle, size_t height);
|
||||
|
||||
/*! \brief add a column cell
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param name column name
|
||||
* \param width column width (in characters)
|
||||
* Only one row of column names is supported or none.
|
||||
* Call for each column, and finish column row by calling xlsxiowrite_next_row().
|
||||
* Must be called before any xlsxiowrite_next_row() or the xlsxiowrite_add_cell_ functions.
|
||||
* \sa xlsxiowrite_next_row()
|
||||
* \sa xlsxiowrite_set_detection_rows()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_add_column (xlsxiowriter handle, const char* name, int width);
|
||||
|
||||
/*! \brief add a cell with string data
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param value string value
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_add_cell_string (xlsxiowriter handle, const char* value);
|
||||
|
||||
/*! \brief add a cell with integer data
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param value integer value
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_add_cell_int (xlsxiowriter handle, int64_t value);
|
||||
|
||||
/*! \brief add a cell with floating point data
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param value floating point value
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_add_cell_float (xlsxiowriter handle, double value);
|
||||
|
||||
/*! \brief add a cell with date and time data
|
||||
* \param handle write handle for .xlsx object
|
||||
* \param value date and time value
|
||||
* \sa xlsxiowrite_next_row()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_add_cell_datetime (xlsxiowriter handle, time_t value);
|
||||
|
||||
/*! \brief mark the end of a row (next cell will start on a new row)
|
||||
* \param handle write handle for .xlsx object
|
||||
* \sa xlsxiowrite_add_cell_string()
|
||||
*/
|
||||
DLL_EXPORT_XLSXIO void xlsxiowrite_next_row (xlsxiowriter handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
56
library/libxlsxio/lib/xlsxio_private.h
Normal file
56
library/libxlsxio/lib/xlsxio_private.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef INCLUDED_XLSXIO_PRIVATE_H
|
||||
#define INCLUDED_XLSXIO_PRIVATE_H
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64__))
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#define wcscasecmp _wcsicmp
|
||||
#endif
|
||||
|
||||
|
||||
#define XLSXIOCHAR XML_Char
|
||||
|
||||
#if !defined(XML_UNICODE_WCHAR_T) && !defined(XML_UNICODE)
|
||||
|
||||
//UTF-8 version
|
||||
#define X(s) s
|
||||
#ifdef _WIN32
|
||||
#define XML_Char_icmp stricmp
|
||||
#else
|
||||
#define XML_Char_icmp strcasecmp
|
||||
#endif
|
||||
#define XML_Char_len strlen
|
||||
#define XML_Char_dup strdup
|
||||
#define XML_Char_cpy strcpy
|
||||
#define XML_Char_poscpy(d,p,s,l) memcpy(d + p, s, l)
|
||||
#define XML_Char_malloc(n) ((char*)malloc(n))
|
||||
#define XML_Char_realloc(m,n) ((char*)realloc((m), (n)))
|
||||
#define XML_Char_tol(s) strtol((s), NULL, 10)
|
||||
#define XML_Char_tod(s) strtod((s), NULL)
|
||||
#define XML_Char_strtol strtol
|
||||
#define XML_Char_sscanf sscanf
|
||||
#define XML_Char_printf printf
|
||||
|
||||
#else
|
||||
|
||||
//UTF-16 version
|
||||
#include <wchar.h>
|
||||
#define X(s) L##s
|
||||
#define XML_Char_icmp wcscasecmp
|
||||
#define XML_Char_len wcslen
|
||||
#define XML_Char_dup wcsdup
|
||||
#define XML_Char_cpy wcscpy
|
||||
#define XML_Char_poscpy(d,p,s,l) wmemcpy(d + p, s, l)
|
||||
#define XML_Char_malloc(n) ((XML_Char*)malloc((n) * sizeof(XML_Char)))
|
||||
#define XML_Char_realloc(m,n) ((XML_Char*)realloc((m), (n) * sizeof(XML_Char)))
|
||||
#define XML_Char_tol(s) wcstol((s), NULL, 10)
|
||||
#define XML_Char_tod(s) wcstod((s), NULL)
|
||||
#define XML_Char_strtol wcstol
|
||||
#define XML_Char_sscanf swscanf
|
||||
#define XML_Char_printf wprintf
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
1595
library/libxlsxio/lib/xlsxio_read.c
Normal file
1595
library/libxlsxio/lib/xlsxio_read.c
Normal file
File diff suppressed because it is too large
Load Diff
10
library/libxlsxio/lib/xlsxio_read.dep
Normal file
10
library/libxlsxio/lib/xlsxio_read.dep
Normal file
@ -0,0 +1,10 @@
|
||||
library/libxlsxio/lib/xlsxio_read.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_read.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_private.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_read_sharedstrings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libexpat/expat/lib/expat.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libexpat/expat/lib/expat_external.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_version.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/minizip/unzip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/minizip/ioapi.h
|
208
library/libxlsxio/lib/xlsxio_read_sharedstrings.c
Normal file
208
library/libxlsxio/lib/xlsxio_read_sharedstrings.c
Normal file
@ -0,0 +1,208 @@
|
||||
#include "xlsxio_private.h"
|
||||
#include "xlsxio_read_sharedstrings.h"
|
||||
#include <stdlib.h>
|
||||
//#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64__))
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#define wcscasecmp _wcsicmp
|
||||
#endif
|
||||
|
||||
struct sharedstringlist* sharedstringlist_create ()
|
||||
{
|
||||
struct sharedstringlist* sharedstrings;
|
||||
if ((sharedstrings = (struct sharedstringlist*)malloc(sizeof(struct sharedstringlist))) != NULL) {
|
||||
sharedstrings->strings = NULL;
|
||||
sharedstrings->numstrings = 0;
|
||||
}
|
||||
return sharedstrings;
|
||||
}
|
||||
|
||||
void sharedstringlist_destroy (struct sharedstringlist* sharedstrings)
|
||||
{
|
||||
if (sharedstrings) {
|
||||
size_t i;
|
||||
for (i = 0; i < sharedstrings->numstrings; i++)
|
||||
free(sharedstrings->strings[i]);
|
||||
free(sharedstrings->strings);
|
||||
free(sharedstrings);
|
||||
}
|
||||
}
|
||||
|
||||
size_t sharedstringlist_size (struct sharedstringlist* sharedstrings)
|
||||
{
|
||||
if (!sharedstrings)
|
||||
return 0;
|
||||
return sharedstrings->numstrings;
|
||||
}
|
||||
|
||||
int sharedstringlist_add_buffer (struct sharedstringlist* sharedstrings, const XML_Char* data, size_t datalen)
|
||||
{
|
||||
XML_Char* s;
|
||||
XML_Char** p;
|
||||
if (!sharedstrings)
|
||||
return 1;
|
||||
if (!data) {
|
||||
s = NULL;
|
||||
} else {
|
||||
if ((s = XML_Char_malloc(datalen + 1)) == NULL)
|
||||
return 2;
|
||||
XML_Char_poscpy(s, 0, data, datalen);
|
||||
s[datalen] = 0;
|
||||
}
|
||||
if ((p = (XML_Char**)realloc(sharedstrings->strings, (sharedstrings->numstrings + 1) * sizeof(sharedstrings->strings[0]))) == NULL) {
|
||||
free(s);
|
||||
return 3;
|
||||
}
|
||||
sharedstrings->strings = p;
|
||||
sharedstrings->strings[sharedstrings->numstrings++] = s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sharedstringlist_add_string (struct sharedstringlist* sharedstrings, const XML_Char* data)
|
||||
{
|
||||
return sharedstringlist_add_buffer(sharedstrings, data, (data ? XML_Char_len(data) : 0));
|
||||
}
|
||||
|
||||
const XML_Char* sharedstringlist_get (struct sharedstringlist* sharedstrings, size_t index)
|
||||
{
|
||||
if (!sharedstrings || index >= sharedstrings->numstrings)
|
||||
return NULL;
|
||||
return sharedstrings->strings[index];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void shared_strings_callback_data_initialize (struct shared_strings_callback_data* data, struct sharedstringlist* sharedstrings)
|
||||
{
|
||||
data->xmlparser = NULL;
|
||||
data->sharedstrings = sharedstrings;
|
||||
data->insst = 0;
|
||||
data->insi = 0;
|
||||
data->intext = 0;
|
||||
data->text = NULL;
|
||||
data->textlen = 0;
|
||||
data->skiptag = NULL;
|
||||
data->skiptagcount = 0;
|
||||
data->skip_start = NULL;
|
||||
data->skip_end = NULL;
|
||||
data->skip_data = NULL;
|
||||
}
|
||||
|
||||
void shared_strings_callback_data_cleanup (struct shared_strings_callback_data* data)
|
||||
{
|
||||
free(data->text);
|
||||
free(data->skiptag);
|
||||
}
|
||||
|
||||
void shared_strings_callback_skip_tag_start (void* callbackdata, const XML_Char* name, const XML_Char** atts)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (name && XML_Char_icmp(name, data->skiptag) == 0) {
|
||||
//increment nesting level
|
||||
data->skiptagcount++;
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_skip_tag_end (void* callbackdata, const XML_Char* name)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (!name || XML_Char_icmp(name, data->skiptag) == 0) {
|
||||
if (--data->skiptagcount == 0) {
|
||||
//restore handlers when done skipping
|
||||
XML_SetElementHandler(data->xmlparser, data->skip_start, data->skip_end);
|
||||
XML_SetCharacterDataHandler(data->xmlparser, data->skip_data);
|
||||
free(data->skiptag);
|
||||
data->skiptag = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_sharedstringtable_start (void* callbackdata, const XML_Char* name, const XML_Char** atts)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("sst")) == 0) {
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_find_shared_stringitem_start, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_sharedstringtable_end (void* callbackdata, const XML_Char* name)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("sst")) == 0) {
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_find_sharedstringtable_start, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_shared_stringitem_start (void* callbackdata, const XML_Char* name, const XML_Char** atts)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("si")) == 0) {
|
||||
if (data->text)
|
||||
free(data->text);
|
||||
data->text = NULL;
|
||||
data->textlen = 0;
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_find_shared_string_start, shared_strings_callback_find_sharedstringtable_end);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_shared_stringitem_end (void* callbackdata, const XML_Char* name)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("si")) == 0) {
|
||||
sharedstringlist_add_buffer(data->sharedstrings, data->text, data->textlen);
|
||||
if (data->text)
|
||||
free(data->text);
|
||||
data->text = NULL;
|
||||
data->textlen = 0;
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_find_shared_stringitem_start, shared_strings_callback_find_sharedstringtable_end);
|
||||
} else {
|
||||
shared_strings_callback_find_sharedstringtable_end(callbackdata, name);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_shared_string_start (void* callbackdata, const XML_Char* name, const XML_Char** atts)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("t")) == 0) {
|
||||
XML_SetElementHandler(data->xmlparser, NULL, shared_strings_callback_find_shared_string_end);
|
||||
XML_SetCharacterDataHandler(data->xmlparser, shared_strings_callback_string_data);
|
||||
} else if (XML_Char_icmp(name, X("rPh")) == 0) {
|
||||
data->skiptag = XML_Char_dup(name);
|
||||
data->skiptagcount = 1;
|
||||
data->skip_start = shared_strings_callback_find_shared_string_start;
|
||||
data->skip_end = shared_strings_callback_find_shared_stringitem_end;
|
||||
data->skip_data = NULL;
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_skip_tag_start, shared_strings_callback_skip_tag_end);
|
||||
XML_SetCharacterDataHandler(data->xmlparser, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_find_shared_string_end (void* callbackdata, const XML_Char* name)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if (XML_Char_icmp(name, X("t")) == 0) {
|
||||
XML_SetElementHandler(data->xmlparser, shared_strings_callback_find_shared_string_start, shared_strings_callback_find_shared_stringitem_end);
|
||||
XML_SetCharacterDataHandler(data->xmlparser, NULL);
|
||||
} else {
|
||||
shared_strings_callback_find_shared_stringitem_end(callbackdata, name);
|
||||
}
|
||||
}
|
||||
|
||||
void shared_strings_callback_string_data (void* callbackdata, const XML_Char* buf, int buflen)
|
||||
{
|
||||
struct shared_strings_callback_data* data = (struct shared_strings_callback_data*)callbackdata;
|
||||
if ((data->text = XML_Char_realloc(data->text, data->textlen + buflen)) == NULL) {
|
||||
//memory allocation error
|
||||
data->textlen = 0;
|
||||
} else {
|
||||
XML_Char_poscpy(data->text, data->textlen, buf, buflen);
|
||||
data->textlen += buflen;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
6
library/libxlsxio/lib/xlsxio_read_sharedstrings.dep
Normal file
6
library/libxlsxio/lib/xlsxio_read_sharedstrings.dep
Normal file
@ -0,0 +1,6 @@
|
||||
library/libxlsxio/lib/xlsxio_read_sharedstrings.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_read_sharedstrings.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_private.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/lib/xlsxio_read_sharedstrings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libexpat/expat/lib/expat.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libexpat/expat/lib/expat_external.h
|
56
library/libxlsxio/lib/xlsxio_read_sharedstrings.h
Normal file
56
library/libxlsxio/lib/xlsxio_read_sharedstrings.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef INCLUDED_XLSXIO_READ_SHAREDSTRINGS_H
|
||||
#define INCLUDED_XLSXIO_READ_SHAREDSTRINGS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <expat.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct sharedstringlist {
|
||||
XML_Char** strings;
|
||||
size_t numstrings;
|
||||
};
|
||||
|
||||
struct sharedstringlist* sharedstringlist_create ();
|
||||
void sharedstringlist_destroy (struct sharedstringlist* sharedstrings);
|
||||
size_t sharedstringlist_size (struct sharedstringlist* sharedstrings);
|
||||
int sharedstringlist_add_buffer (struct sharedstringlist* sharedstrings, const XML_Char* data, size_t datalen);
|
||||
int sharedstringlist_add_string (struct sharedstringlist* sharedstrings, const XML_Char* data);
|
||||
const XML_Char* sharedstringlist_get (struct sharedstringlist* sharedstrings, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct shared_strings_callback_data {
|
||||
XML_Parser xmlparser;
|
||||
struct sharedstringlist* sharedstrings;
|
||||
int insst;
|
||||
int insi;
|
||||
int intext;
|
||||
XML_Char* text;
|
||||
size_t textlen;
|
||||
XML_Char* skiptag; //tag to skip
|
||||
size_t skiptagcount; //nesting level for current tag to skip
|
||||
XML_StartElementHandler skip_start; //start handler to set after skipping
|
||||
XML_EndElementHandler skip_end; //end handler to set after skipping
|
||||
XML_CharacterDataHandler skip_data; //data handler to set after skipping
|
||||
};
|
||||
|
||||
void shared_strings_callback_data_initialize (struct shared_strings_callback_data* data, struct sharedstringlist* sharedstrings);
|
||||
void shared_strings_callback_data_cleanup (struct shared_strings_callback_data* data);
|
||||
void shared_strings_callback_skip_tag_start (void* callbackdata, const XML_Char* name, const XML_Char** atts);
|
||||
void shared_strings_callback_skip_tag_end (void* callbackdata, const XML_Char* name);
|
||||
void shared_strings_callback_find_sharedstringtable_start (void* callbackdata, const XML_Char* name, const XML_Char** atts);
|
||||
void shared_strings_callback_find_sharedstringtable_end (void* callbackdata, const XML_Char* name);
|
||||
void shared_strings_callback_find_shared_stringitem_start (void* callbackdata, const XML_Char* name, const XML_Char** atts);
|
||||
void shared_strings_callback_find_shared_stringitem_end (void* callbackdata, const XML_Char* name);
|
||||
void shared_strings_callback_find_shared_string_start (void* callbackdata, const XML_Char* name, const XML_Char** atts);
|
||||
void shared_strings_callback_find_shared_string_end (void* callbackdata, const XML_Char* name);
|
||||
void shared_strings_callback_string_data (void* callbackdata, const XML_Char* buf, int buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
1081
library/libxlsxio/lib/xlsxio_write.c
Normal file
1081
library/libxlsxio/lib/xlsxio_write.c
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user