FreeXL  1.0.6
freexl.h
Go to the documentation of this file.
1 /*
2 / freexl.h
3 /
4 / public declarations
5 /
6 / version 1.0, 2011 July 26
7 /
8 / Author: Sandro Furieri a.furieri@lqt.it
9 /
10 / ------------------------------------------------------------------------------
11 /
12 / Version: MPL 1.1/GPL 2.0/LGPL 2.1
13 /
14 / The contents of this file are subject to the Mozilla Public License Version
15 / 1.1 (the "License"); you may not use this file except in compliance with
16 / the License. You may obtain a copy of the License at
17 / http://www.mozilla.org/MPL/
18 /
19 / Software distributed under the License is distributed on an "AS IS" basis,
20 / WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21 / for the specific language governing rights and limitations under the
22 / License.
23 /
24 / The Original Code is the FreeXL library
25 /
26 / The Initial Developer of the Original Code is Alessandro Furieri
27 /
28 / Portions created by the Initial Developer are Copyright (C) 2011
29 / the Initial Developer. All Rights Reserved.
30 /
31 / Contributor(s):
32 / Brad Hards
33 /
34 / Alternatively, the contents of this file may be used under the terms of
35 / either the GNU General Public License Version 2 or later (the "GPL"), or
36 / the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
37 / in which case the provisions of the GPL or the LGPL are applicable instead
38 / of those above. If you wish to allow use of your version of this file only
39 / under the terms of either the GPL or the LGPL, and not to allow others to
40 / use your version of this file under the terms of the MPL, indicate your
41 / decision by deleting the provisions above and replace them with the notice
42 / and other provisions required by the GPL or the LGPL. If you do not delete
43 / the provisions above, a recipient may use your version of this file under
44 / the terms of any one of the MPL, the GPL or the LGPL.
45 /
46 */
47 
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 #ifdef DLL_EXPORT
55 #define FREEXL_DECLARE __declspec(dllexport)
56 #else
57 #define FREEXL_DECLARE extern
58 #endif
59 #endif
60 
61 #ifndef _FREEXL_H
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
63 #define _FREEXL_H
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C"
68 {
69 #endif
70 
71 /* constants */
73 #define FREEXL_UNKNOWN 0
74 
75 /* CFBF constants */
77 #define FREEXL_CFBF_VER_3 3
78 
79 #define FREEXL_CFBF_VER_4 4
80 
82 #define FREEXL_CFBF_SECTOR_512 512
83 
84 #define FREEXL_CFBF_SECTOR_4096 4096
85 
86 /* BIFF versions */
88 #define FREEXL_BIFF_VER_2 2
89 
90 #define FREEXL_BIFF_VER_3 3
91 
92 #define FREEXL_BIFF_VER_4 4
93 
94 #define FREEXL_BIFF_VER_5 5
95 
96 #define FREEXL_BIFF_VER_8 8
97 
98 /* BIFF MaxRecordSize */
100 #define FREEXL_BIFF_MAX_RECSZ_2080 2080
101 
102 #define FREEXL_BIFF_MAX_RECSZ_8224 8224
103 
104 /* BIFF DateMode */
106 #define FREEXL_BIFF_DATEMODE_1900 1900
107 
108 #define FREEXL_BIFF_DATEMODE_1904 1904
109 
110 /* BIFF Obsfuscated */
112 #define FREEXL_BIFF_OBFUSCATED 3003
113 
114 #define FREEXL_BIFF_PLAIN 3004
115 
116 /* BIFF CodePage */
118 #define FREEXL_BIFF_ASCII 0x016F
119 
120 #define FREEXL_BIFF_CP437 0x01B5
121 
122 #define FREEXL_BIFF_CP720 0x02D0
123 
124 #define FREEXL_BIFF_CP737 0x02E1
125 
126 #define FREEXL_BIFF_CP775 0x0307
127 
128 #define FREEXL_BIFF_CP850 0x0352
129 
130 #define FREEXL_BIFF_CP852 0x0354
131 
132 #define FREEXL_BIFF_CP855 0x0357
133 
134 #define FREEXL_BIFF_CP857 0x0359
135 
136 #define FREEXL_BIFF_CP858 0x035A
137 
138 #define FREEXL_BIFF_CP860 0x035C
139 
140 #define FREEXL_BIFF_CP861 0x035D
141 
142 #define FREEXL_BIFF_CP862 0x035E
143 
144 #define FREEXL_BIFF_CP863 0x035F
145 
146 #define FREEXL_BIFF_CP864 0x0360
147 
148 #define FREEXL_BIFF_CP865 0x0361
149 
150 #define FREEXL_BIFF_CP866 0x0362
151 
152 #define FREEXL_BIFF_CP869 0x0365
153 
154 #define FREEXL_BIFF_CP874 0x036A
155 
156 #define FREEXL_BIFF_CP932 0x03A4
157 
158 #define FREEXL_BIFF_CP936 0x03A8
159 
160 #define FREEXL_BIFF_CP949 0x03B5
161 
162 #define FREEXL_BIFF_CP950 0x03B6
163 
164 #define FREEXL_BIFF_UTF16LE 0x04B0
165 
166 #define FREEXL_BIFF_CP1250 0x04E2
167 
168 #define FREEXL_BIFF_CP1251 0x04E3
169 
170 #define FREEXL_BIFF_CP1252 0x04E4
171 
172 #define FREEXL_BIFF_CP1253 0x04E5
173 
174 #define FREEXL_BIFF_CP1254 0x04E6
175 
176 #define FREEXL_BIFF_CP1255 0x04E7
177 
178 #define FREEXL_BIFF_CP1256 0x04E8
179 
180 #define FREEXL_BIFF_CP1257 0x04E9
181 
182 #define FREEXL_BIFF_CP1258 0x04EA
183 
184 #define FREEXL_BIFF_CP1361 0x0551
185 
186 #define FREEXL_BIFF_MACROMAN 0x2710
187 
188 /* CELL VALUE Types */
190 #define FREEXL_CELL_NULL 101
191 
192 #define FREEXL_CELL_INT 102
193 
194 #define FREEXL_CELL_DOUBLE 103
195 
196 #define FREEXL_CELL_TEXT 104
197 
198 #define FREEXL_CELL_SST_TEXT 105
199 
200 #define FREEXL_CELL_DATE 106
201 
202 #define FREEXL_CELL_DATETIME 107
203 
204 #define FREEXL_CELL_TIME 108
205 
206 /* INFO params */
208 #define FREEXL_CFBF_VERSION 32001
209 
210 #define FREEXL_CFBF_SECTOR_SIZE 32002
211 
212 #define FREEXL_CFBF_FAT_COUNT 32003
213 
214 #define FREEXL_BIFF_VERSION 32005
215 
216 #define FREEXL_BIFF_MAX_RECSIZE 32006
217 
218 #define FREEXL_BIFF_DATEMODE 32007
219 
220 #define FREEXL_BIFF_PASSWORD 32008
221 
222 #define FREEXL_BIFF_CODEPAGE 32009
223 
224 #define FREEXL_BIFF_SHEET_COUNT 32010
225 
226 #define FREEXL_BIFF_STRING_COUNT 32011
227 
228 #define FREEXL_BIFF_FORMAT_COUNT 32012
229 
230 #define FREEXL_BIFF_XF_COUNT 32013
231 
232 /* Error codes */
233 #define FREEXL_OK 0
234 #define FREEXL_FILE_NOT_FOUND -1
236 #define FREEXL_NULL_HANDLE -2
237 #define FREEXL_INVALID_HANDLE -3
238 #define FREEXL_INSUFFICIENT_MEMORY -4
240 #define FREEXL_NULL_ARGUMENT -5
241 #define FREEXL_INVALID_INFO_ARG -6
242 #define FREEXL_INVALID_CFBF_HEADER -7
244 #define FREEXL_CFBF_READ_ERROR -8
246 #define FREEXL_CFBF_SEEK_ERROR -9
248 #define FREEXL_CFBF_INVALID_SIGNATURE -10
252 #define FREEXL_CFBF_INVALID_SECTOR_SIZE -11
256 #define FREEXL_CFBF_EMPTY_FAT_CHAIN -12
260 #define FREEXL_CFBF_ILLEGAL_FAT_ENTRY -13
262 #define FREEXL_BIFF_INVALID_BOF -14
264 #define FREEXL_BIFF_INVALID_SST -15
266 #define FREEXL_BIFF_ILLEGAL_SST_INDEX -16
268 #define FREEXL_BIFF_WORKBOOK_NOT_FOUND -17
270 #define FREEXL_BIFF_ILLEGAL_SHEET_INDEX -18
272 #define FREEXL_BIFF_UNSELECTED_SHEET -19
277 #define FREEXL_INVALID_CHARACTER -20
280 #define FREEXL_UNSUPPORTED_CHARSET -21
282 #define FREEXL_ILLEGAL_CELL_ROW_COL -22
284 #define FREEXL_ILLEGAL_RK_VALUE -23
287 #define FREEXL_ILLEGAL_MULRK_VALUE -23
290 #define FREEXL_INVALID_MINI_STREAM -24
292 #define FREEXL_CFBF_ILLEGAL_MINI_FAT_ENTRY -25
295 #define FREEXL_CRAFTED_FILE -26
336  struct FreeXL_CellValue_str
337  {
352  unsigned char type;
353  union
354  {
355  int int_value;
357  double double_value;
359  const char *text_value;
363  } value;
365  };
366 
372  typedef struct FreeXL_CellValue_str FreeXL_CellValue;
373 
380  FREEXL_DECLARE const char *freexl_version (void);
381 
395  FREEXL_DECLARE int freexl_open (const char *path, const void **xls_handle);
396 
414  FREEXL_DECLARE int freexl_open_info (const char *path,
415  const void **xls_handle);
416 
427  FREEXL_DECLARE int freexl_close (const void *xls_handle);
428 
464  FREEXL_DECLARE int freexl_get_info (const void *xls_handle,
465  unsigned short what,
466  unsigned int *info);
467 
477  FREEXL_DECLARE int freexl_get_worksheet_name (const void *xls_handle,
478  unsigned short sheet_index,
479  const char **string);
480 
492  FREEXL_DECLARE int freexl_select_active_worksheet (const void *xls_handle,
493  unsigned short
494  sheet_index);
495 
507  FREEXL_DECLARE int freexl_get_active_worksheet (const void *xls_handle,
508  unsigned short
509  *sheet_index);
510 
528  FREEXL_DECLARE int freexl_worksheet_dimensions (const void *xls_handle,
529  unsigned int *rows,
530  unsigned short *columns);
531 
546  FREEXL_DECLARE int freexl_get_SST_string (const void *xls_handle,
547  unsigned short string_index,
548  const char **string);
549 
571  FREEXL_DECLARE int freexl_get_FAT_entry (const void *xls_handle,
572  unsigned int sector_index,
573  unsigned int *next_sector_index);
574 
585  FREEXL_DECLARE int freexl_get_cell_value (const void *xls_handle,
586  unsigned int row,
587  unsigned short column,
589 
590 #ifdef __cplusplus
591 }
592 #endif
593 
594 #endif /* _FREEXL_H */
Container for a cell value.
Definition: freexl.h:374
FREEXL_DECLARE int freexl_get_cell_value(const void *xls_handle, unsigned int row, unsigned short column, FreeXL_CellValue *value)
Retrieve individual cell values from the currently active worksheet.
FREEXL_DECLARE int freexl_get_SST_string(const void *xls_handle, unsigned short string_index, const char **string)
Retrieve string entries from SST.
FREEXL_DECLARE const char * freexl_version(void)
Return the current library version.
FREEXL_DECLARE int freexl_worksheet_dimensions(const void *xls_handle, unsigned int *rows, unsigned short *columns)
Query worksheet dimensions.
FREEXL_DECLARE int freexl_select_active_worksheet(const void *xls_handle, unsigned short sheet_index)
Set the currently active worksheets.
FREEXL_DECLARE int freexl_open_info(const char *path, const void **xls_handle)
Open the .xls file for metadata query only.
FREEXL_DECLARE int freexl_open(const char *path, const void **xls_handle)
Open the .xls file, preparing for future functions.
FREEXL_DECLARE int freexl_get_worksheet_name(const void *xls_handle, unsigned short sheet_index, const char **string)
Query worksheet name.
FREEXL_DECLARE int freexl_get_info(const void *xls_handle, unsigned short what, unsigned int *info)
Query general information about the Workbook and Worksheets.
FREEXL_DECLARE int freexl_get_FAT_entry(const void *xls_handle, unsigned int sector_index, unsigned int *next_sector_index)
Retrieve FAT entries from FAT chain.
FREEXL_DECLARE int freexl_close(const void *xls_handle)
Close the .xls file and releasing any allocated resource.
union FreeXL_CellValue_str::@0 value
The value of the data stored in the cell.
FREEXL_DECLARE int freexl_get_active_worksheet(const void *xls_handle, unsigned short *sheet_index)
Query the currently active worksheet index.