fast_excel 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -2
  3. data/Makefile +14 -0
  4. data/README.md +7 -2
  5. data/Rakefile +10 -0
  6. data/extconf.rb +0 -0
  7. data/fast_excel.gemspec +3 -1
  8. data/lib/fast_excel/binding.rb +3 -7
  9. data/lib/rubygems_plugin.rb +3 -0
  10. data/libxlsxwriter/.gitignore +49 -0
  11. data/libxlsxwriter/.indent.pro +125 -0
  12. data/libxlsxwriter/.travis.yml +25 -0
  13. data/libxlsxwriter/CONTRIBUTING.md +226 -0
  14. data/libxlsxwriter/Changes.txt +557 -0
  15. data/libxlsxwriter/LICENSE.txt +89 -0
  16. data/libxlsxwriter/Makefile +156 -0
  17. data/libxlsxwriter/Readme.md +78 -0
  18. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
  19. data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
  20. data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
  21. data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
  22. data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
  23. data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
  24. data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
  25. data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
  26. data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
  27. data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
  28. data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
  29. data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
  30. data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
  31. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
  32. data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
  33. data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
  34. data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
  35. data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
  36. data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
  37. data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
  38. data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
  39. data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
  40. data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
  41. data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
  42. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
  43. data/libxlsxwriter/include/xlsxwriter.h +23 -0
  44. data/libxlsxwriter/lib/.gitignore +0 -0
  45. data/libxlsxwriter/libxlsxwriter.podspec +47 -0
  46. data/libxlsxwriter/src/Makefile +130 -0
  47. data/libxlsxwriter/src/app.c +443 -0
  48. data/libxlsxwriter/src/chart.c +6346 -0
  49. data/libxlsxwriter/src/content_types.c +345 -0
  50. data/libxlsxwriter/src/core.c +293 -0
  51. data/libxlsxwriter/src/custom.c +224 -0
  52. data/libxlsxwriter/src/drawing.c +746 -0
  53. data/libxlsxwriter/src/format.c +729 -0
  54. data/libxlsxwriter/src/hash_table.c +223 -0
  55. data/libxlsxwriter/src/packager.c +948 -0
  56. data/libxlsxwriter/src/relationships.c +245 -0
  57. data/libxlsxwriter/src/shared_strings.c +266 -0
  58. data/libxlsxwriter/src/styles.c +1088 -0
  59. data/libxlsxwriter/src/theme.c +348 -0
  60. data/libxlsxwriter/src/utility.c +515 -0
  61. data/libxlsxwriter/src/workbook.c +1930 -0
  62. data/libxlsxwriter/src/worksheet.c +5022 -0
  63. data/libxlsxwriter/src/xmlwriter.c +355 -0
  64. data/libxlsxwriter/third_party/minizip/Makefile +44 -0
  65. data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
  66. data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
  67. data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
  68. data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
  69. data/libxlsxwriter/third_party/minizip/README.txt +5 -0
  70. data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
  71. data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
  72. data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
  73. data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
  74. data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
  75. data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
  76. data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
  77. data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
  78. data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
  79. data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
  80. data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
  81. data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
  82. data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
  83. data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
  84. data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
  85. data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
  86. data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
  87. data/libxlsxwriter/third_party/minizip/zip.h +367 -0
  88. data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
  89. data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
  90. data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
  91. data/libxlsxwriter/version.txt +1 -0
  92. metadata +89 -6
  93. data/binaries/libxlsxwriter-alpine.so +0 -0
  94. data/binaries/libxlsxwriter-darwin.dylib +0 -0
  95. data/binaries/libxlsxwriter-glibc.so +0 -0
@@ -0,0 +1,372 @@
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 "third_party/queue.h"
20
+ #include "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
+ /* Chart axis type checks. */
227
+ #define LXW_WARN_CAT_AXIS_ONLY(function) \
228
+ if (!axis->is_category) { \
229
+ fprintf(stderr, "[WARNING]: " \
230
+ function "() is only valid for category axes\n"); \
231
+ return; \
232
+ }
233
+
234
+ #define LXW_WARN_VALUE_AXIS_ONLY(function) \
235
+ if (!axis->is_value) { \
236
+ fprintf(stderr, "[WARNING]: " \
237
+ function "() is only valid for value axes\n"); \
238
+ return; \
239
+ }
240
+
241
+ #define LXW_WARN_DATE_AXIS_ONLY(function) \
242
+ if (!axis->is_date) { \
243
+ fprintf(stderr, "[WARNING]: " \
244
+ function "() is only valid for date axes\n"); \
245
+ return; \
246
+ }
247
+
248
+ #define LXW_WARN_CAT_AND_DATE_AXIS_ONLY(function) \
249
+ if (!axis->is_category && !axis->is_date) { \
250
+ fprintf(stderr, "[WARNING]: " \
251
+ function "() is only valid for category and date axes\n"); \
252
+ return; \
253
+ }
254
+
255
+ #define LXW_WARN_VALUE_AND_DATE_AXIS_ONLY(function) \
256
+ if (!axis->is_value && !axis->is_date) { \
257
+ fprintf(stderr, "[WARNING]: " \
258
+ function "() is only valid for value and date axes\n"); \
259
+ return; \
260
+ }
261
+
262
+ #ifndef LXW_BIG_ENDIAN
263
+ #define LXW_UINT32_NETWORK(n) ((((n) & 0xFF) << 24) | \
264
+ (((n) & 0xFF00) << 8) | \
265
+ (((n) & 0xFF0000) >> 8) | \
266
+ (((n) & 0xFF000000) >> 24))
267
+ #define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
268
+ #else
269
+ #define LXW_UINT32_NETWORK(n) (n)
270
+ #define LXW_UINT16_NETWORK(n) (n)
271
+ #endif
272
+
273
+ /* *INDENT-OFF* */
274
+ #ifdef __cplusplus
275
+ extern "C" {
276
+ #endif
277
+ /* *INDENT-ON* */
278
+
279
+ /* Compilers that have a native snprintf() can use it directly. */
280
+ #ifdef _MSC_VER
281
+ #define LXW_HAS_SNPRINTF
282
+ #endif
283
+
284
+ #ifdef LXW_HAS_SNPRINTF
285
+ #define lxw_snprintf snprintf
286
+ #else
287
+ #define lxw_snprintf __builtin_snprintf
288
+ #endif
289
+
290
+ /* Define a snprintf for MSVC 2010. */
291
+ #if defined(_MSC_VER) && _MSC_VER < 1900
292
+
293
+ #include <stdarg.h>
294
+ #define snprintf msvc2010_snprintf
295
+ #define vsnprintf msvc2010_vsnprintf
296
+
297
+ __inline int
298
+ msvc2010_vsnprintf(char *str, size_t size, const char *format, va_list ap)
299
+ {
300
+ int count = -1;
301
+
302
+ if (size != 0)
303
+ count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
304
+ if (count == -1)
305
+ count = _vscprintf(format, ap);
306
+
307
+ return count;
308
+ }
309
+
310
+ __inline int
311
+ msvc2010_snprintf(char *str, size_t size, const char *format, ...)
312
+ {
313
+ int count;
314
+ va_list ap;
315
+
316
+ va_start(ap, format);
317
+ count = msvc2010_vsnprintf(str, size, format, ap);
318
+ va_end(ap);
319
+
320
+ return count;
321
+ }
322
+
323
+ #endif
324
+
325
+ /* Safer strcpy for fixed width char arrays. */
326
+ #define lxw_strcpy(dest, src) \
327
+ lxw_snprintf(dest, sizeof(dest), "%s", src)
328
+
329
+ /* Define the queue.h structs for the formats list. */
330
+ STAILQ_HEAD(lxw_formats, lxw_format);
331
+
332
+ /* Define the queue.h structs for the generic data structs. */
333
+ STAILQ_HEAD(lxw_tuples, lxw_tuple);
334
+ STAILQ_HEAD(lxw_custom_properties, lxw_custom_property);
335
+
336
+ typedef struct lxw_tuple {
337
+ char *key;
338
+ char *value;
339
+
340
+ STAILQ_ENTRY (lxw_tuple) list_pointers;
341
+ } lxw_tuple;
342
+
343
+ /* Define custom property used in workbook.c and custom.c. */
344
+ typedef struct lxw_custom_property {
345
+
346
+ enum lxw_custom_property_types type;
347
+ char *name;
348
+
349
+ union {
350
+ char *string;
351
+ double number;
352
+ int32_t integer;
353
+ uint8_t boolean;
354
+ lxw_datetime datetime;
355
+ } u;
356
+
357
+ STAILQ_ENTRY (lxw_custom_property) list_pointers;
358
+
359
+ } lxw_custom_property;
360
+
361
+ /* Declarations required for unit testing. */
362
+ #ifdef TESTING
363
+
364
+ #endif /* TESTING */
365
+
366
+ /* *INDENT-OFF* */
367
+ #ifdef __cplusplus
368
+ }
369
+ #endif
370
+ /* *INDENT-ON* */
371
+
372
+ #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 "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__ */
@@ -0,0 +1,52 @@
1
+ /*
2
+ * libxlsxwriter
3
+ *
4
+ * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
+ *
6
+ * custom - A libxlsxwriter library for creating Excel custom property files.
7
+ *
8
+ */
9
+ #ifndef __LXW_CUSTOM_H__
10
+ #define __LXW_CUSTOM_H__
11
+
12
+ #include <stdint.h>
13
+
14
+ #include "common.h"
15
+
16
+ /*
17
+ * Struct to represent a custom property file object.
18
+ */
19
+ typedef struct lxw_custom {
20
+
21
+ FILE *file;
22
+
23
+ struct lxw_custom_properties *custom_properties;
24
+ uint32_t pid;
25
+
26
+ } lxw_custom;
27
+
28
+
29
+ /* *INDENT-OFF* */
30
+ #ifdef __cplusplus
31
+ extern "C" {
32
+ #endif
33
+ /* *INDENT-ON* */
34
+
35
+ lxw_custom *lxw_custom_new();
36
+ void lxw_custom_free(lxw_custom *custom);
37
+ void lxw_custom_assemble_xml_file(lxw_custom *self);
38
+
39
+ /* Declarations required for unit testing. */
40
+ #ifdef TESTING
41
+
42
+ STATIC void _custom_xml_declaration(lxw_custom *self);
43
+
44
+ #endif /* TESTING */
45
+
46
+ /* *INDENT-OFF* */
47
+ #ifdef __cplusplus
48
+ }
49
+ #endif
50
+ /* *INDENT-ON* */
51
+
52
+ #endif /* __LXW_CUSTOM_H__ */
@@ -0,0 +1,111 @@
1
+ /*
2
+ * libxlsxwriter
3
+ *
4
+ * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
+ *
6
+ * drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
7
+ *
8
+ */
9
+ #ifndef __LXW_DRAWING_H__
10
+ #define __LXW_DRAWING_H__
11
+
12
+ #include <stdint.h>
13
+
14
+ #include "common.h"
15
+
16
+ STAILQ_HEAD(lxw_drawing_objects, lxw_drawing_object);
17
+
18
+ enum lxw_drawing_types {
19
+ LXW_DRAWING_NONE = 0,
20
+ LXW_DRAWING_IMAGE,
21
+ LXW_DRAWING_CHART,
22
+ LXW_DRAWING_SHAPE
23
+ };
24
+
25
+ enum lxw_anchor_types {
26
+ LXW_ANCHOR_TYPE_NONE = 0,
27
+ LXW_ANCHOR_TYPE_IMAGE,
28
+ LXW_ANCHOR_TYPE_CHART
29
+ };
30
+
31
+ enum lxw_anchor_edit_types {
32
+ LXW_ANCHOR_EDIT_AS_NONE = 0,
33
+ LXW_ANCHOR_EDIT_AS_RELATIVE,
34
+ LXW_ANCHOR_EDIT_AS_ONE_CELL,
35
+ LXW_ANCHOR_EDIT_AS_ABSOLUTE
36
+ };
37
+
38
+ enum image_types {
39
+ LXW_IMAGE_UNKNOWN = 0,
40
+ LXW_IMAGE_PNG,
41
+ LXW_IMAGE_JPEG,
42
+ LXW_IMAGE_BMP
43
+ };
44
+
45
+ /* Coordinates used in a drawing object. */
46
+ typedef struct lxw_drawing_coords {
47
+ uint32_t col;
48
+ uint32_t row;
49
+ double col_offset;
50
+ double row_offset;
51
+ } lxw_drawing_coords;
52
+
53
+ /* Object to represent the properties of a drawing. */
54
+ typedef struct lxw_drawing_object {
55
+ uint8_t anchor_type;
56
+ uint8_t edit_as;
57
+ struct lxw_drawing_coords from;
58
+ struct lxw_drawing_coords to;
59
+ uint32_t col_absolute;
60
+ uint32_t row_absolute;
61
+ uint32_t width;
62
+ uint32_t height;
63
+ uint8_t shape;
64
+ char *description;
65
+ char *url;
66
+ char *tip;
67
+
68
+ STAILQ_ENTRY (lxw_drawing_object) list_pointers;
69
+
70
+ } lxw_drawing_object;
71
+
72
+ /*
73
+ * Struct to represent a collection of drawings.
74
+ */
75
+ typedef struct lxw_drawing {
76
+
77
+ FILE *file;
78
+
79
+ uint8_t embedded;
80
+
81
+ struct lxw_drawing_objects *drawing_objects;
82
+
83
+ } lxw_drawing;
84
+
85
+
86
+ /* *INDENT-OFF* */
87
+ #ifdef __cplusplus
88
+ extern "C" {
89
+ #endif
90
+ /* *INDENT-ON* */
91
+
92
+ lxw_drawing *lxw_drawing_new();
93
+ void lxw_drawing_free(lxw_drawing *drawing);
94
+ void lxw_drawing_assemble_xml_file(lxw_drawing *self);
95
+ void lxw_free_drawing_object(struct lxw_drawing_object *drawing_object);
96
+ void lxw_add_drawing_object(lxw_drawing *drawing,
97
+ lxw_drawing_object *drawing_object);
98
+
99
+ /* Declarations required for unit testing. */
100
+ #ifdef TESTING
101
+
102
+ STATIC void _drawing_xml_declaration(lxw_drawing *self);
103
+ #endif /* TESTING */
104
+
105
+ /* *INDENT-OFF* */
106
+ #ifdef __cplusplus
107
+ }
108
+ #endif
109
+ /* *INDENT-ON* */
110
+
111
+ #endif /* __LXW_DRAWING_H__ */