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,76 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* hash_table - Hash table functions for libxlsxwriter.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __LXW_HASH_TABLE_H__
|
11
|
+
#define __LXW_HASH_TABLE_H__
|
12
|
+
|
13
|
+
#include "common.h"
|
14
|
+
|
15
|
+
/* Macro to loop over hash table elements in insertion order. */
|
16
|
+
#define LXW_FOREACH_ORDERED(elem, hash_table) \
|
17
|
+
STAILQ_FOREACH((elem), (hash_table)->order_list, lxw_hash_order_pointers)
|
18
|
+
|
19
|
+
/* List declarations. */
|
20
|
+
STAILQ_HEAD(lxw_hash_order_list, lxw_hash_element);
|
21
|
+
SLIST_HEAD(lxw_hash_bucket_list, lxw_hash_element);
|
22
|
+
|
23
|
+
/* LXW_HASH hash table struct. */
|
24
|
+
typedef struct lxw_hash_table {
|
25
|
+
uint32_t num_buckets;
|
26
|
+
uint32_t used_buckets;
|
27
|
+
uint32_t unique_count;
|
28
|
+
uint8_t free_key;
|
29
|
+
uint8_t free_value;
|
30
|
+
|
31
|
+
struct lxw_hash_order_list *order_list;
|
32
|
+
struct lxw_hash_bucket_list **buckets;
|
33
|
+
} lxw_hash_table;
|
34
|
+
|
35
|
+
/*
|
36
|
+
* LXW_HASH table element struct.
|
37
|
+
*
|
38
|
+
* The hash elements contain pointers to allow them to be stored in
|
39
|
+
* lists in the the hash table buckets and also pointers to track the
|
40
|
+
* insertion order in a separate list.
|
41
|
+
*/
|
42
|
+
typedef struct lxw_hash_element {
|
43
|
+
void *key;
|
44
|
+
void *value;
|
45
|
+
|
46
|
+
STAILQ_ENTRY (lxw_hash_element) lxw_hash_order_pointers;
|
47
|
+
SLIST_ENTRY (lxw_hash_element) lxw_hash_list_pointers;
|
48
|
+
} lxw_hash_element;
|
49
|
+
|
50
|
+
|
51
|
+
/* *INDENT-OFF* */
|
52
|
+
#ifdef __cplusplus
|
53
|
+
extern "C" {
|
54
|
+
#endif
|
55
|
+
/* *INDENT-ON* */
|
56
|
+
|
57
|
+
lxw_hash_element *lxw_hash_key_exists(lxw_hash_table *lxw_hash, void *key,
|
58
|
+
size_t key_len);
|
59
|
+
lxw_hash_element *lxw_insert_hash_element(lxw_hash_table *lxw_hash, void *key,
|
60
|
+
void *value, size_t key_len);
|
61
|
+
lxw_hash_table *lxw_hash_new(uint32_t num_buckets, uint8_t free_key,
|
62
|
+
uint8_t free_value);
|
63
|
+
void lxw_hash_free(lxw_hash_table *lxw_hash);
|
64
|
+
|
65
|
+
/* Declarations required for unit testing. */
|
66
|
+
#ifdef TESTING
|
67
|
+
|
68
|
+
#endif
|
69
|
+
|
70
|
+
/* *INDENT-OFF* */
|
71
|
+
#ifdef __cplusplus
|
72
|
+
}
|
73
|
+
#endif
|
74
|
+
/* *INDENT-ON* */
|
75
|
+
|
76
|
+
#endif /* __LXW_HASH_TABLE_H__ */
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* packager - A libxlsxwriter library for creating Excel XLSX packager files.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
#ifndef __LXW_PACKAGER_H__
|
10
|
+
#define __LXW_PACKAGER_H__
|
11
|
+
|
12
|
+
#include <stdint.h>
|
13
|
+
#include "xlsxwriter/third_party/zip.h"
|
14
|
+
|
15
|
+
#include "common.h"
|
16
|
+
#include "workbook.h"
|
17
|
+
#include "worksheet.h"
|
18
|
+
#include "shared_strings.h"
|
19
|
+
#include "app.h"
|
20
|
+
#include "core.h"
|
21
|
+
#include "custom.h"
|
22
|
+
#include "theme.h"
|
23
|
+
#include "styles.h"
|
24
|
+
#include "format.h"
|
25
|
+
#include "content_types.h"
|
26
|
+
#include "relationships.h"
|
27
|
+
|
28
|
+
#define LXW_ZIP_BUFFER_SIZE (16384)
|
29
|
+
|
30
|
+
/* * If zlib returns Z_ERRNO then errno is set and we can trap that. Otherwise
|
31
|
+
* return a default libxlsxwriter error. */
|
32
|
+
#define RETURN_ON_ZIP_ERROR(err, default_err) \
|
33
|
+
if (err == Z_ERRNO) \
|
34
|
+
return LXW_ERROR_ZIP_FILE_OPERATION; \
|
35
|
+
else \
|
36
|
+
return default_err;
|
37
|
+
|
38
|
+
/*
|
39
|
+
* Struct to represent a packager.
|
40
|
+
*/
|
41
|
+
typedef struct lxw_packager {
|
42
|
+
|
43
|
+
FILE *file;
|
44
|
+
lxw_workbook *workbook;
|
45
|
+
|
46
|
+
size_t buffer_size;
|
47
|
+
zipFile zipfile;
|
48
|
+
zip_fileinfo zipfile_info;
|
49
|
+
char *filename;
|
50
|
+
char *buffer;
|
51
|
+
char *tmpdir;
|
52
|
+
|
53
|
+
uint16_t chart_count;
|
54
|
+
uint16_t drawing_count;
|
55
|
+
|
56
|
+
} lxw_packager;
|
57
|
+
|
58
|
+
|
59
|
+
/* *INDENT-OFF* */
|
60
|
+
#ifdef __cplusplus
|
61
|
+
extern "C" {
|
62
|
+
#endif
|
63
|
+
/* *INDENT-ON* */
|
64
|
+
|
65
|
+
lxw_packager *lxw_packager_new(const char *filename, char *tmpdir);
|
66
|
+
void lxw_packager_free(lxw_packager *packager);
|
67
|
+
uint8_t lxw_create_package(lxw_packager *self);
|
68
|
+
|
69
|
+
/* Declarations required for unit testing. */
|
70
|
+
#ifdef TESTING
|
71
|
+
|
72
|
+
#endif /* TESTING */
|
73
|
+
|
74
|
+
/* *INDENT-OFF* */
|
75
|
+
#ifdef __cplusplus
|
76
|
+
}
|
77
|
+
#endif
|
78
|
+
/* *INDENT-ON* */
|
79
|
+
|
80
|
+
#endif /* __LXW_PACKAGER_H__ */
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* relationships - A libxlsxwriter library for creating Excel XLSX
|
7
|
+
* relationships files.
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
#ifndef __LXW_RELATIONSHIPS_H__
|
11
|
+
#define __LXW_RELATIONSHIPS_H__
|
12
|
+
|
13
|
+
#include <stdint.h>
|
14
|
+
|
15
|
+
#include "common.h"
|
16
|
+
|
17
|
+
/* Define the queue.h STAILQ structs for the generic data structs. */
|
18
|
+
STAILQ_HEAD(lxw_rel_tuples, lxw_rel_tuple);
|
19
|
+
|
20
|
+
typedef struct lxw_rel_tuple {
|
21
|
+
|
22
|
+
char *type;
|
23
|
+
char *target;
|
24
|
+
char *target_mode;
|
25
|
+
|
26
|
+
STAILQ_ENTRY (lxw_rel_tuple) list_pointers;
|
27
|
+
|
28
|
+
} lxw_rel_tuple;
|
29
|
+
|
30
|
+
/*
|
31
|
+
* Struct to represent a relationships.
|
32
|
+
*/
|
33
|
+
typedef struct lxw_relationships {
|
34
|
+
|
35
|
+
FILE *file;
|
36
|
+
|
37
|
+
uint32_t rel_id;
|
38
|
+
struct lxw_rel_tuples *relationships;
|
39
|
+
|
40
|
+
} lxw_relationships;
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
/* *INDENT-OFF* */
|
45
|
+
#ifdef __cplusplus
|
46
|
+
extern "C" {
|
47
|
+
#endif
|
48
|
+
/* *INDENT-ON* */
|
49
|
+
|
50
|
+
lxw_relationships *lxw_relationships_new();
|
51
|
+
void lxw_free_relationships(lxw_relationships *relationships);
|
52
|
+
void lxw_relationships_assemble_xml_file(lxw_relationships *self);
|
53
|
+
|
54
|
+
void lxw_add_document_relationship(lxw_relationships *self, const char *type,
|
55
|
+
const char *target);
|
56
|
+
void lxw_add_package_relationship(lxw_relationships *self, const char *type,
|
57
|
+
const char *target);
|
58
|
+
void lxw_add_ms_package_relationship(lxw_relationships *self,
|
59
|
+
const char *type, const char *target);
|
60
|
+
void lxw_add_worksheet_relationship(lxw_relationships *self, const char *type,
|
61
|
+
const char *target,
|
62
|
+
const char *target_mode);
|
63
|
+
|
64
|
+
/* Declarations required for unit testing. */
|
65
|
+
#ifdef TESTING
|
66
|
+
|
67
|
+
STATIC void _relationships_xml_declaration(lxw_relationships *self);
|
68
|
+
|
69
|
+
#endif /* TESTING */
|
70
|
+
|
71
|
+
/* *INDENT-OFF* */
|
72
|
+
#ifdef __cplusplus
|
73
|
+
}
|
74
|
+
#endif
|
75
|
+
/* *INDENT-ON* */
|
76
|
+
|
77
|
+
#endif /* __LXW_RELATIONSHIPS_H__ */
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* shared_strings - A libxlsxwriter library for creating Excel XLSX
|
7
|
+
* sst files.
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
#ifndef __LXW_SST_H__
|
11
|
+
#define __LXW_SST_H__
|
12
|
+
|
13
|
+
#include <string.h>
|
14
|
+
#include <stdint.h>
|
15
|
+
|
16
|
+
#include "common.h"
|
17
|
+
|
18
|
+
/* Define a tree.h RB structure for storing shared strings. */
|
19
|
+
RB_HEAD(sst_rb_tree, sst_element);
|
20
|
+
|
21
|
+
/* Define a queue.h structure for storing shared strings in insertion order. */
|
22
|
+
STAILQ_HEAD(sst_order_list, sst_element);
|
23
|
+
|
24
|
+
/* Wrapper around RB_GENERATE_STATIC from tree.h to avoid unused function
|
25
|
+
* warnings and to avoid portability issues with the _unused attribute. */
|
26
|
+
#define LXW_RB_GENERATE_ELEMENT(name, type, field, cmp) \
|
27
|
+
RB_GENERATE_INSERT_COLOR(name, type, field, static) \
|
28
|
+
RB_GENERATE_INSERT(name, type, field, cmp, static) \
|
29
|
+
/* Add unused struct to allow adding a semicolon */ \
|
30
|
+
struct lxw_rb_generate_element{int unused;}
|
31
|
+
|
32
|
+
/*
|
33
|
+
* Elements of the SST table. They contain pointers to allow them to
|
34
|
+
* be stored in a RB tree and also pointers to track the insertion order
|
35
|
+
* in a separate list.
|
36
|
+
*/
|
37
|
+
struct sst_element {
|
38
|
+
uint32_t index;
|
39
|
+
char *string;
|
40
|
+
|
41
|
+
STAILQ_ENTRY (sst_element) sst_order_pointers;
|
42
|
+
RB_ENTRY (sst_element) sst_tree_pointers;
|
43
|
+
};
|
44
|
+
|
45
|
+
/*
|
46
|
+
* Struct to represent a sst.
|
47
|
+
*/
|
48
|
+
typedef struct lxw_sst {
|
49
|
+
FILE *file;
|
50
|
+
|
51
|
+
uint32_t string_count;
|
52
|
+
uint32_t unique_count;
|
53
|
+
|
54
|
+
struct sst_order_list *order_list;
|
55
|
+
struct sst_rb_tree *rb_tree;
|
56
|
+
|
57
|
+
} lxw_sst;
|
58
|
+
|
59
|
+
/* *INDENT-OFF* */
|
60
|
+
#ifdef __cplusplus
|
61
|
+
extern "C" {
|
62
|
+
#endif
|
63
|
+
/* *INDENT-ON* */
|
64
|
+
|
65
|
+
lxw_sst *lxw_sst_new();
|
66
|
+
void lxw_sst_free(lxw_sst *sst);
|
67
|
+
struct sst_element *lxw_get_sst_index(lxw_sst *sst, const char *string);
|
68
|
+
void lxw_sst_assemble_xml_file(lxw_sst *self);
|
69
|
+
|
70
|
+
/* Declarations required for unit testing. */
|
71
|
+
#ifdef TESTING
|
72
|
+
|
73
|
+
STATIC void _sst_xml_declaration(lxw_sst *self);
|
74
|
+
|
75
|
+
#endif /* TESTING */
|
76
|
+
|
77
|
+
/* *INDENT-OFF* */
|
78
|
+
#ifdef __cplusplus
|
79
|
+
}
|
80
|
+
#endif
|
81
|
+
/* *INDENT-ON* */
|
82
|
+
|
83
|
+
#endif /* __LXW_SST_H__ */
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* styles - A libxlsxwriter library for creating Excel XLSX styles files.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
#ifndef __LXW_STYLES_H__
|
10
|
+
#define __LXW_STYLES_H__
|
11
|
+
|
12
|
+
#include <stdint.h>
|
13
|
+
|
14
|
+
#include "format.h"
|
15
|
+
|
16
|
+
/*
|
17
|
+
* Struct to represent a styles.
|
18
|
+
*/
|
19
|
+
typedef struct lxw_styles {
|
20
|
+
|
21
|
+
FILE *file;
|
22
|
+
uint32_t font_count;
|
23
|
+
uint32_t xf_count;
|
24
|
+
uint32_t dxf_count;
|
25
|
+
uint32_t num_format_count;
|
26
|
+
uint32_t border_count;
|
27
|
+
uint32_t fill_count;
|
28
|
+
struct lxw_formats *xf_formats;
|
29
|
+
struct lxw_formats *dxf_formats;
|
30
|
+
|
31
|
+
} lxw_styles;
|
32
|
+
|
33
|
+
|
34
|
+
/* *INDENT-OFF* */
|
35
|
+
#ifdef __cplusplus
|
36
|
+
extern "C" {
|
37
|
+
#endif
|
38
|
+
/* *INDENT-ON* */
|
39
|
+
|
40
|
+
lxw_styles *lxw_styles_new();
|
41
|
+
void lxw_styles_free(lxw_styles *styles);
|
42
|
+
void lxw_styles_assemble_xml_file(lxw_styles *self);
|
43
|
+
|
44
|
+
/* Declarations required for unit testing. */
|
45
|
+
#ifdef TESTING
|
46
|
+
|
47
|
+
STATIC void _styles_xml_declaration(lxw_styles *self);
|
48
|
+
STATIC void _write_style_sheet(lxw_styles *self);
|
49
|
+
STATIC void _write_font_size(lxw_styles *self, uint16_t font_size);
|
50
|
+
STATIC void _write_font_color_theme(lxw_styles *self, uint8_t theme);
|
51
|
+
STATIC void _write_font_name(lxw_styles *self, const char *font_name);
|
52
|
+
STATIC void _write_font_family(lxw_styles *self, uint8_t font_family);
|
53
|
+
STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme);
|
54
|
+
STATIC void _write_font(lxw_styles *self, lxw_format *format);
|
55
|
+
STATIC void _write_fonts(lxw_styles *self);
|
56
|
+
STATIC void _write_default_fill(lxw_styles *self, const char *pattern);
|
57
|
+
STATIC void _write_fills(lxw_styles *self);
|
58
|
+
STATIC void _write_border(lxw_styles *self, lxw_format *format);
|
59
|
+
STATIC void _write_borders(lxw_styles *self);
|
60
|
+
STATIC void _write_style_xf(lxw_styles *self);
|
61
|
+
STATIC void _write_cell_style_xfs(lxw_styles *self);
|
62
|
+
STATIC void _write_xf(lxw_styles *self, lxw_format *format);
|
63
|
+
STATIC void _write_cell_xfs(lxw_styles *self);
|
64
|
+
STATIC void _write_cell_style(lxw_styles *self);
|
65
|
+
STATIC void _write_cell_styles(lxw_styles *self);
|
66
|
+
STATIC void _write_dxfs(lxw_styles *self);
|
67
|
+
STATIC void _write_table_styles(lxw_styles *self);
|
68
|
+
|
69
|
+
#endif /* TESTING */
|
70
|
+
|
71
|
+
/* *INDENT-OFF* */
|
72
|
+
#ifdef __cplusplus
|
73
|
+
}
|
74
|
+
#endif
|
75
|
+
/* *INDENT-ON* */
|
76
|
+
|
77
|
+
#endif /* __LXW_STYLES_H__ */
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/*
|
2
|
+
* libxlsxwriter
|
3
|
+
*
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
5
|
+
*
|
6
|
+
* theme - A libxlsxwriter library for creating Excel XLSX theme files.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
#ifndef __LXW_THEME_H__
|
10
|
+
#define __LXW_THEME_H__
|
11
|
+
|
12
|
+
#include <stdint.h>
|
13
|
+
|
14
|
+
#include "common.h"
|
15
|
+
|
16
|
+
/*
|
17
|
+
* Struct to represent a theme.
|
18
|
+
*/
|
19
|
+
typedef struct lxw_theme {
|
20
|
+
|
21
|
+
FILE *file;
|
22
|
+
} lxw_theme;
|
23
|
+
|
24
|
+
|
25
|
+
/* *INDENT-OFF* */
|
26
|
+
#ifdef __cplusplus
|
27
|
+
extern "C" {
|
28
|
+
#endif
|
29
|
+
/* *INDENT-ON* */
|
30
|
+
|
31
|
+
lxw_theme *lxw_theme_new();
|
32
|
+
void lxw_theme_free(lxw_theme *theme);
|
33
|
+
void lxw_theme_xml_declaration(lxw_theme *self);
|
34
|
+
void lxw_theme_assemble_xml_file(lxw_theme *self);
|
35
|
+
|
36
|
+
/* Declarations required for unit testing. */
|
37
|
+
#ifdef TESTING
|
38
|
+
|
39
|
+
#endif /* TESTING */
|
40
|
+
|
41
|
+
/* *INDENT-OFF* */
|
42
|
+
#ifdef __cplusplus
|
43
|
+
}
|
44
|
+
#endif
|
45
|
+
/* *INDENT-ON* */
|
46
|
+
|
47
|
+
#endif /* __LXW_THEME_H__ */
|
@@ -0,0 +1,215 @@
|
|
1
|
+
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
2
|
+
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
3
|
+
|
4
|
+
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
5
|
+
|
6
|
+
Modifications for Zip64 support
|
7
|
+
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
8
|
+
|
9
|
+
For more info read MiniZip_info.txt
|
10
|
+
|
11
|
+
Changes
|
12
|
+
|
13
|
+
Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
|
14
|
+
Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
|
15
|
+
More if/def section may be needed to support other platforms
|
16
|
+
Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
|
17
|
+
(but you should use iowin32.c for windows instead)
|
18
|
+
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
/* Pragma added by libxlsxwriter to avoid warnings with -pedantic -ansi. */
|
23
|
+
#ifndef _WIN32
|
24
|
+
#pragma GCC system_header
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#ifndef _ZLIBIOAPI64_H
|
28
|
+
#define _ZLIBIOAPI64_H
|
29
|
+
|
30
|
+
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
31
|
+
|
32
|
+
// Linux needs this to support file operation on files larger then 4+GB
|
33
|
+
// But might need better if/def to select just the platforms that needs them.
|
34
|
+
|
35
|
+
#ifndef __USE_FILE_OFFSET64
|
36
|
+
#define __USE_FILE_OFFSET64
|
37
|
+
#endif
|
38
|
+
#ifndef __USE_LARGEFILE64
|
39
|
+
#define __USE_LARGEFILE64
|
40
|
+
#endif
|
41
|
+
#ifndef _LARGEFILE64_SOURCE
|
42
|
+
#define _LARGEFILE64_SOURCE
|
43
|
+
#endif
|
44
|
+
#ifndef _FILE_OFFSET_BIT
|
45
|
+
#define _FILE_OFFSET_BIT 64
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#include <stdio.h>
|
51
|
+
#include <stdlib.h>
|
52
|
+
#include "zlib.h"
|
53
|
+
|
54
|
+
#if defined(USE_FILE32API)
|
55
|
+
#define fopen64 fopen
|
56
|
+
#define ftello64 ftell
|
57
|
+
#define fseeko64 fseek
|
58
|
+
#else
|
59
|
+
#ifdef __FreeBSD__
|
60
|
+
#define fopen64 fopen
|
61
|
+
#define ftello64 ftello
|
62
|
+
#define fseeko64 fseeko
|
63
|
+
#endif
|
64
|
+
#ifdef _MSC_VER
|
65
|
+
#define fopen64 fopen
|
66
|
+
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
|
67
|
+
#define ftello64 _ftelli64
|
68
|
+
#define fseeko64 _fseeki64
|
69
|
+
#else // old MSC
|
70
|
+
#define ftello64 ftell
|
71
|
+
#define fseeko64 fseek
|
72
|
+
#endif
|
73
|
+
#endif
|
74
|
+
#endif
|
75
|
+
|
76
|
+
/*
|
77
|
+
#ifndef ZPOS64_T
|
78
|
+
#ifdef _WIN32
|
79
|
+
#define ZPOS64_T fpos_t
|
80
|
+
#else
|
81
|
+
#include <stdint.h>
|
82
|
+
#define ZPOS64_T uint64_t
|
83
|
+
#endif
|
84
|
+
#endif
|
85
|
+
*/
|
86
|
+
|
87
|
+
#ifdef HAVE_MINIZIP64_CONF_H
|
88
|
+
#include "mz64conf.h"
|
89
|
+
#endif
|
90
|
+
|
91
|
+
/* a type choosen by DEFINE */
|
92
|
+
#ifdef HAVE_64BIT_INT_CUSTOM
|
93
|
+
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
94
|
+
#else
|
95
|
+
#ifdef HAS_STDINT_H
|
96
|
+
#include "stdint.h"
|
97
|
+
typedef uint64_t ZPOS64_T;
|
98
|
+
#else
|
99
|
+
|
100
|
+
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
101
|
+
#define MAXU32 0xffffffff
|
102
|
+
|
103
|
+
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
104
|
+
typedef unsigned __int64 ZPOS64_T;
|
105
|
+
#else
|
106
|
+
typedef unsigned long long int ZPOS64_T;
|
107
|
+
#endif
|
108
|
+
#endif
|
109
|
+
#endif
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
#ifdef __cplusplus
|
114
|
+
extern "C" {
|
115
|
+
#endif
|
116
|
+
|
117
|
+
|
118
|
+
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
119
|
+
#define ZLIB_FILEFUNC_SEEK_END (2)
|
120
|
+
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
121
|
+
|
122
|
+
#define ZLIB_FILEFUNC_MODE_READ (1)
|
123
|
+
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
124
|
+
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
125
|
+
|
126
|
+
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
127
|
+
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
128
|
+
|
129
|
+
|
130
|
+
#ifndef ZCALLBACK
|
131
|
+
#if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
132
|
+
#define ZCALLBACK CALLBACK
|
133
|
+
#else
|
134
|
+
#define ZCALLBACK
|
135
|
+
#endif
|
136
|
+
#endif
|
137
|
+
|
138
|
+
#ifndef OF
|
139
|
+
#define OF(args) args
|
140
|
+
#endif
|
141
|
+
|
142
|
+
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
143
|
+
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
144
|
+
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
145
|
+
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
146
|
+
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
147
|
+
|
148
|
+
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
149
|
+
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
150
|
+
|
151
|
+
|
152
|
+
/* here is the "old" 32 bits structure structure */
|
153
|
+
typedef struct zlib_filefunc_def_s
|
154
|
+
{
|
155
|
+
open_file_func zopen_file;
|
156
|
+
read_file_func zread_file;
|
157
|
+
write_file_func zwrite_file;
|
158
|
+
tell_file_func ztell_file;
|
159
|
+
seek_file_func zseek_file;
|
160
|
+
close_file_func zclose_file;
|
161
|
+
testerror_file_func zerror_file;
|
162
|
+
voidpf opaque;
|
163
|
+
} zlib_filefunc_def;
|
164
|
+
|
165
|
+
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
166
|
+
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
167
|
+
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
|
168
|
+
|
169
|
+
typedef struct zlib_filefunc64_def_s
|
170
|
+
{
|
171
|
+
open64_file_func zopen64_file;
|
172
|
+
read_file_func zread_file;
|
173
|
+
write_file_func zwrite_file;
|
174
|
+
tell64_file_func ztell64_file;
|
175
|
+
seek64_file_func zseek64_file;
|
176
|
+
close_file_func zclose_file;
|
177
|
+
testerror_file_func zerror_file;
|
178
|
+
voidpf opaque;
|
179
|
+
} zlib_filefunc64_def;
|
180
|
+
|
181
|
+
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
182
|
+
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
183
|
+
|
184
|
+
/* now internal definition, only for zip.c and unzip.h */
|
185
|
+
typedef struct zlib_filefunc64_32_def_s
|
186
|
+
{
|
187
|
+
zlib_filefunc64_def zfile_func64;
|
188
|
+
open_file_func zopen32_file;
|
189
|
+
tell_file_func ztell32_file;
|
190
|
+
seek_file_func zseek32_file;
|
191
|
+
} zlib_filefunc64_32_def;
|
192
|
+
|
193
|
+
|
194
|
+
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
195
|
+
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
196
|
+
/* #define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
|
197
|
+
/* #define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
|
198
|
+
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
199
|
+
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
200
|
+
|
201
|
+
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
|
202
|
+
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
|
203
|
+
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
|
204
|
+
|
205
|
+
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
206
|
+
|
207
|
+
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
208
|
+
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
209
|
+
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
|
210
|
+
|
211
|
+
#ifdef __cplusplus
|
212
|
+
}
|
213
|
+
#endif
|
214
|
+
|
215
|
+
#endif
|