fast_excel 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +4 -6
- data/.gitignore +3 -0
- data/.octocov.yml +28 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +5 -3
- data/examples/comment_options.rb +39 -0
- data/examples/example.rb +2 -0
- data/examples/example_date_time.rb +38 -0
- data/fast_excel.gemspec +4 -3
- data/lib/fast_excel/binding/format.rb +17 -0
- data/lib/fast_excel/binding/workbook.rb +80 -20
- data/lib/fast_excel/binding/worksheet.rb +81 -13
- data/lib/fast_excel/binding.rb +107 -7
- data/lib/fast_excel.rb +40 -32
- data/libxlsxwriter/.github/FUNDING.yml +1 -0
- data/libxlsxwriter/.github/ISSUE_TEMPLATE.md +85 -0
- data/libxlsxwriter/.github/PULL_REQUEST_TEMPLATE.md +130 -0
- data/libxlsxwriter/.github/workflows/cmake_actions.yml +48 -0
- data/libxlsxwriter/.github/workflows/code_style.yml +23 -0
- data/libxlsxwriter/.github/workflows/coverity.yml +22 -0
- data/libxlsxwriter/.github/workflows/make_actions.yml +52 -0
- data/libxlsxwriter/.github/workflows/valgrind.yml +23 -0
- data/libxlsxwriter/.github/workflows/windows_build.yml +54 -0
- data/libxlsxwriter/.github/workflows/zig_build.yml +22 -0
- data/libxlsxwriter/.gitignore +16 -1
- data/libxlsxwriter/.indent.pro +24 -0
- data/libxlsxwriter/CMakeLists.txt +156 -56
- data/libxlsxwriter/CONTRIBUTING.md +2 -2
- data/libxlsxwriter/Changes.txt +344 -2
- data/libxlsxwriter/LICENSE.txt +66 -8
- data/libxlsxwriter/Makefile +151 -54
- data/libxlsxwriter/Package.swift +42 -0
- data/libxlsxwriter/Readme.md +4 -2
- data/libxlsxwriter/build.zig +324 -0
- data/libxlsxwriter/build.zig.zon +11 -0
- data/libxlsxwriter/cmake/FindMINIZIP.cmake +3 -3
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +6 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/chart.h +236 -32
- data/libxlsxwriter/include/xlsxwriter/chartsheet.h +7 -7
- data/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +111 -50
- data/libxlsxwriter/include/xlsxwriter/content_types.h +8 -1
- data/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/drawing.h +11 -20
- data/libxlsxwriter/include/xlsxwriter/format.h +121 -8
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/metadata.h +49 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +27 -16
- data/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/styles.h +13 -7
- data/libxlsxwriter/include/xlsxwriter/table.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h +26 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +27 -25
- data/libxlsxwriter/include/xlsxwriter/third_party/md5.h +45 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +155 -153
- data/libxlsxwriter/include/xlsxwriter/utility.h +70 -8
- data/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +218 -47
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2770 -241
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +12 -8
- data/libxlsxwriter/include/xlsxwriter.h +4 -2
- data/libxlsxwriter/libxlsxwriter.podspec +8 -5
- data/libxlsxwriter/src/Makefile +58 -21
- data/libxlsxwriter/src/app.c +5 -2
- data/libxlsxwriter/src/chart.c +396 -81
- data/libxlsxwriter/src/chartsheet.c +22 -22
- data/libxlsxwriter/src/comment.c +443 -0
- data/libxlsxwriter/src/content_types.c +40 -1
- data/libxlsxwriter/src/core.c +2 -2
- data/libxlsxwriter/src/custom.c +1 -1
- data/libxlsxwriter/src/drawing.c +160 -40
- data/libxlsxwriter/src/format.c +109 -25
- data/libxlsxwriter/src/hash_table.c +1 -1
- data/libxlsxwriter/src/metadata.c +283 -0
- data/libxlsxwriter/src/packager.c +794 -94
- data/libxlsxwriter/src/relationships.c +1 -1
- data/libxlsxwriter/src/shared_strings.c +2 -4
- data/libxlsxwriter/src/styles.c +353 -58
- data/libxlsxwriter/src/table.c +304 -0
- data/libxlsxwriter/src/theme.c +1 -1
- data/libxlsxwriter/src/utility.c +143 -43
- data/libxlsxwriter/src/vml.c +1062 -0
- data/libxlsxwriter/src/workbook.c +567 -77
- data/libxlsxwriter/src/worksheet.c +6668 -1462
- data/libxlsxwriter/src/xmlwriter.c +95 -5
- data/libxlsxwriter/third_party/dtoa/Makefile +42 -0
- data/libxlsxwriter/third_party/dtoa/emyg_dtoa.c +461 -0
- data/libxlsxwriter/third_party/dtoa/emyg_dtoa.h +26 -0
- data/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/libxlsxwriter/third_party/md5/md5.h +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile +3 -8
- data/libxlsxwriter/third_party/minizip/Makefile.orig +8 -4
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +1 -1
- data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
- data/libxlsxwriter/third_party/minizip/crypt.h +13 -16
- data/libxlsxwriter/third_party/minizip/ioapi.c +31 -57
- data/libxlsxwriter/third_party/minizip/ioapi.h +31 -23
- data/libxlsxwriter/third_party/minizip/iowin32.c +29 -45
- data/libxlsxwriter/third_party/minizip/iowin32.h +4 -4
- data/libxlsxwriter/third_party/minizip/miniunz.c +29 -56
- data/libxlsxwriter/third_party/minizip/minizip.c +38 -49
- data/libxlsxwriter/third_party/minizip/mztools.c +1 -7
- data/libxlsxwriter/third_party/minizip/unzip.c +202 -342
- data/libxlsxwriter/third_party/minizip/unzip.h +74 -74
- data/libxlsxwriter/third_party/minizip/zip.c +165 -218
- data/libxlsxwriter/third_party/minizip/zip.h +164 -154
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +3 -3
- data/libxlsxwriter/version.txt +1 -1
- data/sonar-project.properties +4 -0
- data/test/auto_width_test.rb +20 -0
- data/test/color_to_hex_test.rb +15 -0
- data/test/comment_opt_test.rb +76 -0
- data/test/date_test.rb +14 -0
- data/test/default_format_test.rb +1 -1
- data/test/format_test.rb +5 -1
- data/test/get_worksheet_test.rb +28 -0
- data/test/test_helper.rb +7 -4
- data/test/tmpdir_test.rb +32 -0
- data/test/validations_test.rb +25 -19
- data/test/worksheet_test.rb +6 -1
- metadata +62 -13
- data/libxlsxwriter/.travis.yml +0 -37
- data/test/reopen_test.rb +0 -22
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
/* Pragma added by libxlsxwriter
|
|
40
|
+
/* Pragma added by libxlsxwriter to avoid warnings with -pedantic -ansi. */
|
|
41
41
|
#ifndef _WIN32
|
|
42
42
|
#pragma GCC system_header
|
|
43
43
|
#endif
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
extern "C" {
|
|
50
50
|
#endif
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
//#define HAVE_BZIP2
|
|
53
53
|
|
|
54
54
|
#ifndef _ZLIB_H
|
|
55
55
|
#include "zlib.h"
|
|
@@ -59,6 +59,14 @@ extern "C" {
|
|
|
59
59
|
#include "ioapi.h"
|
|
60
60
|
#endif
|
|
61
61
|
|
|
62
|
+
/* Encryption not required by libxlsxwriter. */
|
|
63
|
+
#ifndef NOCRYPT
|
|
64
|
+
#define NOCRYPT
|
|
65
|
+
#endif
|
|
66
|
+
#ifndef NOUNCRYPT
|
|
67
|
+
#define NOUNCRYPT
|
|
68
|
+
#endif
|
|
69
|
+
|
|
62
70
|
#ifdef HAVE_BZIP2
|
|
63
71
|
#include "bzlib.h"
|
|
64
72
|
#endif
|
|
@@ -93,12 +101,12 @@ typedef voidp zipFile;
|
|
|
93
101
|
/* tm_zip contain date/time info */
|
|
94
102
|
typedef struct tm_zip_s
|
|
95
103
|
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
int tm_sec; /* seconds after the minute - [0,59] */
|
|
105
|
+
int tm_min; /* minutes after the hour - [0,59] */
|
|
106
|
+
int tm_hour; /* hours since midnight - [0,23] */
|
|
107
|
+
int tm_mday; /* day of the month - [1,31] */
|
|
108
|
+
int tm_mon; /* months since January - [0,11] */
|
|
109
|
+
int tm_year; /* years - [1980..2044] */
|
|
102
110
|
} tm_zip;
|
|
103
111
|
|
|
104
112
|
typedef struct
|
|
@@ -118,8 +126,8 @@ typedef const char* zipcharpc;
|
|
|
118
126
|
#define APPEND_STATUS_CREATEAFTER (1)
|
|
119
127
|
#define APPEND_STATUS_ADDINZIP (2)
|
|
120
128
|
|
|
121
|
-
extern zipFile ZEXPORT zipOpen
|
|
122
|
-
extern zipFile ZEXPORT zipOpen64
|
|
129
|
+
extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
|
|
130
|
+
extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
|
|
123
131
|
/*
|
|
124
132
|
Create a zipfile.
|
|
125
133
|
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
|
@@ -136,41 +144,46 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
|
|
136
144
|
|
|
137
145
|
/* Note : there is no delete function into a zipfile.
|
|
138
146
|
If you want delete file into a zipfile, you must open a zipfile, and create another
|
|
139
|
-
Of
|
|
147
|
+
Of course, you can use RAW reading and writing to copy the file you did not want delete
|
|
140
148
|
*/
|
|
141
149
|
|
|
142
|
-
extern zipFile ZEXPORT zipOpen2
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
extern zipFile ZEXPORT zipOpen2(const char *pathname,
|
|
151
|
+
int append,
|
|
152
|
+
zipcharpc* globalcomment,
|
|
153
|
+
zlib_filefunc_def* pzlib_filefunc_def);
|
|
146
154
|
|
|
147
|
-
extern zipFile ZEXPORT zipOpen2_64
|
|
155
|
+
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
|
|
148
156
|
int append,
|
|
149
157
|
zipcharpc* globalcomment,
|
|
150
|
-
zlib_filefunc64_def* pzlib_filefunc_def)
|
|
151
|
-
|
|
152
|
-
extern
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
158
|
+
zlib_filefunc64_def* pzlib_filefunc_def);
|
|
159
|
+
|
|
160
|
+
extern zipFile ZEXPORT zipOpen3(const void *pathname,
|
|
161
|
+
int append,
|
|
162
|
+
zipcharpc* globalcomment,
|
|
163
|
+
zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
|
|
164
|
+
|
|
165
|
+
extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
|
|
166
|
+
const char* filename,
|
|
167
|
+
const zip_fileinfo* zipfi,
|
|
168
|
+
const void* extrafield_local,
|
|
169
|
+
uInt size_extrafield_local,
|
|
170
|
+
const void* extrafield_global,
|
|
171
|
+
uInt size_extrafield_global,
|
|
172
|
+
const char* comment,
|
|
173
|
+
int method,
|
|
174
|
+
int level);
|
|
175
|
+
|
|
176
|
+
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
|
|
177
|
+
const char* filename,
|
|
178
|
+
const zip_fileinfo* zipfi,
|
|
179
|
+
const void* extrafield_local,
|
|
180
|
+
uInt size_extrafield_local,
|
|
181
|
+
const void* extrafield_global,
|
|
182
|
+
uInt size_extrafield_global,
|
|
183
|
+
const char* comment,
|
|
184
|
+
int method,
|
|
185
|
+
int level,
|
|
186
|
+
int zip64);
|
|
174
187
|
|
|
175
188
|
/*
|
|
176
189
|
Open a file in the ZIP for writing.
|
|
@@ -189,70 +202,69 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
|
|
189
202
|
*/
|
|
190
203
|
|
|
191
204
|
|
|
192
|
-
extern int ZEXPORT zipOpenNewFileInZip2
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
extern int ZEXPORT zipOpenNewFileInZip2_64
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
|
|
206
|
+
const char* filename,
|
|
207
|
+
const zip_fileinfo* zipfi,
|
|
208
|
+
const void* extrafield_local,
|
|
209
|
+
uInt size_extrafield_local,
|
|
210
|
+
const void* extrafield_global,
|
|
211
|
+
uInt size_extrafield_global,
|
|
212
|
+
const char* comment,
|
|
213
|
+
int method,
|
|
214
|
+
int level,
|
|
215
|
+
int raw);
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
|
|
219
|
+
const char* filename,
|
|
220
|
+
const zip_fileinfo* zipfi,
|
|
221
|
+
const void* extrafield_local,
|
|
222
|
+
uInt size_extrafield_local,
|
|
223
|
+
const void* extrafield_global,
|
|
224
|
+
uInt size_extrafield_global,
|
|
225
|
+
const char* comment,
|
|
226
|
+
int method,
|
|
227
|
+
int level,
|
|
228
|
+
int raw,
|
|
229
|
+
int zip64);
|
|
217
230
|
/*
|
|
218
231
|
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
|
219
232
|
*/
|
|
220
233
|
|
|
221
|
-
extern int ZEXPORT zipOpenNewFileInZip3
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
extern int ZEXPORT zipOpenNewFileInZip3_64
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
));
|
|
234
|
+
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
|
|
235
|
+
const char* filename,
|
|
236
|
+
const zip_fileinfo* zipfi,
|
|
237
|
+
const void* extrafield_local,
|
|
238
|
+
uInt size_extrafield_local,
|
|
239
|
+
const void* extrafield_global,
|
|
240
|
+
uInt size_extrafield_global,
|
|
241
|
+
const char* comment,
|
|
242
|
+
int method,
|
|
243
|
+
int level,
|
|
244
|
+
int raw,
|
|
245
|
+
int windowBits,
|
|
246
|
+
int memLevel,
|
|
247
|
+
int strategy,
|
|
248
|
+
const char* password,
|
|
249
|
+
uLong crcForCrypting);
|
|
250
|
+
|
|
251
|
+
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
|
|
252
|
+
const char* filename,
|
|
253
|
+
const zip_fileinfo* zipfi,
|
|
254
|
+
const void* extrafield_local,
|
|
255
|
+
uInt size_extrafield_local,
|
|
256
|
+
const void* extrafield_global,
|
|
257
|
+
uInt size_extrafield_global,
|
|
258
|
+
const char* comment,
|
|
259
|
+
int method,
|
|
260
|
+
int level,
|
|
261
|
+
int raw,
|
|
262
|
+
int windowBits,
|
|
263
|
+
int memLevel,
|
|
264
|
+
int strategy,
|
|
265
|
+
const char* password,
|
|
266
|
+
uLong crcForCrypting,
|
|
267
|
+
int zip64);
|
|
256
268
|
|
|
257
269
|
/*
|
|
258
270
|
Same than zipOpenNewFileInZip2, except
|
|
@@ -261,47 +273,45 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
|
|
261
273
|
crcForCrypting : crc of file to compress (needed for crypting)
|
|
262
274
|
*/
|
|
263
275
|
|
|
264
|
-
extern int ZEXPORT zipOpenNewFileInZip4
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
int zip64
|
|
304
|
-
));
|
|
276
|
+
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
|
|
277
|
+
const char* filename,
|
|
278
|
+
const zip_fileinfo* zipfi,
|
|
279
|
+
const void* extrafield_local,
|
|
280
|
+
uInt size_extrafield_local,
|
|
281
|
+
const void* extrafield_global,
|
|
282
|
+
uInt size_extrafield_global,
|
|
283
|
+
const char* comment,
|
|
284
|
+
int method,
|
|
285
|
+
int level,
|
|
286
|
+
int raw,
|
|
287
|
+
int windowBits,
|
|
288
|
+
int memLevel,
|
|
289
|
+
int strategy,
|
|
290
|
+
const char* password,
|
|
291
|
+
uLong crcForCrypting,
|
|
292
|
+
uLong versionMadeBy,
|
|
293
|
+
uLong flagBase);
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
|
|
297
|
+
const char* filename,
|
|
298
|
+
const zip_fileinfo* zipfi,
|
|
299
|
+
const void* extrafield_local,
|
|
300
|
+
uInt size_extrafield_local,
|
|
301
|
+
const void* extrafield_global,
|
|
302
|
+
uInt size_extrafield_global,
|
|
303
|
+
const char* comment,
|
|
304
|
+
int method,
|
|
305
|
+
int level,
|
|
306
|
+
int raw,
|
|
307
|
+
int windowBits,
|
|
308
|
+
int memLevel,
|
|
309
|
+
int strategy,
|
|
310
|
+
const char* password,
|
|
311
|
+
uLong crcForCrypting,
|
|
312
|
+
uLong versionMadeBy,
|
|
313
|
+
uLong flagBase,
|
|
314
|
+
int zip64);
|
|
305
315
|
/*
|
|
306
316
|
Same than zipOpenNewFileInZip4, except
|
|
307
317
|
versionMadeBy : value for Version made by field
|
|
@@ -309,25 +319,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
|
|
309
319
|
*/
|
|
310
320
|
|
|
311
321
|
|
|
312
|
-
extern int ZEXPORT zipWriteInFileInZip
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
extern int ZEXPORT zipWriteInFileInZip(zipFile file,
|
|
323
|
+
const void* buf,
|
|
324
|
+
unsigned len);
|
|
315
325
|
/*
|
|
316
326
|
Write data in the zipfile
|
|
317
327
|
*/
|
|
318
328
|
|
|
319
|
-
extern int ZEXPORT zipCloseFileInZip
|
|
329
|
+
extern int ZEXPORT zipCloseFileInZip(zipFile file);
|
|
320
330
|
/*
|
|
321
331
|
Close the current file in the zipfile
|
|
322
332
|
*/
|
|
323
333
|
|
|
324
|
-
extern int ZEXPORT zipCloseFileInZipRaw
|
|
325
|
-
|
|
326
|
-
|
|
334
|
+
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
|
|
335
|
+
uLong uncompressed_size,
|
|
336
|
+
uLong crc32);
|
|
327
337
|
|
|
328
|
-
extern int ZEXPORT zipCloseFileInZipRaw64
|
|
329
|
-
|
|
330
|
-
|
|
338
|
+
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
|
|
339
|
+
ZPOS64_T uncompressed_size,
|
|
340
|
+
uLong crc32);
|
|
331
341
|
|
|
332
342
|
/*
|
|
333
343
|
Close the current file in the zipfile, for file opened with
|
|
@@ -335,14 +345,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
|
|
335
345
|
uncompressed_size and crc32 are value for the uncompressed size
|
|
336
346
|
*/
|
|
337
347
|
|
|
338
|
-
extern int ZEXPORT zipClose
|
|
339
|
-
|
|
348
|
+
extern int ZEXPORT zipClose(zipFile file,
|
|
349
|
+
const char* global_comment);
|
|
340
350
|
/*
|
|
341
351
|
Close the zipfile
|
|
342
352
|
*/
|
|
343
353
|
|
|
344
354
|
|
|
345
|
-
extern int ZEXPORT zipRemoveExtraInfoBlock
|
|
355
|
+
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
|
|
346
356
|
/*
|
|
347
357
|
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
|
348
358
|
|
|
@@ -33,10 +33,10 @@ endif
|
|
|
33
33
|
all: tmpfileplus.o tmpfileplus.so
|
|
34
34
|
|
|
35
35
|
%.o : %.c
|
|
36
|
-
$(Q)$(CC) -c $(CFLAGS) $<
|
|
36
|
+
$(Q)$(CC) -c $(CFLAGS) $(TARGET_ARCH) $<
|
|
37
37
|
|
|
38
38
|
%.so : %.c
|
|
39
|
-
$(Q)$(CC) $(FPIC) -c $(CFLAGS) $< -o $@
|
|
39
|
+
$(Q)$(CC) $(FPIC) -c $(CFLAGS) $(TARGET_ARCH) $< -o $@
|
|
40
40
|
|
|
41
41
|
clean:
|
|
42
|
-
$(Q)
|
|
42
|
+
$(Q)rm -f *.o *.so
|
data/libxlsxwriter/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2023-12-29 19:18:35 +0700 e3ede9d
|
data/test/auto_width_test.rb
CHANGED
|
@@ -16,4 +16,24 @@ describe "FastExcel text_width" do
|
|
|
16
16
|
|
|
17
17
|
assert_equal(sheet.calculated_column_widths, {0 => 3.52, 1 => 5.28, 2 => 14.96, 3 => 44.88})
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
it "should set the default column width for an empty column on close" do
|
|
21
|
+
workbook = FastExcel.open(constant_memory: false)
|
|
22
|
+
sheet = workbook.add_worksheet
|
|
23
|
+
sheet.auto_width = true
|
|
24
|
+
|
|
25
|
+
sheet.append_row([
|
|
26
|
+
nil,
|
|
27
|
+
"tini",
|
|
28
|
+
"Longer",
|
|
29
|
+
"Some longer text!",
|
|
30
|
+
"This gem is FFI binding for libxlsxwriter C library"
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
assert_equal(sheet.calculated_column_widths, {0 => nil, 1 => 3.52, 2 => 5.28, 3 => 14.96, 4 => 44.88})
|
|
34
|
+
|
|
35
|
+
workbook.close
|
|
36
|
+
|
|
37
|
+
assert_equal(sheet.calculated_column_widths, {0 => FastExcel::DEF_COL_WIDTH, 1 => 3.52, 2 => 5.28, 3 => 14.96, 4 => 44.88})
|
|
38
|
+
end
|
|
19
39
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require_relative 'test_helper'
|
|
2
|
+
|
|
3
|
+
describe "FastExcel.color_to_hex" do
|
|
4
|
+
it "should convert hex number color to hex" do
|
|
5
|
+
assert_equal(FastExcel.color_to_hex(0xFF0000), 0xFF0000)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should convert color name to hex" do
|
|
9
|
+
assert_equal(FastExcel.color_to_hex("color_lime"), 0x00FF00)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should convert color name (extra colors) to hex" do
|
|
13
|
+
assert_equal(FastExcel.color_to_hex("steel_blue"), 0x4682B4)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require_relative 'test_helper'
|
|
2
|
+
|
|
3
|
+
describe 'FastExcel::Worksheet write_comment_opt' do
|
|
4
|
+
let(:workbook) { FastExcel.open(constant_memory: true) }
|
|
5
|
+
let(:worksheet) { workbook.add_worksheet }
|
|
6
|
+
let(:options) do
|
|
7
|
+
Libxlsxwriter::CommentOptions.new.tap do |opts|
|
|
8
|
+
opts.author = 'Lolo'
|
|
9
|
+
opts.visible = 1
|
|
10
|
+
opts.width = 200
|
|
11
|
+
opts.height = 100
|
|
12
|
+
opts.x_scale = 1.5
|
|
13
|
+
opts.y_scale = 1.5
|
|
14
|
+
opts.color = '0xFFFF00'
|
|
15
|
+
opts.font_name = 'Arial'
|
|
16
|
+
opts.font_size = 12.0
|
|
17
|
+
opts.font_family = 2
|
|
18
|
+
opts.start_row = 0
|
|
19
|
+
opts.start_col = 1
|
|
20
|
+
opts.x_offset = 10
|
|
21
|
+
opts.y_offset = 10
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should write a comment with options struct' do
|
|
26
|
+
assert_equal(:no_error, worksheet.write_comment_opt(0, 0, 'Hello with options', options))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should write a comment with hash options' do
|
|
30
|
+
assert_equal(:no_error, worksheet.write_comment_opt(1, 0, 'Comment via hash', author: 'Author1', visible: 1, color: '#FF0000'))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should write a comment using write_comment with optional options' do
|
|
34
|
+
assert_equal(:no_error, worksheet.write_comment(2, 0, 'Simple comment'))
|
|
35
|
+
assert_equal(:no_error, worksheet.write_comment(3, 0, 'Comment with hash', author: 'Alice', color: 'lime'))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'handles nil author and font_name safely' do
|
|
39
|
+
opts = Libxlsxwriter::CommentOptions.new
|
|
40
|
+
opts.author = nil
|
|
41
|
+
opts.font_name = nil
|
|
42
|
+
assert_nil opts.author
|
|
43
|
+
assert_nil opts.font_name
|
|
44
|
+
|
|
45
|
+
opts.author = 'Bob'
|
|
46
|
+
assert_equal 'Bob', opts.author
|
|
47
|
+
opts.author = nil
|
|
48
|
+
assert_nil opts.author
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'preserves string pointers across garbage collection' do
|
|
52
|
+
opts = Libxlsxwriter::CommentOptions.new(author: "Temporary #{rand} Author", font_name: 'Courier New')
|
|
53
|
+
# Run full GC cycles to ensure MemoryPointer is not collected prematurely
|
|
54
|
+
10.times { GC.start }
|
|
55
|
+
|
|
56
|
+
assert opts.author.start_with?('Temporary')
|
|
57
|
+
assert_equal 'Courier New', opts.font_name
|
|
58
|
+
assert_equal :no_error, worksheet.write_comment_opt(4, 0, 'GC test comment', opts)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'generates a valid excel file with styled comments' do
|
|
62
|
+
temp_file = File.join(Dir.tmpdir, "test_comments_#{Time.now.to_i}.xlsx")
|
|
63
|
+
begin
|
|
64
|
+
wb = FastExcel.open(temp_file)
|
|
65
|
+
ws = wb.add_worksheet
|
|
66
|
+
ws.write_value(0, 0, 'Data')
|
|
67
|
+
ws.write_comment(0, 0, 'Styled comment', author: 'Tester', visible: 1, color: 'yellow', font_name: 'Arial')
|
|
68
|
+
wb.close
|
|
69
|
+
|
|
70
|
+
assert File.exist?(temp_file)
|
|
71
|
+
assert File.size(temp_file) > 0
|
|
72
|
+
ensure
|
|
73
|
+
File.delete(temp_file) if File.exist?(temp_file)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/test/date_test.rb
CHANGED
|
@@ -54,3 +54,17 @@ describe "FastExcel.write_value" do
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
end
|
|
57
|
+
|
|
58
|
+
describe "FastExcel.lxw_time" do
|
|
59
|
+
it "should make Libxlsxwriter::Datetime" do
|
|
60
|
+
time = Time.at(610421163).utc
|
|
61
|
+
lxw_time = FastExcel.lxw_time(time)
|
|
62
|
+
|
|
63
|
+
assert_equal(lxw_time[:year], 1989)
|
|
64
|
+
assert_equal(lxw_time[:month], 5)
|
|
65
|
+
assert_equal(lxw_time[:day], 6)
|
|
66
|
+
assert_equal(lxw_time[:hour], 1)
|
|
67
|
+
assert_equal(lxw_time[:min], 26)
|
|
68
|
+
assert_equal(lxw_time[:sec], 3.0)
|
|
69
|
+
end
|
|
70
|
+
end
|
data/test/default_format_test.rb
CHANGED
|
@@ -9,7 +9,7 @@ describe "FastExcel default_format" do
|
|
|
9
9
|
bold: true
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
#FastExcel.print_ffi_obj(workbook.default_format)
|
|
12
|
+
# FastExcel.print_ffi_obj(workbook.default_format)
|
|
13
13
|
|
|
14
14
|
assert_equal("ArialFoo", workbook.default_format.font_family)
|
|
15
15
|
assert_equal(17, workbook.default_format.font_size)
|
data/test/format_test.rb
CHANGED
|
@@ -112,7 +112,11 @@ describe "FastExcel::FormatExt colors" do
|
|
|
112
112
|
@format.font_color = {aaa: 1}
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
if error.message =~ /=>/
|
|
116
|
+
assert_equal(error.message, "Can not use Hash ({:aaa=>1}) for color value, expected String or Hex Number")
|
|
117
|
+
else
|
|
118
|
+
assert_equal(error.message, "Can not use Hash ({aaa: 1}) for color value, expected String or Hex Number")
|
|
119
|
+
end
|
|
116
120
|
end
|
|
117
121
|
|
|
118
122
|
it "should raise for unexpected color" do
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_relative 'test_helper'
|
|
2
|
+
|
|
3
|
+
describe "FastExcel::Worksheet" do
|
|
4
|
+
before do
|
|
5
|
+
@workbook = FastExcel.open(constant_memory: true)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe "#get_worksheet_by_name" do
|
|
9
|
+
it "should return nil if worksheet does not exist" do
|
|
10
|
+
ws = @workbook.get_worksheet_by_name("Page1")
|
|
11
|
+
assert_nil(ws)
|
|
12
|
+
|
|
13
|
+
assert_nil(@workbook.get_worksheet_by_name(nil))
|
|
14
|
+
assert_nil(@workbook.get_worksheet_by_name(:Page1))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should return worksheet if worksheet does exist" do
|
|
18
|
+
@workbook.add_worksheet("Page1")
|
|
19
|
+
|
|
20
|
+
ws = @workbook.get_worksheet_by_name("Page1")
|
|
21
|
+
ws.write_row(0, ['1'])
|
|
22
|
+
assert_kind_of(Libxlsxwriter::Worksheet, ws)
|
|
23
|
+
|
|
24
|
+
ws_by_sym = @workbook.get_worksheet_by_name(:Page1)
|
|
25
|
+
assert_kind_of(Libxlsxwriter::Worksheet, ws_by_sym)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/test/test_helper.rb
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
require "simplecov"
|
|
2
|
+
|
|
3
|
+
SimpleCov.start do
|
|
4
|
+
add_filter 'test'
|
|
5
|
+
end
|
|
6
|
+
|
|
1
7
|
require 'bundler/setup'
|
|
2
8
|
require 'minitest/autorun'
|
|
3
9
|
require "minitest/reporters"
|
|
4
10
|
require 'pp'
|
|
5
|
-
|
|
6
|
-
##Encoding.default_external = Encoding::UTF_8
|
|
7
|
-
##Encoding.default_internal = Encoding::UTF_8
|
|
8
|
-
|
|
9
11
|
require 'date'
|
|
10
12
|
|
|
13
|
+
|
|
11
14
|
Minitest::Reporters.use!(
|
|
12
15
|
Minitest::Reporters::DefaultReporter.new(color: true)
|
|
13
16
|
)
|