FreeXL
1.0.0a
|
00001 /* 00002 / freexl.h 00003 / 00004 / public declarations 00005 / 00006 / version 1.0, 2011 July 26 00007 / 00008 / Author: Sandro Furieri a.furieri@lqt.it 00009 / 00010 / ------------------------------------------------------------------------------ 00011 / 00012 / Version: MPL 1.1/GPL 2.0/LGPL 2.1 00013 / 00014 / The contents of this file are subject to the Mozilla Public License Version 00015 / 1.1 (the "License"); you may not use this file except in compliance with 00016 / the License. You may obtain a copy of the License at 00017 / http://www.mozilla.org/MPL/ 00018 / 00019 / Software distributed under the License is distributed on an "AS IS" basis, 00020 / WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 00021 / for the specific language governing rights and limitations under the 00022 / License. 00023 / 00024 / The Original Code is the FreeXL library 00025 / 00026 / The Initial Developer of the Original Code is Alessandro Furieri 00027 / 00028 / Portions created by the Initial Developer are Copyright (C) 2011 00029 / the Initial Developer. All Rights Reserved. 00030 / 00031 / Contributor(s): 00032 / Brad Hards 00033 / 00034 / Alternatively, the contents of this file may be used under the terms of 00035 / either the GNU General Public License Version 2 or later (the "GPL"), or 00036 / the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 00037 / in which case the provisions of the GPL or the LGPL are applicable instead 00038 / of those above. If you wish to allow use of your version of this file only 00039 / under the terms of either the GPL or the LGPL, and not to allow others to 00040 / use your version of this file under the terms of the MPL, indicate your 00041 / decision by deleting the provisions above and replace them with the notice 00042 / and other provisions required by the GPL or the LGPL. If you do not delete 00043 / the provisions above, a recipient may use your version of this file under 00044 / the terms of any one of the MPL, the GPL or the LGPL. 00045 / 00046 */ 00047 00053 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00054 #ifdef DLL_EXPORT 00055 #define FREEXL_DECLARE __declspec(dllexport) 00056 #else 00057 #define FREEXL_DECLARE extern 00058 #endif 00059 #endif 00060 00061 #ifndef _FREEXL_H 00062 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00063 #define _FREEXL_H 00064 #endif 00065 00066 #ifdef __cplusplus 00067 extern "C" 00068 { 00069 #endif 00070 00071 /* constants */ 00073 #define FREEXL_UNKNOWN 0 00074 00075 /* CFBF constants */ 00077 #define FREEXL_CFBF_VER_3 3 00078 00079 #define FREEXL_CFBF_VER_4 4 00080 00082 #define FREEXL_CFBF_SECTOR_512 512 00083 00084 #define FREEXL_CFBF_SECTOR_4096 4096 00085 00086 /* BIFF versions */ 00088 #define FREEXL_BIFF_VER_2 2 00089 00090 #define FREEXL_BIFF_VER_3 3 00091 00092 #define FREEXL_BIFF_VER_4 4 00093 00094 #define FREEXL_BIFF_VER_5 5 00095 00096 #define FREEXL_BIFF_VER_8 8 00097 00098 /* BIFF MaxRecordSize */ 00100 #define FREEXL_BIFF_MAX_RECSZ_2080 2080 00101 00102 #define FREEXL_BIFF_MAX_RECSZ_8224 8224 00103 00104 /* BIFF DateMode */ 00106 #define FREEXL_BIFF_DATEMODE_1900 1900 00107 00108 #define FREEXL_BIFF_DATEMODE_1904 1904 00109 00110 /* BIFF Obsfuscated */ 00112 #define FREEXL_BIFF_OBFUSCATED 3003 00113 00114 #define FREEXL_BIFF_PLAIN 3004 00115 00116 /* BIFF CodePage */ 00118 #define FREEXL_BIFF_ASCII 0x016F 00119 00120 #define FREEXL_BIFF_CP437 0x01B5 00121 00122 #define FREEXL_BIFF_CP720 0x02D0 00123 00124 #define FREEXL_BIFF_CP737 0x02E1 00125 00126 #define FREEXL_BIFF_CP775 0x0307 00127 00128 #define FREEXL_BIFF_CP850 0x0352 00129 00130 #define FREEXL_BIFF_CP852 0x0354 00131 00132 #define FREEXL_BIFF_CP855 0x0357 00133 00134 #define FREEXL_BIFF_CP857 0x0359 00135 00136 #define FREEXL_BIFF_CP858 0x035A 00137 00138 #define FREEXL_BIFF_CP860 0x035C 00139 00140 #define FREEXL_BIFF_CP861 0x035D 00141 00142 #define FREEXL_BIFF_CP862 0x035E 00143 00144 #define FREEXL_BIFF_CP863 0x035F 00145 00146 #define FREEXL_BIFF_CP864 0x0360 00147 00148 #define FREEXL_BIFF_CP865 0x0361 00149 00150 #define FREEXL_BIFF_CP866 0x0362 00151 00152 #define FREEXL_BIFF_CP869 0x0365 00153 00154 #define FREEXL_BIFF_CP874 0x036A 00155 00156 #define FREEXL_BIFF_CP932 0x03A4 00157 00158 #define FREEXL_BIFF_CP936 0x03A8 00159 00160 #define FREEXL_BIFF_CP949 0x03B5 00161 00162 #define FREEXL_BIFF_CP950 0x03B6 00163 00164 #define FREEXL_BIFF_UTF16LE 0x04B0 00165 00166 #define FREEXL_BIFF_CP1250 0x04E2 00167 00168 #define FREEXL_BIFF_CP1251 0x04E3 00169 00170 #define FREEXL_BIFF_CP1252 0x04E4 00171 00172 #define FREEXL_BIFF_CP1253 0x04E5 00173 00174 #define FREEXL_BIFF_CP1254 0x04E6 00175 00176 #define FREEXL_BIFF_CP1255 0x04E7 00177 00178 #define FREEXL_BIFF_CP1256 0x04E8 00179 00180 #define FREEXL_BIFF_CP1257 0x04E9 00181 00182 #define FREEXL_BIFF_CP1258 0x04EA 00183 00184 #define FREEXL_BIFF_CP1361 0x0551 00185 00186 #define FREEXL_BIFF_MACROMAN 0x2710 00187 00188 /* CELL VALUE Types */ 00190 #define FREEXL_CELL_NULL 101 00191 00192 #define FREEXL_CELL_INT 102 00193 00194 #define FREEXL_CELL_DOUBLE 103 00195 00196 #define FREEXL_CELL_TEXT 104 00197 00198 #define FREEXL_CELL_SST_TEXT 105 00199 00200 #define FREEXL_CELL_DATE 106 00201 00202 #define FREEXL_CELL_DATETIME 107 00203 00204 #define FREEXL_CELL_TIME 108 00205 00206 /* INFO params */ 00208 #define FREEXL_CFBF_VERSION 32001 00209 00210 #define FREEXL_CFBF_SECTOR_SIZE 32002 00211 00212 #define FREEXL_CFBF_FAT_COUNT 32003 00213 00214 #define FREEXL_BIFF_VERSION 32005 00215 00216 #define FREEXL_BIFF_MAX_RECSIZE 32006 00217 00218 #define FREEXL_BIFF_DATEMODE 32007 00219 00220 #define FREEXL_BIFF_PASSWORD 32008 00221 00222 #define FREEXL_BIFF_CODEPAGE 32009 00223 00224 #define FREEXL_BIFF_SHEET_COUNT 32010 00225 00226 #define FREEXL_BIFF_STRING_COUNT 32011 00227 00228 #define FREEXL_BIFF_FORMAT_COUNT 32012 00229 00230 #define FREEXL_BIFF_XF_COUNT 32013 00231 00232 /* Error codes */ 00233 #define FREEXL_OK 0 00234 #define FREEXL_FILE_NOT_FOUND -1 00236 #define FREEXL_NULL_HANDLE -2 00237 #define FREEXL_INVALID_HANDLE -3 00238 #define FREEXL_INSUFFICIENT_MEMORY -4 00240 #define FREEXL_NULL_ARGUMENT -5 00241 #define FREEXL_INVALID_INFO_ARG -6 00242 #define FREEXL_INVALID_CFBF_HEADER -7 00244 #define FREEXL_CFBF_READ_ERROR -8 00246 #define FREEXL_CFBF_SEEK_ERROR -9 00248 #define FREEXL_CFBF_INVALID_SIGNATURE -10 00252 #define FREEXL_CFBF_INVALID_SECTOR_SIZE -11 00256 #define FREEXL_CFBF_EMPTY_FAT_CHAIN -12 00260 #define FREEXL_CFBF_ILLEGAL_FAT_ENTRY -13 00262 #define FREEXL_BIFF_INVALID_BOF -14 00264 #define FREEXL_BIFF_INVALID_SST -15 00266 #define FREEXL_BIFF_ILLEGAL_SST_INDEX -16 00268 #define FREEXL_BIFF_WORKBOOK_NOT_FOUND -17 00270 #define FREEXL_BIFF_ILLEGAL_SHEET_INDEX -18 00272 #define FREEXL_BIFF_UNSELECTED_SHEET -19 00277 #define FREEXL_INVALID_CHARACTER -20 00280 #define FREEXL_UNSUPPORTED_CHARSET -21 00282 #define FREEXL_ILLEGAL_CELL_ROW_COL -22 00284 #define FREEXL_ILLEGAL_RK_VALUE -23 00287 #define FREEXL_ILLEGAL_MULRK_VALUE -23 00290 #define FREEXL_INVALID_MINI_STREAM -24 00292 #define FREEXL_CFBF_ILLEGAL_MINI_FAT_ENTRY -25 00331 struct FreeXL_CellValue_str 00332 { 00347 unsigned char type; 00348 union 00349 { 00350 int int_value; 00352 double double_value; 00354 const char *text_value; 00358 } value; 00360 }; 00361 00367 typedef struct FreeXL_CellValue_str FreeXL_CellValue; 00368 00369 00383 FREEXL_DECLARE int freexl_open (const char *path, const void **xls_handle); 00384 00402 FREEXL_DECLARE int freexl_open_info (const char *path, 00403 const void **xls_handle); 00404 00415 FREEXL_DECLARE int freexl_close (const void *xls_handle); 00416 00452 FREEXL_DECLARE int freexl_get_info (const void *xls_handle, 00453 unsigned short what, 00454 unsigned int *info); 00455 00465 FREEXL_DECLARE int freexl_get_worksheet_name (const void *xls_handle, 00466 unsigned short sheet_index, 00467 const char **string); 00468 00480 FREEXL_DECLARE int freexl_select_active_worksheet (const void *xls_handle, 00481 unsigned short 00482 sheet_index); 00483 00495 FREEXL_DECLARE int freexl_get_active_worksheet (const void *xls_handle, 00496 unsigned short 00497 *sheet_index); 00498 00516 FREEXL_DECLARE int freexl_worksheet_dimensions (const void *xls_handle, 00517 unsigned int *rows, 00518 unsigned short *columns); 00519 00534 FREEXL_DECLARE int freexl_get_SST_string (const void *xls_handle, 00535 unsigned short string_index, 00536 const char **string); 00537 00559 FREEXL_DECLARE int freexl_get_FAT_entry (const void *xls_handle, 00560 unsigned int sector_index, 00561 unsigned int *next_sector_index); 00562 00573 FREEXL_DECLARE int freexl_get_cell_value (const void *xls_handle, 00574 unsigned int row, 00575 unsigned short column, 00576 FreeXL_CellValue * value); 00577 00578 #ifdef __cplusplus 00579 } 00580 #endif 00581 00582 #endif /* _FREEXL_H */