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,336 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @file common.h
|
9
|
+
*
|
10
|
+
* @brief Common functions and defines for the libxlsxwriter library.
|
11
|
+
*
|
12
|
+
* <!-- Copyright 2014-2017, John McNamara, jmcnamara@cpan.org -->
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
#ifndef __LXW_COMMON_H__
|
16
|
+
#define __LXW_COMMON_H__
|
17
|
+
|
18
|
+
#include <time.h>
|
19
|
+
#include "xlsxwriter/third_party/queue.h"
|
20
|
+
#include "xlsxwriter/third_party/tree.h"
|
21
|
+
|
22
|
+
#ifndef TESTING
|
23
|
+
#define STATIC static
|
24
|
+
#else
|
25
|
+
#define STATIC
|
26
|
+
#endif
|
27
|
+
|
28
|
+
/** Integer data type to represent a row value. Equivalent to `uint32_t`.
|
29
|
+
*
|
30
|
+
* The maximum row in Excel is 1,048,576.
|
31
|
+
*/
|
32
|
+
typedef uint32_t lxw_row_t;
|
33
|
+
|
34
|
+
/** Integer data type to represent a column value. Equivalent to `uint16_t`.
|
35
|
+
*
|
36
|
+
* The maximum column in Excel is 16,384.
|
37
|
+
*/
|
38
|
+
typedef uint16_t lxw_col_t;
|
39
|
+
|
40
|
+
/** Boolean values used in libxlsxwriter. */
|
41
|
+
enum lxw_boolean {
|
42
|
+
/** False value. */
|
43
|
+
LXW_FALSE,
|
44
|
+
/** True value. */
|
45
|
+
LXW_TRUE
|
46
|
+
};
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @brief Error codes from libxlsxwriter functions.
|
50
|
+
*
|
51
|
+
* See the `lxw_strerror()` function for an example of how to convert the
|
52
|
+
* enum number to a descriptive error message string.
|
53
|
+
*/
|
54
|
+
typedef enum lxw_error {
|
55
|
+
|
56
|
+
/** No error. */
|
57
|
+
LXW_NO_ERROR = 0,
|
58
|
+
|
59
|
+
/** Memory error, failed to malloc() required memory. */
|
60
|
+
LXW_ERROR_MEMORY_MALLOC_FAILED,
|
61
|
+
|
62
|
+
/** Error creating output xlsx file. Usually a permissions error. */
|
63
|
+
LXW_ERROR_CREATING_XLSX_FILE,
|
64
|
+
|
65
|
+
/** Error encountered when creating a tmpfile during file assembly. */
|
66
|
+
LXW_ERROR_CREATING_TMPFILE,
|
67
|
+
|
68
|
+
/** Zlib error with a file operation while creating xlsx file. */
|
69
|
+
LXW_ERROR_ZIP_FILE_OPERATION,
|
70
|
+
|
71
|
+
/** Zlib error when adding sub file to xlsx file. */
|
72
|
+
LXW_ERROR_ZIP_FILE_ADD,
|
73
|
+
|
74
|
+
/** Zlib error when closing xlsx file. */
|
75
|
+
LXW_ERROR_ZIP_CLOSE,
|
76
|
+
|
77
|
+
/** NULL function parameter ignored. */
|
78
|
+
LXW_ERROR_NULL_PARAMETER_IGNORED,
|
79
|
+
|
80
|
+
/** Function parameter validation error. */
|
81
|
+
LXW_ERROR_PARAMETER_VALIDATION,
|
82
|
+
|
83
|
+
/** Worksheet name exceeds Excel's limit of 31 characters. */
|
84
|
+
LXW_ERROR_SHEETNAME_LENGTH_EXCEEDED,
|
85
|
+
|
86
|
+
/** Worksheet name contains invalid Excel character: '[]:*?/\\' */
|
87
|
+
LXW_ERROR_INVALID_SHEETNAME_CHARACTER,
|
88
|
+
|
89
|
+
/** Worksheet name is already in use. */
|
90
|
+
LXW_ERROR_SHEETNAME_ALREADY_USED,
|
91
|
+
|
92
|
+
/** Parameter exceeds Excel's limit of 128 characters. */
|
93
|
+
LXW_ERROR_128_STRING_LENGTH_EXCEEDED,
|
94
|
+
|
95
|
+
/** Parameter exceeds Excel's limit of 255 characters. */
|
96
|
+
LXW_ERROR_255_STRING_LENGTH_EXCEEDED,
|
97
|
+
|
98
|
+
/** String exceeds Excel's limit of 32,767 characters. */
|
99
|
+
LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED,
|
100
|
+
|
101
|
+
/** Error finding internal string index. */
|
102
|
+
LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND,
|
103
|
+
|
104
|
+
/** Worksheet row or column index out of range. */
|
105
|
+
LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE,
|
106
|
+
|
107
|
+
/** Maximum number of worksheet URLs (65530) exceeded. */
|
108
|
+
LXW_ERROR_WORKSHEET_MAX_NUMBER_URLS_EXCEEDED,
|
109
|
+
|
110
|
+
/** Couldn't read image dimensions or DPI. */
|
111
|
+
LXW_ERROR_IMAGE_DIMENSIONS,
|
112
|
+
|
113
|
+
LXW_MAX_ERRNO
|
114
|
+
} lxw_error;
|
115
|
+
|
116
|
+
/** @brief Struct to represent a date and time in Excel.
|
117
|
+
*
|
118
|
+
* Struct to represent a date and time in Excel. See @ref working_with_dates.
|
119
|
+
*/
|
120
|
+
typedef struct lxw_datetime {
|
121
|
+
|
122
|
+
/** Year : 1900 - 9999 */
|
123
|
+
int year;
|
124
|
+
/** Month : 1 - 12 */
|
125
|
+
int month;
|
126
|
+
/** Day : 1 - 31 */
|
127
|
+
int day;
|
128
|
+
/** Hour : 0 - 23 */
|
129
|
+
int hour;
|
130
|
+
/** Minute : 0 - 59 */
|
131
|
+
int min;
|
132
|
+
/** Seconds : 0 - 59.999 */
|
133
|
+
double sec;
|
134
|
+
|
135
|
+
} lxw_datetime;
|
136
|
+
|
137
|
+
enum lxw_custom_property_types {
|
138
|
+
LXW_CUSTOM_NONE,
|
139
|
+
LXW_CUSTOM_STRING,
|
140
|
+
LXW_CUSTOM_DOUBLE,
|
141
|
+
LXW_CUSTOM_INTEGER,
|
142
|
+
LXW_CUSTOM_BOOLEAN,
|
143
|
+
LXW_CUSTOM_DATETIME
|
144
|
+
};
|
145
|
+
|
146
|
+
/* Excel sheetname max of 31 chars. */
|
147
|
+
#define LXW_SHEETNAME_MAX 31
|
148
|
+
|
149
|
+
/* Max with all worksheet chars 4xUTF-8 bytes + start and end quotes + \0. */
|
150
|
+
#define LXW_MAX_SHEETNAME_LENGTH ((LXW_SHEETNAME_MAX * 4) + 2 + 1)
|
151
|
+
|
152
|
+
/* Max col string length. */
|
153
|
+
#define LXW_MAX_COL_NAME_LENGTH sizeof("$XFD")
|
154
|
+
|
155
|
+
/* Max row string length. */
|
156
|
+
#define LXW_MAX_ROW_NAME_LENGTH sizeof("$1048576")
|
157
|
+
|
158
|
+
/* Max cell string length. */
|
159
|
+
#define LXW_MAX_CELL_NAME_LENGTH sizeof("$XFWD$1048576")
|
160
|
+
|
161
|
+
/* Max range: $XFWD$1048576:$XFWD$1048576\0 */
|
162
|
+
#define LXW_MAX_CELL_RANGE_LENGTH (LXW_MAX_CELL_NAME_LENGTH * 2)
|
163
|
+
|
164
|
+
/* Max range formula Sheet1!$A$1:$C$5$ style. */
|
165
|
+
#define LXW_MAX_FORMULA_RANGE_LENGTH (LXW_MAX_SHEETNAME_LENGTH + LXW_MAX_CELL_RANGE_LENGTH)
|
166
|
+
|
167
|
+
/* Datetime string length. */
|
168
|
+
#define LXW_DATETIME_LENGTH sizeof("2016-12-12T23:00:00Z")
|
169
|
+
|
170
|
+
#define LXW_EPOCH_1900 0
|
171
|
+
#define LXW_EPOCH_1904 1
|
172
|
+
|
173
|
+
#define LXW_UINT32_T_LENGTH sizeof("4294967296")
|
174
|
+
#define LXW_FILENAME_LENGTH 128
|
175
|
+
#define LXW_IGNORE 1
|
176
|
+
|
177
|
+
#define LXW_SCHEMA_MS "http://schemas.microsoft.com/office/2006/relationships"
|
178
|
+
#define LXW_SCHEMA_ROOT "http://schemas.openxmlformats.org"
|
179
|
+
#define LXW_SCHEMA_DRAWING LXW_SCHEMA_ROOT "/drawingml/2006"
|
180
|
+
#define LXW_SCHEMA_OFFICEDOC LXW_SCHEMA_ROOT "/officeDocument/2006"
|
181
|
+
#define LXW_SCHEMA_PACKAGE LXW_SCHEMA_ROOT "/package/2006/relationships"
|
182
|
+
#define LXW_SCHEMA_DOCUMENT LXW_SCHEMA_ROOT "/officeDocument/2006/relationships"
|
183
|
+
#define LXW_SCHEMA_CONTENT LXW_SCHEMA_ROOT "/package/2006/content-types"
|
184
|
+
|
185
|
+
#define LXW_ERROR(message) \
|
186
|
+
fprintf(stderr, "[ERROR][%s:%d]: " message "\n", __FILE__, __LINE__)
|
187
|
+
|
188
|
+
#define LXW_MEM_ERROR() \
|
189
|
+
LXW_ERROR("Memory allocation failed.")
|
190
|
+
|
191
|
+
#define GOTO_LABEL_ON_MEM_ERROR(pointer, label) \
|
192
|
+
if (!pointer) { \
|
193
|
+
LXW_MEM_ERROR(); \
|
194
|
+
goto label; \
|
195
|
+
}
|
196
|
+
|
197
|
+
#define RETURN_ON_MEM_ERROR(pointer, error) \
|
198
|
+
if (!pointer) { \
|
199
|
+
LXW_MEM_ERROR(); \
|
200
|
+
return error; \
|
201
|
+
}
|
202
|
+
|
203
|
+
#define RETURN_VOID_ON_MEM_ERROR(pointer) \
|
204
|
+
if (!pointer) { \
|
205
|
+
LXW_MEM_ERROR(); \
|
206
|
+
return; \
|
207
|
+
}
|
208
|
+
|
209
|
+
#define RETURN_ON_ERROR(error) \
|
210
|
+
if (error) \
|
211
|
+
return error;
|
212
|
+
|
213
|
+
#define LXW_WARN(message) \
|
214
|
+
fprintf(stderr, "[WARNING]: " message "\n")
|
215
|
+
|
216
|
+
/* We can't use variadic macros here since we support ANSI C. */
|
217
|
+
#define LXW_WARN_FORMAT(message) \
|
218
|
+
fprintf(stderr, "[WARNING]: " message "\n")
|
219
|
+
|
220
|
+
#define LXW_WARN_FORMAT1(message, var) \
|
221
|
+
fprintf(stderr, "[WARNING]: " message "\n", var)
|
222
|
+
|
223
|
+
#define LXW_WARN_FORMAT2(message, var1, var2) \
|
224
|
+
fprintf(stderr, "[WARNING]: " message "\n", var1, var2)
|
225
|
+
|
226
|
+
#ifndef LXW_BIG_ENDIAN
|
227
|
+
#define LXW_UINT32_NETWORK(n) ((((n) & 0xFF) << 24) | \
|
228
|
+
(((n) & 0xFF00) << 8) | \
|
229
|
+
(((n) & 0xFF0000) >> 8) | \
|
230
|
+
(((n) & 0xFF000000) >> 24))
|
231
|
+
#define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
|
232
|
+
#else
|
233
|
+
#define LXW_UINT32_NETWORK(n) (n)
|
234
|
+
#define LXW_UINT16_NETWORK(n) (n)
|
235
|
+
#endif
|
236
|
+
|
237
|
+
/* *INDENT-OFF* */
|
238
|
+
#ifdef __cplusplus
|
239
|
+
extern "C" {
|
240
|
+
#endif
|
241
|
+
/* *INDENT-ON* */
|
242
|
+
|
243
|
+
/* Compilers that have a native snprintf() can use it directly. */
|
244
|
+
#ifdef _MSC_VER
|
245
|
+
#define LXW_HAS_SNPRINTF
|
246
|
+
#endif
|
247
|
+
|
248
|
+
#ifdef LXW_HAS_SNPRINTF
|
249
|
+
#define lxw_snprintf snprintf
|
250
|
+
#else
|
251
|
+
#define lxw_snprintf __builtin_snprintf
|
252
|
+
#endif
|
253
|
+
|
254
|
+
/* Define a snprintf for MSVC 2010. */
|
255
|
+
#if defined(_MSC_VER) && _MSC_VER < 1900
|
256
|
+
|
257
|
+
#include <stdarg.h>
|
258
|
+
#define snprintf msvc2010_snprintf
|
259
|
+
#define vsnprintf msvc2010_vsnprintf
|
260
|
+
|
261
|
+
__inline int
|
262
|
+
msvc2010_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
263
|
+
{
|
264
|
+
int count = -1;
|
265
|
+
|
266
|
+
if (size != 0)
|
267
|
+
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
|
268
|
+
if (count == -1)
|
269
|
+
count = _vscprintf(format, ap);
|
270
|
+
|
271
|
+
return count;
|
272
|
+
}
|
273
|
+
|
274
|
+
__inline int
|
275
|
+
msvc2010_snprintf(char *str, size_t size, const char *format, ...)
|
276
|
+
{
|
277
|
+
int count;
|
278
|
+
va_list ap;
|
279
|
+
|
280
|
+
va_start(ap, format);
|
281
|
+
count = msvc2010_vsnprintf(str, size, format, ap);
|
282
|
+
va_end(ap);
|
283
|
+
|
284
|
+
return count;
|
285
|
+
}
|
286
|
+
|
287
|
+
#endif
|
288
|
+
|
289
|
+
/* Safer strcpy for fixed width char arrays. */
|
290
|
+
#define lxw_strcpy(dest, src) \
|
291
|
+
lxw_snprintf(dest, sizeof(dest), "%s", src)
|
292
|
+
|
293
|
+
/* Define the queue.h structs for the formats list. */
|
294
|
+
STAILQ_HEAD(lxw_formats, lxw_format);
|
295
|
+
|
296
|
+
/* Define the queue.h structs for the generic data structs. */
|
297
|
+
STAILQ_HEAD(lxw_tuples, lxw_tuple);
|
298
|
+
STAILQ_HEAD(lxw_custom_properties, lxw_custom_property);
|
299
|
+
|
300
|
+
typedef struct lxw_tuple {
|
301
|
+
char *key;
|
302
|
+
char *value;
|
303
|
+
|
304
|
+
STAILQ_ENTRY (lxw_tuple) list_pointers;
|
305
|
+
} lxw_tuple;
|
306
|
+
|
307
|
+
/* Define custom property used in workbook.c and custom.c. */
|
308
|
+
typedef struct lxw_custom_property {
|
309
|
+
|
310
|
+
enum lxw_custom_property_types type;
|
311
|
+
char *name;
|
312
|
+
|
313
|
+
union {
|
314
|
+
char *string;
|
315
|
+
double number;
|
316
|
+
int32_t integer;
|
317
|
+
uint8_t boolean;
|
318
|
+
lxw_datetime datetime;
|
319
|
+
} u;
|
320
|
+
|
321
|
+
STAILQ_ENTRY (lxw_custom_property) list_pointers;
|
322
|
+
|
323
|
+
} lxw_custom_property;
|
324
|
+
|
325
|
+
/* Declarations required for unit testing. */
|
326
|
+
#ifdef TESTING
|
327
|
+
|
328
|
+
#endif /* TESTING */
|
329
|
+
|
330
|
+
/* *INDENT-OFF* */
|
331
|
+
#ifdef __cplusplus
|
332
|
+
}
|
333
|
+
#endif
|
334
|
+
/* *INDENT-ON* */
|
335
|
+
|
336
|
+
#endif /* __LXW_COMMON_H__ */
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* content_types - A libxlsxwriter library for creating Excel XLSX
|
7
|
+
* content_types files.
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
#ifndef __LXW_CONTENT_TYPES_H__
|
11
|
+
#define __LXW_CONTENT_TYPES_H__
|
12
|
+
|
13
|
+
#include <stdint.h>
|
14
|
+
#include <string.h>
|
15
|
+
|
16
|
+
#include "common.h"
|
17
|
+
|
18
|
+
#define LXW_APP_PACKAGE "application/vnd.openxmlformats-package."
|
19
|
+
#define LXW_APP_DOCUMENT "application/vnd.openxmlformats-officedocument."
|
20
|
+
|
21
|
+
/*
|
22
|
+
* Struct to represent a content_types.
|
23
|
+
*/
|
24
|
+
typedef struct lxw_content_types {
|
25
|
+
|
26
|
+
FILE *file;
|
27
|
+
|
28
|
+
struct lxw_tuples *default_types;
|
29
|
+
struct lxw_tuples *overrides;
|
30
|
+
|
31
|
+
} lxw_content_types;
|
32
|
+
|
33
|
+
|
34
|
+
/* *INDENT-OFF* */
|
35
|
+
#ifdef __cplusplus
|
36
|
+
extern "C" {
|
37
|
+
#endif
|
38
|
+
/* *INDENT-ON* */
|
39
|
+
|
40
|
+
lxw_content_types *lxw_content_types_new();
|
41
|
+
void lxw_content_types_free(lxw_content_types *content_types);
|
42
|
+
void lxw_content_types_assemble_xml_file(lxw_content_types *content_types);
|
43
|
+
void lxw_ct_add_default(lxw_content_types *content_types, const char *key,
|
44
|
+
const char *value);
|
45
|
+
void lxw_ct_add_override(lxw_content_types *content_types, const char *key,
|
46
|
+
const char *value);
|
47
|
+
void lxw_ct_add_worksheet_name(lxw_content_types *content_types,
|
48
|
+
const char *name);
|
49
|
+
void lxw_ct_add_chart_name(lxw_content_types *content_types,
|
50
|
+
const char *name);
|
51
|
+
void lxw_ct_add_drawing_name(lxw_content_types *content_types,
|
52
|
+
const char *name);
|
53
|
+
void lxw_ct_add_shared_strings(lxw_content_types *content_types);
|
54
|
+
void lxw_ct_add_calc_chain(lxw_content_types *content_types);
|
55
|
+
void lxw_ct_add_custom_properties(lxw_content_types *content_types);
|
56
|
+
|
57
|
+
/* Declarations required for unit testing. */
|
58
|
+
#ifdef TESTING
|
59
|
+
|
60
|
+
STATIC void _content_types_xml_declaration(lxw_content_types *self);
|
61
|
+
STATIC void _write_default(lxw_content_types *self, const char *ext,
|
62
|
+
const char *type);
|
63
|
+
STATIC void _write_override(lxw_content_types *self, const char *part_name,
|
64
|
+
const char *type);
|
65
|
+
|
66
|
+
#endif /* TESTING */
|
67
|
+
|
68
|
+
/* *INDENT-OFF* */
|
69
|
+
#ifdef __cplusplus
|
70
|
+
}
|
71
|
+
#endif
|
72
|
+
/* *INDENT-ON* */
|
73
|
+
|
74
|
+
#endif /* __LXW_CONTENT_TYPES_H__ */
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* core - A libxlsxwriter library for creating Excel XLSX core files.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
#ifndef __LXW_CORE_H__
|
10
|
+
#define __LXW_CORE_H__
|
11
|
+
|
12
|
+
#include <stdint.h>
|
13
|
+
|
14
|
+
#include "xlsxwriter/workbook.h"
|
15
|
+
#include "common.h"
|
16
|
+
|
17
|
+
/*
|
18
|
+
* Struct to represent a core.
|
19
|
+
*/
|
20
|
+
typedef struct lxw_core {
|
21
|
+
|
22
|
+
FILE *file;
|
23
|
+
lxw_doc_properties *properties;
|
24
|
+
|
25
|
+
} lxw_core;
|
26
|
+
|
27
|
+
|
28
|
+
/* *INDENT-OFF* */
|
29
|
+
#ifdef __cplusplus
|
30
|
+
extern "C" {
|
31
|
+
#endif
|
32
|
+
/* *INDENT-ON* */
|
33
|
+
|
34
|
+
lxw_core *lxw_core_new();
|
35
|
+
void lxw_core_free(lxw_core *core);
|
36
|
+
void lxw_core_assemble_xml_file(lxw_core *self);
|
37
|
+
|
38
|
+
/* Declarations required for unit testing. */
|
39
|
+
#ifdef TESTING
|
40
|
+
|
41
|
+
STATIC void _core_xml_declaration(lxw_core *self);
|
42
|
+
|
43
|
+
#endif /* TESTING */
|
44
|
+
|
45
|
+
/* *INDENT-OFF* */
|
46
|
+
#ifdef __cplusplus
|
47
|
+
}
|
48
|
+
#endif
|
49
|
+
/* *INDENT-ON* */
|
50
|
+
|
51
|
+
#endif /* __LXW_CORE_H__ */
|