FreeXL 1.0.5
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
67extern "C"
68{
69#endif
70
71/* constants */
73#define FREEXL_UNKNOWN 0
74
75/* CFBF constants */
77#define FREEXL_CFBF_VER_3 3
79#define FREEXL_CFBF_VER_4 4
80
82#define FREEXL_CFBF_SECTOR_512 512
84#define FREEXL_CFBF_SECTOR_4096 4096
85
86/* BIFF versions */
88#define FREEXL_BIFF_VER_2 2
90#define FREEXL_BIFF_VER_3 3
92#define FREEXL_BIFF_VER_4 4
94#define FREEXL_BIFF_VER_5 5
96#define FREEXL_BIFF_VER_8 8
97
98/* BIFF MaxRecordSize */
100#define FREEXL_BIFF_MAX_RECSZ_2080 2080
102#define FREEXL_BIFF_MAX_RECSZ_8224 8224
103
104/* BIFF DateMode */
106#define FREEXL_BIFF_DATEMODE_1900 1900
108#define FREEXL_BIFF_DATEMODE_1904 1904
109
110/* BIFF Obsfuscated */
112#define FREEXL_BIFF_OBFUSCATED 3003
114#define FREEXL_BIFF_PLAIN 3004
115
116/* BIFF CodePage */
118#define FREEXL_BIFF_ASCII 0x016F
120#define FREEXL_BIFF_CP437 0x01B5
122#define FREEXL_BIFF_CP720 0x02D0
124#define FREEXL_BIFF_CP737 0x02E1
126#define FREEXL_BIFF_CP775 0x0307
128#define FREEXL_BIFF_CP850 0x0352
130#define FREEXL_BIFF_CP852 0x0354
132#define FREEXL_BIFF_CP855 0x0357
134#define FREEXL_BIFF_CP857 0x0359
136#define FREEXL_BIFF_CP858 0x035A
138#define FREEXL_BIFF_CP860 0x035C
140#define FREEXL_BIFF_CP861 0x035D
142#define FREEXL_BIFF_CP862 0x035E
144#define FREEXL_BIFF_CP863 0x035F
146#define FREEXL_BIFF_CP864 0x0360
148#define FREEXL_BIFF_CP865 0x0361
150#define FREEXL_BIFF_CP866 0x0362
152#define FREEXL_BIFF_CP869 0x0365
154#define FREEXL_BIFF_CP874 0x036A
156#define FREEXL_BIFF_CP932 0x03A4
158#define FREEXL_BIFF_CP936 0x03A8
160#define FREEXL_BIFF_CP949 0x03B5
162#define FREEXL_BIFF_CP950 0x03B6
164#define FREEXL_BIFF_UTF16LE 0x04B0
166#define FREEXL_BIFF_CP1250 0x04E2
168#define FREEXL_BIFF_CP1251 0x04E3
170#define FREEXL_BIFF_CP1252 0x04E4
172#define FREEXL_BIFF_CP1253 0x04E5
174#define FREEXL_BIFF_CP1254 0x04E6
176#define FREEXL_BIFF_CP1255 0x04E7
178#define FREEXL_BIFF_CP1256 0x04E8
180#define FREEXL_BIFF_CP1257 0x04E9
182#define FREEXL_BIFF_CP1258 0x04EA
184#define FREEXL_BIFF_CP1361 0x0551
186#define FREEXL_BIFF_MACROMAN 0x2710
187
188/* CELL VALUE Types */
190#define FREEXL_CELL_NULL 101
192#define FREEXL_CELL_INT 102
194#define FREEXL_CELL_DOUBLE 103
196#define FREEXL_CELL_TEXT 104
198#define FREEXL_CELL_SST_TEXT 105
200#define FREEXL_CELL_DATE 106
202#define FREEXL_CELL_DATETIME 107
204#define FREEXL_CELL_TIME 108
205
206/* INFO params */
208#define FREEXL_CFBF_VERSION 32001
210#define FREEXL_CFBF_SECTOR_SIZE 32002
212#define FREEXL_CFBF_FAT_COUNT 32003
214#define FREEXL_BIFF_VERSION 32005
216#define FREEXL_BIFF_MAX_RECSIZE 32006
218#define FREEXL_BIFF_DATEMODE 32007
220#define FREEXL_BIFF_PASSWORD 32008
222#define FREEXL_BIFF_CODEPAGE 32009
224#define FREEXL_BIFF_SHEET_COUNT 32010
226#define FREEXL_BIFF_STRING_COUNT 32011
228#define FREEXL_BIFF_FORMAT_COUNT 32012
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
337 {
352 unsigned char type;
353 union
354 {
359 const char *text_value;
363 } value;
365 };
366
373
374
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 */
FREEXL_DECLARE int freexl_select_active_worksheet(const void *xls_handle, unsigned short sheet_index)
Set the currently active worksheets.
FREEXL_DECLARE const char * freexl_version(void)
Return the current library version.
FREEXL_DECLARE int freexl_close(const void *xls_handle)
Close the .xls file and releasing any allocated resource.
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_get_worksheet_name(const void *xls_handle, unsigned short sheet_index, const char **string)
Query worksheet name.
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_worksheet_dimensions(const void *xls_handle, unsigned int *rows, unsigned short *columns)
Query worksheet dimensions.
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_active_worksheet(const void *xls_handle, unsigned short *sheet_index)
Query the currently active worksheet index.
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.
Container for a cell value.
Definition: freexl.h:337
const char * text_value
if type is FREEXL_CELL_TEXT, FREEXL_CELL_SST_TEXT, FREEXL_CELL_DATE, FREEXL_CELL_DATETIME or FREEXL_C...
Definition: freexl.h:359
int int_value
if type is FREEXL_CELL_INT, then the corresponding value will be returned as int_value
Definition: freexl.h:355
union FreeXL_CellValue_str::@0 value
The value of the data stored in the cell.
double double_value
if type is FREEXL_CELL_DOUBLE, then the corresponding value will be returned as double_value
Definition: freexl.h:357
unsigned char type
The type of data stored in this cell.
Definition: freexl.h:352