xlsxwriter 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +40 -0
- data/ext/xlsxwriter/chart.c +105 -0
- data/ext/xlsxwriter/chart.h +27 -0
- data/ext/xlsxwriter/extconf.rb +14 -0
- data/ext/xlsxwriter/format.c +67 -0
- data/ext/xlsxwriter/format.h +9 -0
- data/ext/xlsxwriter/libxlsxwriter/LICENSE.txt +89 -0
- data/ext/xlsxwriter/libxlsxwriter/Makefile +141 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +1093 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +336 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +215 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +751 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/ext/xlsxwriter/libxlsxwriter/lib/.gitignore +0 -0
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +125 -0
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +439 -0
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +3420 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +341 -0
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +293 -0
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +224 -0
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +746 -0
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +728 -0
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +223 -0
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +877 -0
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +242 -0
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +264 -0
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +1086 -0
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +348 -0
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +512 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +1895 -0
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +4992 -0
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +355 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.h +209 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/ext/xlsxwriter/workbook.c +257 -0
- data/ext/xlsxwriter/workbook.h +42 -0
- data/ext/xlsxwriter/workbook_properties.c +103 -0
- data/ext/xlsxwriter/workbook_properties.h +10 -0
- data/ext/xlsxwriter/worksheet.c +1064 -0
- data/ext/xlsxwriter/worksheet.h +74 -0
- data/ext/xlsxwriter/xlsxwriter.c +239 -0
- data/lib/xlsxwriter.rb +6 -0
- data/lib/xlsxwriter/version.rb +3 -0
- data/lib/xlsxwriter/worksheet.rb +72 -0
- data/test/run-test.rb +11 -0
- data/test/support/xlsx_comparable.rb +109 -0
- data/test/test-array-formula.rb +33 -0
- data/test/test-autofilter.rb +70 -0
- data/test/test-chart-area.rb +25 -0
- data/test/test-data.rb +65 -0
- data/test/test-default-row.rb +25 -0
- data/test/test-defined-name.rb +46 -0
- data/test/test-escapes.rb +33 -0
- data/test/test-fit-to-pages.rb +21 -0
- data/test/test-formatting.rb +137 -0
- data/test/test-gridlines.rb +15 -0
- data/test/test-hyperlink.rb +67 -0
- data/test/test-image.rb +84 -0
- data/test/test-merge-range.rb +18 -0
- data/test/test-misc.rb +29 -0
- data/test/test-optimize.rb +32 -0
- data/test/test-page-breaks.rb +13 -0
- data/test/test-page-setup.rb +28 -0
- data/test/test-panes.rb +45 -0
- data/test/test-print-area.rb +19 -0
- data/test/test-print-options.rb +61 -0
- data/test/test-print-scale.rb +12 -0
- data/test/test-properties.rb +51 -0
- data/test/test-protect.rb +27 -0
- data/test/test-repeat.rb +23 -0
- data/test/test-row-col-format.rb +35 -0
- data/test/test-set-selection.rb +13 -0
- data/test/test-set-start-page.rb +13 -0
- data/test/test-simple.rb +62 -0
- data/test/test-types.rb +17 -0
- data/test/xlsx-func-testcase.rb +36 -0
- metadata +228 -0
@@ -0,0 +1,375 @@
|
|
1
|
+
/* zip.h -- IO on .zip files using zlib
|
2
|
+
Version 1.1, February 14h, 2010
|
3
|
+
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
4
|
+
|
5
|
+
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
6
|
+
|
7
|
+
Modifications for Zip64 support
|
8
|
+
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
9
|
+
|
10
|
+
For more info read MiniZip_info.txt
|
11
|
+
|
12
|
+
---------------------------------------------------------------------------
|
13
|
+
|
14
|
+
Condition of use and distribution are the same than zlib :
|
15
|
+
|
16
|
+
This software is provided 'as-is', without any express or implied
|
17
|
+
warranty. In no event will the authors be held liable for any damages
|
18
|
+
arising from the use of this software.
|
19
|
+
|
20
|
+
Permission is granted to anyone to use this software for any purpose,
|
21
|
+
including commercial applications, and to alter it and redistribute it
|
22
|
+
freely, subject to the following restrictions:
|
23
|
+
|
24
|
+
1. The origin of this software must not be misrepresented; you must not
|
25
|
+
claim that you wrote the original software. If you use this software
|
26
|
+
in a product, an acknowledgment in the product documentation would be
|
27
|
+
appreciated but is not required.
|
28
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
29
|
+
misrepresented as being the original software.
|
30
|
+
3. This notice may not be removed or altered from any source distribution.
|
31
|
+
|
32
|
+
---------------------------------------------------------------------------
|
33
|
+
|
34
|
+
Changes
|
35
|
+
|
36
|
+
See header of zip.h
|
37
|
+
|
38
|
+
*/
|
39
|
+
|
40
|
+
/* Pragma added by libxlsxwriter to avoid warnings with -pedantic -ansi. */
|
41
|
+
#ifndef _WIN32
|
42
|
+
#pragma GCC system_header
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#ifndef _zip12_H
|
46
|
+
#define _zip12_H
|
47
|
+
|
48
|
+
#ifdef __cplusplus
|
49
|
+
extern "C" {
|
50
|
+
#endif
|
51
|
+
|
52
|
+
/* #define HAVE_BZIP2 */
|
53
|
+
|
54
|
+
#ifndef _ZLIB_H
|
55
|
+
#include "zlib.h"
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#ifndef _ZLIBIOAPI_H
|
59
|
+
#include "ioapi.h"
|
60
|
+
#endif
|
61
|
+
|
62
|
+
/* Encryption not required by libxlsxwriter. */
|
63
|
+
#ifndef NOCRYPT
|
64
|
+
#define NOCRYPT
|
65
|
+
#endif
|
66
|
+
#ifndef NOUNCRYPT
|
67
|
+
#define NOUNCRYPT
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#ifdef HAVE_BZIP2
|
71
|
+
#include "bzlib.h"
|
72
|
+
#endif
|
73
|
+
|
74
|
+
#define Z_BZIP2ED 12
|
75
|
+
|
76
|
+
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
77
|
+
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
78
|
+
from (void*) without cast */
|
79
|
+
typedef struct TagzipFile__ { int unused; } zipFile__;
|
80
|
+
typedef zipFile__ *zipFile;
|
81
|
+
#else
|
82
|
+
typedef voidp zipFile;
|
83
|
+
#endif
|
84
|
+
|
85
|
+
#define ZIP_OK (0)
|
86
|
+
#define ZIP_EOF (0)
|
87
|
+
#define ZIP_ERRNO (Z_ERRNO)
|
88
|
+
#define ZIP_PARAMERROR (-102)
|
89
|
+
#define ZIP_BADZIPFILE (-103)
|
90
|
+
#define ZIP_INTERNALERROR (-104)
|
91
|
+
|
92
|
+
#ifndef DEF_MEM_LEVEL
|
93
|
+
# if MAX_MEM_LEVEL >= 8
|
94
|
+
# define DEF_MEM_LEVEL 8
|
95
|
+
# else
|
96
|
+
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
97
|
+
# endif
|
98
|
+
#endif
|
99
|
+
/* default memLevel */
|
100
|
+
|
101
|
+
/* tm_zip contain date/time info */
|
102
|
+
typedef struct tm_zip_s
|
103
|
+
{
|
104
|
+
uInt tm_sec; /* seconds after the minute - [0,59] */
|
105
|
+
uInt tm_min; /* minutes after the hour - [0,59] */
|
106
|
+
uInt tm_hour; /* hours since midnight - [0,23] */
|
107
|
+
uInt tm_mday; /* day of the month - [1,31] */
|
108
|
+
uInt tm_mon; /* months since January - [0,11] */
|
109
|
+
uInt tm_year; /* years - [1980..2044] */
|
110
|
+
} tm_zip;
|
111
|
+
|
112
|
+
typedef struct
|
113
|
+
{
|
114
|
+
tm_zip tmz_date; /* date in understandable format */
|
115
|
+
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
116
|
+
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
117
|
+
|
118
|
+
uLong internal_fa; /* internal file attributes 2 bytes */
|
119
|
+
uLong external_fa; /* external file attributes 4 bytes */
|
120
|
+
} zip_fileinfo;
|
121
|
+
|
122
|
+
typedef const char* zipcharpc;
|
123
|
+
|
124
|
+
|
125
|
+
#define APPEND_STATUS_CREATE (0)
|
126
|
+
#define APPEND_STATUS_CREATEAFTER (1)
|
127
|
+
#define APPEND_STATUS_ADDINZIP (2)
|
128
|
+
|
129
|
+
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
130
|
+
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
131
|
+
/*
|
132
|
+
Create a zipfile.
|
133
|
+
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
134
|
+
an Unix computer "zlib/zlib113.zip".
|
135
|
+
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
136
|
+
will be created at the end of the file.
|
137
|
+
(useful if the file contain a self extractor code)
|
138
|
+
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
139
|
+
add files in existing zip (be sure you don't add file that doesn't exist)
|
140
|
+
If the zipfile cannot be opened, the return value is NULL.
|
141
|
+
Else, the return value is a zipFile Handle, usable with other function
|
142
|
+
of this zip package.
|
143
|
+
*/
|
144
|
+
|
145
|
+
/* Note : there is no delete function into a zipfile.
|
146
|
+
If you want delete file into a zipfile, you must open a zipfile, and create another
|
147
|
+
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
148
|
+
*/
|
149
|
+
|
150
|
+
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
151
|
+
int append,
|
152
|
+
zipcharpc* globalcomment,
|
153
|
+
zlib_filefunc_def* pzlib_filefunc_def));
|
154
|
+
|
155
|
+
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
|
156
|
+
int append,
|
157
|
+
zipcharpc* globalcomment,
|
158
|
+
zlib_filefunc64_def* pzlib_filefunc_def));
|
159
|
+
|
160
|
+
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
161
|
+
const char* filename,
|
162
|
+
const zip_fileinfo* zipfi,
|
163
|
+
const void* extrafield_local,
|
164
|
+
uInt size_extrafield_local,
|
165
|
+
const void* extrafield_global,
|
166
|
+
uInt size_extrafield_global,
|
167
|
+
const char* comment,
|
168
|
+
int method,
|
169
|
+
int level));
|
170
|
+
|
171
|
+
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
172
|
+
const char* filename,
|
173
|
+
const zip_fileinfo* zipfi,
|
174
|
+
const void* extrafield_local,
|
175
|
+
uInt size_extrafield_local,
|
176
|
+
const void* extrafield_global,
|
177
|
+
uInt size_extrafield_global,
|
178
|
+
const char* comment,
|
179
|
+
int method,
|
180
|
+
int level,
|
181
|
+
int zip64));
|
182
|
+
|
183
|
+
/*
|
184
|
+
Open a file in the ZIP for writing.
|
185
|
+
filename : the filename in zip (if NULL, '-' without quote will be used
|
186
|
+
*zipfi contain supplemental information
|
187
|
+
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
188
|
+
contains the extrafield data the the local header
|
189
|
+
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
190
|
+
contains the extrafield data the the local header
|
191
|
+
if comment != NULL, comment contain the comment string
|
192
|
+
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
193
|
+
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
194
|
+
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
|
195
|
+
this MUST be '1' if the uncompressed size is >= 0xffffffff.
|
196
|
+
|
197
|
+
*/
|
198
|
+
|
199
|
+
|
200
|
+
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
201
|
+
const char* filename,
|
202
|
+
const zip_fileinfo* zipfi,
|
203
|
+
const void* extrafield_local,
|
204
|
+
uInt size_extrafield_local,
|
205
|
+
const void* extrafield_global,
|
206
|
+
uInt size_extrafield_global,
|
207
|
+
const char* comment,
|
208
|
+
int method,
|
209
|
+
int level,
|
210
|
+
int raw));
|
211
|
+
|
212
|
+
|
213
|
+
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
|
214
|
+
const char* filename,
|
215
|
+
const zip_fileinfo* zipfi,
|
216
|
+
const void* extrafield_local,
|
217
|
+
uInt size_extrafield_local,
|
218
|
+
const void* extrafield_global,
|
219
|
+
uInt size_extrafield_global,
|
220
|
+
const char* comment,
|
221
|
+
int method,
|
222
|
+
int level,
|
223
|
+
int raw,
|
224
|
+
int zip64));
|
225
|
+
/*
|
226
|
+
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
227
|
+
*/
|
228
|
+
|
229
|
+
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
230
|
+
const char* filename,
|
231
|
+
const zip_fileinfo* zipfi,
|
232
|
+
const void* extrafield_local,
|
233
|
+
uInt size_extrafield_local,
|
234
|
+
const void* extrafield_global,
|
235
|
+
uInt size_extrafield_global,
|
236
|
+
const char* comment,
|
237
|
+
int method,
|
238
|
+
int level,
|
239
|
+
int raw,
|
240
|
+
int windowBits,
|
241
|
+
int memLevel,
|
242
|
+
int strategy,
|
243
|
+
const char* password,
|
244
|
+
uLong crcForCrypting));
|
245
|
+
|
246
|
+
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
247
|
+
const char* filename,
|
248
|
+
const zip_fileinfo* zipfi,
|
249
|
+
const void* extrafield_local,
|
250
|
+
uInt size_extrafield_local,
|
251
|
+
const void* extrafield_global,
|
252
|
+
uInt size_extrafield_global,
|
253
|
+
const char* comment,
|
254
|
+
int method,
|
255
|
+
int level,
|
256
|
+
int raw,
|
257
|
+
int windowBits,
|
258
|
+
int memLevel,
|
259
|
+
int strategy,
|
260
|
+
const char* password,
|
261
|
+
uLong crcForCrypting,
|
262
|
+
int zip64
|
263
|
+
));
|
264
|
+
|
265
|
+
/*
|
266
|
+
Same than zipOpenNewFileInZip2, except
|
267
|
+
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
268
|
+
password : crypting password (NULL for no crypting)
|
269
|
+
crcForCrypting : crc of file to compress (needed for crypting)
|
270
|
+
*/
|
271
|
+
|
272
|
+
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
|
273
|
+
const char* filename,
|
274
|
+
const zip_fileinfo* zipfi,
|
275
|
+
const void* extrafield_local,
|
276
|
+
uInt size_extrafield_local,
|
277
|
+
const void* extrafield_global,
|
278
|
+
uInt size_extrafield_global,
|
279
|
+
const char* comment,
|
280
|
+
int method,
|
281
|
+
int level,
|
282
|
+
int raw,
|
283
|
+
int windowBits,
|
284
|
+
int memLevel,
|
285
|
+
int strategy,
|
286
|
+
const char* password,
|
287
|
+
uLong crcForCrypting,
|
288
|
+
uLong versionMadeBy,
|
289
|
+
uLong flagBase
|
290
|
+
));
|
291
|
+
|
292
|
+
|
293
|
+
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
294
|
+
const char* filename,
|
295
|
+
const zip_fileinfo* zipfi,
|
296
|
+
const void* extrafield_local,
|
297
|
+
uInt size_extrafield_local,
|
298
|
+
const void* extrafield_global,
|
299
|
+
uInt size_extrafield_global,
|
300
|
+
const char* comment,
|
301
|
+
int method,
|
302
|
+
int level,
|
303
|
+
int raw,
|
304
|
+
int windowBits,
|
305
|
+
int memLevel,
|
306
|
+
int strategy,
|
307
|
+
const char* password,
|
308
|
+
uLong crcForCrypting,
|
309
|
+
uLong versionMadeBy,
|
310
|
+
uLong flagBase,
|
311
|
+
int zip64
|
312
|
+
));
|
313
|
+
/*
|
314
|
+
Same than zipOpenNewFileInZip4, except
|
315
|
+
versionMadeBy : value for Version made by field
|
316
|
+
flag : value for flag field (compression level info will be added)
|
317
|
+
*/
|
318
|
+
|
319
|
+
|
320
|
+
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
321
|
+
const void* buf,
|
322
|
+
unsigned len));
|
323
|
+
/*
|
324
|
+
Write data in the zipfile
|
325
|
+
*/
|
326
|
+
|
327
|
+
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
328
|
+
/*
|
329
|
+
Close the current file in the zipfile
|
330
|
+
*/
|
331
|
+
|
332
|
+
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
333
|
+
uLong uncompressed_size,
|
334
|
+
uLong crc32));
|
335
|
+
|
336
|
+
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
337
|
+
ZPOS64_T uncompressed_size,
|
338
|
+
uLong crc32));
|
339
|
+
|
340
|
+
/*
|
341
|
+
Close the current file in the zipfile, for file opened with
|
342
|
+
parameter raw=1 in zipOpenNewFileInZip2
|
343
|
+
uncompressed_size and crc32 are value for the uncompressed size
|
344
|
+
*/
|
345
|
+
|
346
|
+
extern int ZEXPORT zipClose OF((zipFile file,
|
347
|
+
const char* global_comment));
|
348
|
+
/*
|
349
|
+
Close the zipfile
|
350
|
+
*/
|
351
|
+
|
352
|
+
|
353
|
+
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
|
354
|
+
/*
|
355
|
+
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
356
|
+
|
357
|
+
Remove extra information block from a extra information data for the local file header or central directory header
|
358
|
+
|
359
|
+
It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
|
360
|
+
|
361
|
+
0x0001 is the signature header for the ZIP64 extra information blocks
|
362
|
+
|
363
|
+
usage.
|
364
|
+
Remove ZIP64 Extra information from a central director extra field data
|
365
|
+
zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
|
366
|
+
|
367
|
+
Remove ZIP64 Extra information from a Local File Header extra field data
|
368
|
+
zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
|
369
|
+
*/
|
370
|
+
|
371
|
+
#ifdef __cplusplus
|
372
|
+
}
|
373
|
+
#endif
|
374
|
+
|
375
|
+
#endif /* _zip64_H */
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @file utility.h
|
9
|
+
*
|
10
|
+
* @brief Utility functions for libxlsxwriter.
|
11
|
+
*
|
12
|
+
* <!-- Copyright 2014-2017, John McNamara, jmcnamara@cpan.org -->
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
|
16
|
+
#ifndef __LXW_UTILITY_H__
|
17
|
+
#define __LXW_UTILITY_H__
|
18
|
+
|
19
|
+
#include <stdint.h>
|
20
|
+
#include "common.h"
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @brief Convert an Excel `A1` cell string into a `(row, col)` pair.
|
24
|
+
*
|
25
|
+
* Convert an Excel `A1` cell string into a `(row, col)` pair.
|
26
|
+
*
|
27
|
+
* This is a little syntactic shortcut to help with worksheet layout:
|
28
|
+
*
|
29
|
+
* @code
|
30
|
+
* worksheet_write_string(worksheet, CELL("A1"), "Foo", NULL);
|
31
|
+
*
|
32
|
+
* //Same as:
|
33
|
+
* worksheet_write_string(worksheet, 0, 0, "Foo", NULL);
|
34
|
+
* @endcode
|
35
|
+
*
|
36
|
+
* @note
|
37
|
+
*
|
38
|
+
* This macro shouldn't be used in performance critical situations since it
|
39
|
+
* expands to two function calls.
|
40
|
+
*/
|
41
|
+
#define CELL(cell) \
|
42
|
+
lxw_name_to_row(cell), lxw_name_to_col(cell)
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @brief Convert an Excel `A:B` column range into a `(col1, col2)` pair.
|
46
|
+
*
|
47
|
+
* Convert an Excel `A:B` column range into a `(col1, col2)` pair.
|
48
|
+
*
|
49
|
+
* This is a little syntactic shortcut to help with worksheet layout:
|
50
|
+
*
|
51
|
+
* @code
|
52
|
+
* worksheet_set_column(worksheet, COLS("B:D"), 20, NULL, NULL);
|
53
|
+
*
|
54
|
+
* // Same as:
|
55
|
+
* worksheet_set_column(worksheet, 1, 3, 20, NULL, NULL);
|
56
|
+
* @endcode
|
57
|
+
*
|
58
|
+
*/
|
59
|
+
#define COLS(cols) \
|
60
|
+
lxw_name_to_col(cols), lxw_name_to_col_2(cols)
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @brief Convert an Excel `A1:B2` range into a `(first_row, first_col,
|
64
|
+
* last_row, last_col)` sequence.
|
65
|
+
*
|
66
|
+
* Convert an Excel `A1:B2` range into a `(first_row, first_col, last_row,
|
67
|
+
* last_col)` sequence.
|
68
|
+
*
|
69
|
+
* This is a little syntactic shortcut to help with worksheet layout.
|
70
|
+
*
|
71
|
+
* @code
|
72
|
+
* worksheet_print_area(worksheet, 0, 0, 41, 10); // A1:K42.
|
73
|
+
*
|
74
|
+
* // Same as:
|
75
|
+
* worksheet_print_area(worksheet, RANGE("A1:K42"));
|
76
|
+
* @endcode
|
77
|
+
*/
|
78
|
+
#define RANGE(range) \
|
79
|
+
lxw_name_to_row(range), lxw_name_to_col(range), \
|
80
|
+
lxw_name_to_row_2(range), lxw_name_to_col_2(range)
|
81
|
+
|
82
|
+
/* *INDENT-OFF* */
|
83
|
+
#ifdef __cplusplus
|
84
|
+
extern "C" {
|
85
|
+
#endif
|
86
|
+
/* *INDENT-ON* */
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @brief Converts a libxlsxwriter error number to a string.
|
90
|
+
*
|
91
|
+
* The `%lxw_strerror` function converts a libxlsxwriter error number defined
|
92
|
+
* by #lxw_error to a pointer to a string description of the error.
|
93
|
+
* Similar to the standard library strerror(3) function.
|
94
|
+
*
|
95
|
+
* For example:
|
96
|
+
*
|
97
|
+
* @code
|
98
|
+
* lxw_error error = workbook_close(workbook);
|
99
|
+
*
|
100
|
+
* if (error)
|
101
|
+
* printf("Error in workbook_close().\n"
|
102
|
+
* "Error %d = %s\n", error, lxw_strerror(error));
|
103
|
+
* @endcode
|
104
|
+
*
|
105
|
+
* This would produce output like the following if the target file wasn't
|
106
|
+
* writable:
|
107
|
+
*
|
108
|
+
* Error in workbook_close().
|
109
|
+
* Error 2 = Error creating output xlsx file. Usually a permissions error.
|
110
|
+
*
|
111
|
+
* @param error_num The error number returned by a libxlsxwriter function.
|
112
|
+
*
|
113
|
+
* @return A pointer to a statically allocated string. Do not free.
|
114
|
+
*/
|
115
|
+
char *lxw_strerror(lxw_error error_num);
|
116
|
+
|
117
|
+
/* Create a quoted version of the worksheet name */
|
118
|
+
char *lxw_quote_sheetname(const char *str);
|
119
|
+
|
120
|
+
void lxw_col_to_name(char *col_name, lxw_col_t col_num, uint8_t absolute);
|
121
|
+
|
122
|
+
void lxw_rowcol_to_cell(char *cell_name, lxw_row_t row, lxw_col_t col);
|
123
|
+
|
124
|
+
void lxw_rowcol_to_cell_abs(char *cell_name,
|
125
|
+
lxw_row_t row,
|
126
|
+
lxw_col_t col, uint8_t abs_row, uint8_t abs_col);
|
127
|
+
|
128
|
+
void lxw_rowcol_to_range(char *range,
|
129
|
+
lxw_row_t first_row, lxw_col_t first_col,
|
130
|
+
lxw_row_t last_row, lxw_col_t last_col);
|
131
|
+
|
132
|
+
void lxw_rowcol_to_range_abs(char *range,
|
133
|
+
lxw_row_t first_row, lxw_col_t first_col,
|
134
|
+
lxw_row_t last_row, lxw_col_t last_col);
|
135
|
+
|
136
|
+
void lxw_rowcol_to_formula_abs(char *formula, const char *sheetname,
|
137
|
+
lxw_row_t first_row, lxw_col_t first_col,
|
138
|
+
lxw_row_t last_row, lxw_col_t last_col);
|
139
|
+
|
140
|
+
uint32_t lxw_name_to_row(const char *row_str);
|
141
|
+
uint16_t lxw_name_to_col(const char *col_str);
|
142
|
+
uint32_t lxw_name_to_row_2(const char *row_str);
|
143
|
+
uint16_t lxw_name_to_col_2(const char *col_str);
|
144
|
+
|
145
|
+
double lxw_datetime_to_excel_date(lxw_datetime *datetime, uint8_t date_1904);
|
146
|
+
|
147
|
+
char *lxw_strdup(const char *str);
|
148
|
+
|
149
|
+
size_t lxw_utf8_strlen(const char *str);
|
150
|
+
|
151
|
+
void lxw_str_tolower(char *str);
|
152
|
+
|
153
|
+
FILE *lxw_tmpfile(char *tmpdir);
|
154
|
+
|
155
|
+
/* Declarations required for unit testing. */
|
156
|
+
#ifdef TESTING
|
157
|
+
|
158
|
+
#endif
|
159
|
+
|
160
|
+
/* *INDENT-OFF* */
|
161
|
+
#ifdef __cplusplus
|
162
|
+
}
|
163
|
+
#endif
|
164
|
+
/* *INDENT-ON* */
|
165
|
+
|
166
|
+
#endif /* __LXW_UTILITY_H__ */
|