kmadej_fast_excel_fork 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +28 -0
  4. data/CHANGELOG.md +13 -0
  5. data/Gemfile +17 -0
  6. data/Gemfile.lock +70 -0
  7. data/Makefile +14 -0
  8. data/README.md +95 -0
  9. data/Rakefile +24 -0
  10. data/appveyor.yml +25 -0
  11. data/benchmarks/1k_rows.rb +59 -0
  12. data/benchmarks/20k_rows.rb +26 -0
  13. data/benchmarks/init.rb +59 -0
  14. data/benchmarks/memory.rb +49 -0
  15. data/examples/example.rb +42 -0
  16. data/examples/example_align.rb +23 -0
  17. data/examples/example_chart.rb +21 -0
  18. data/examples/example_colors.rb +37 -0
  19. data/examples/example_formula.rb +18 -0
  20. data/examples/example_image.rb +13 -0
  21. data/examples/example_styles.rb +27 -0
  22. data/examples/logo.png +0 -0
  23. data/extconf.rb +0 -0
  24. data/fast_excel.gemspec +20 -0
  25. data/lib/fast_excel.rb +600 -0
  26. data/lib/fast_excel/binding.rb +2819 -0
  27. data/lib/fast_excel/binding/chart.rb +2666 -0
  28. data/lib/fast_excel/binding/format.rb +1177 -0
  29. data/lib/fast_excel/binding/workbook.rb +338 -0
  30. data/lib/fast_excel/binding/worksheet.rb +1555 -0
  31. data/libxlsxwriter/.gitignore +49 -0
  32. data/libxlsxwriter/.indent.pro +125 -0
  33. data/libxlsxwriter/.travis.yml +25 -0
  34. data/libxlsxwriter/CONTRIBUTING.md +226 -0
  35. data/libxlsxwriter/Changes.txt +557 -0
  36. data/libxlsxwriter/LICENSE.txt +89 -0
  37. data/libxlsxwriter/Makefile +156 -0
  38. data/libxlsxwriter/Readme.md +78 -0
  39. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
  40. data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
  41. data/libxlsxwriter/include/xlsxwriter.h +23 -0
  42. data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
  43. data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
  44. data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
  45. data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
  46. data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
  47. data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
  48. data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
  49. data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
  50. data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
  51. data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
  52. data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
  53. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
  54. data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
  55. data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
  56. data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
  57. data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
  58. data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
  59. data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
  60. data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
  61. data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
  62. data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
  63. data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
  64. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
  65. data/libxlsxwriter/lib/.gitignore +0 -0
  66. data/libxlsxwriter/libxlsxwriter.podspec +47 -0
  67. data/libxlsxwriter/src/Makefile +130 -0
  68. data/libxlsxwriter/src/app.c +443 -0
  69. data/libxlsxwriter/src/chart.c +6346 -0
  70. data/libxlsxwriter/src/content_types.c +345 -0
  71. data/libxlsxwriter/src/core.c +293 -0
  72. data/libxlsxwriter/src/custom.c +224 -0
  73. data/libxlsxwriter/src/drawing.c +746 -0
  74. data/libxlsxwriter/src/format.c +729 -0
  75. data/libxlsxwriter/src/hash_table.c +223 -0
  76. data/libxlsxwriter/src/packager.c +948 -0
  77. data/libxlsxwriter/src/relationships.c +245 -0
  78. data/libxlsxwriter/src/shared_strings.c +266 -0
  79. data/libxlsxwriter/src/styles.c +1088 -0
  80. data/libxlsxwriter/src/theme.c +348 -0
  81. data/libxlsxwriter/src/utility.c +515 -0
  82. data/libxlsxwriter/src/workbook.c +1930 -0
  83. data/libxlsxwriter/src/worksheet.c +5022 -0
  84. data/libxlsxwriter/src/xmlwriter.c +355 -0
  85. data/libxlsxwriter/third_party/minizip/Makefile +44 -0
  86. data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
  87. data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
  88. data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
  89. data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
  90. data/libxlsxwriter/third_party/minizip/README.txt +5 -0
  91. data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
  92. data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
  93. data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
  94. data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
  95. data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
  96. data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
  97. data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
  98. data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
  99. data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
  100. data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
  101. data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
  102. data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
  103. data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
  104. data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
  105. data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
  106. data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
  107. data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
  108. data/libxlsxwriter/third_party/minizip/zip.h +367 -0
  109. data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
  110. data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
  111. data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
  112. data/libxlsxwriter/version.txt +1 -0
  113. data/test/date_test.rb +22 -0
  114. data/test/default_format_test.rb +19 -0
  115. data/test/format_test.rb +171 -0
  116. data/test/test_helper.rb +52 -0
  117. data/test/tmpfile_test.rb +23 -0
  118. data/test/worksheet_test.rb +86 -0
  119. metadata +182 -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__ */