kmadej_fast_excel_fork 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +28 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +70 -0
- data/Makefile +14 -0
- data/README.md +95 -0
- data/Rakefile +24 -0
- data/appveyor.yml +25 -0
- data/benchmarks/1k_rows.rb +59 -0
- data/benchmarks/20k_rows.rb +26 -0
- data/benchmarks/init.rb +59 -0
- data/benchmarks/memory.rb +49 -0
- data/examples/example.rb +42 -0
- data/examples/example_align.rb +23 -0
- data/examples/example_chart.rb +21 -0
- data/examples/example_colors.rb +37 -0
- data/examples/example_formula.rb +18 -0
- data/examples/example_image.rb +13 -0
- data/examples/example_styles.rb +27 -0
- data/examples/logo.png +0 -0
- data/extconf.rb +0 -0
- data/fast_excel.gemspec +20 -0
- data/lib/fast_excel.rb +600 -0
- data/lib/fast_excel/binding.rb +2819 -0
- data/lib/fast_excel/binding/chart.rb +2666 -0
- data/lib/fast_excel/binding/format.rb +1177 -0
- data/lib/fast_excel/binding/workbook.rb +338 -0
- data/lib/fast_excel/binding/worksheet.rb +1555 -0
- data/libxlsxwriter/.gitignore +49 -0
- data/libxlsxwriter/.indent.pro +125 -0
- data/libxlsxwriter/.travis.yml +25 -0
- data/libxlsxwriter/CONTRIBUTING.md +226 -0
- data/libxlsxwriter/Changes.txt +557 -0
- data/libxlsxwriter/LICENSE.txt +89 -0
- data/libxlsxwriter/Makefile +156 -0
- data/libxlsxwriter/Readme.md +78 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
- data/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
- data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/libxlsxwriter/lib/.gitignore +0 -0
- data/libxlsxwriter/libxlsxwriter.podspec +47 -0
- data/libxlsxwriter/src/Makefile +130 -0
- data/libxlsxwriter/src/app.c +443 -0
- data/libxlsxwriter/src/chart.c +6346 -0
- data/libxlsxwriter/src/content_types.c +345 -0
- data/libxlsxwriter/src/core.c +293 -0
- data/libxlsxwriter/src/custom.c +224 -0
- data/libxlsxwriter/src/drawing.c +746 -0
- data/libxlsxwriter/src/format.c +729 -0
- data/libxlsxwriter/src/hash_table.c +223 -0
- data/libxlsxwriter/src/packager.c +948 -0
- data/libxlsxwriter/src/relationships.c +245 -0
- data/libxlsxwriter/src/shared_strings.c +266 -0
- data/libxlsxwriter/src/styles.c +1088 -0
- data/libxlsxwriter/src/theme.c +348 -0
- data/libxlsxwriter/src/utility.c +515 -0
- data/libxlsxwriter/src/workbook.c +1930 -0
- data/libxlsxwriter/src/worksheet.c +5022 -0
- data/libxlsxwriter/src/xmlwriter.c +355 -0
- data/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
- data/libxlsxwriter/third_party/minizip/README.txt +5 -0
- data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
- data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
- data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
- data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
- data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
- data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
- data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/libxlsxwriter/version.txt +1 -0
- data/test/date_test.rb +22 -0
- data/test/default_format_test.rb +19 -0
- data/test/format_test.rb +171 -0
- data/test/test_helper.rb +52 -0
- data/test/tmpfile_test.rb +23 -0
- data/test/worksheet_test.rb +86 -0
- metadata +182 -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 "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
|
+
lxw_error 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__ */
|