fast_excel 0.6.0 → 0.6.1
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 +4 -4
- data/.github/workflows/test.yml +1 -1
- data/CHANGELOG.md +3 -1
- data/Rakefile +4 -1
- data/fast_excel.gemspec +1 -1
- data/lib/fast_excel/binding/workbook.rb +9 -0
- data/lib/fast_excel/binding/worksheet.rb +2 -2
- data/lib/fast_excel/binding.rb +16 -13
- data/libxlsxwriter/.cirrus.yml +9 -0
- data/libxlsxwriter/.github/workflows/cmake_actions.yml +10 -6
- data/libxlsxwriter/.github/workflows/code_style.yml +2 -0
- data/libxlsxwriter/.github/workflows/make_32_actions.yml +43 -0
- data/libxlsxwriter/.github/workflows/windows_build.yml +7 -6
- data/libxlsxwriter/.github/workflows/zig_build.yml +1 -3
- data/libxlsxwriter/.gitignore +9 -7
- data/libxlsxwriter/.indent.pro +6 -0
- data/libxlsxwriter/CMakeLists.txt +377 -238
- data/libxlsxwriter/Changes.txt +189 -0
- data/libxlsxwriter/LICENSE.txt +1 -1
- data/libxlsxwriter/Makefile +36 -4
- data/libxlsxwriter/Readme.md +1 -1
- data/libxlsxwriter/build.zig +181 -92
- data/libxlsxwriter/build.zig.zon +15 -4
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +4 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/chart.h +134 -1
- data/libxlsxwriter/include/xlsxwriter/chartsheet.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/comment.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/common.h +12 -8
- data/libxlsxwriter/include/xlsxwriter/content_types.h +3 -1
- data/libxlsxwriter/include/xlsxwriter/core.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/custom.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/drawing.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/format.h +34 -3
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/metadata.h +5 -1
- data/libxlsxwriter/include/xlsxwriter/packager.h +6 -1
- data/libxlsxwriter/include/xlsxwriter/relationships.h +3 -1
- data/libxlsxwriter/include/xlsxwriter/rich_value.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/rich_value_rel.h +50 -0
- data/libxlsxwriter/include/xlsxwriter/rich_value_structure.h +53 -0
- data/libxlsxwriter/include/xlsxwriter/rich_value_types.h +49 -0
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/styles.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/table.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/theme.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +4 -4
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +3 -3
- data/libxlsxwriter/include/xlsxwriter/utility.h +58 -7
- data/libxlsxwriter/include/xlsxwriter/vml.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/workbook.h +59 -2
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +159 -13
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +11 -10
- data/libxlsxwriter/include/xlsxwriter.h +5 -4
- data/libxlsxwriter/libxlsxwriter.podspec +6 -6
- data/libxlsxwriter/src/Makefile +2 -1
- data/libxlsxwriter/src/app.c +2 -1
- data/libxlsxwriter/src/chart.c +360 -63
- data/libxlsxwriter/src/chartsheet.c +2 -1
- data/libxlsxwriter/src/comment.c +2 -1
- data/libxlsxwriter/src/content_types.c +22 -1
- data/libxlsxwriter/src/core.c +2 -1
- data/libxlsxwriter/src/custom.c +2 -1
- data/libxlsxwriter/src/drawing.c +7 -3
- data/libxlsxwriter/src/format.c +21 -1
- data/libxlsxwriter/src/hash_table.c +2 -1
- data/libxlsxwriter/src/metadata.c +176 -20
- data/libxlsxwriter/src/packager.c +306 -6
- data/libxlsxwriter/src/relationships.c +25 -1
- data/libxlsxwriter/src/rich_value.c +191 -0
- data/libxlsxwriter/src/rich_value_rel.c +142 -0
- data/libxlsxwriter/src/rich_value_structure.c +162 -0
- data/libxlsxwriter/src/rich_value_types.c +199 -0
- data/libxlsxwriter/src/shared_strings.c +2 -1
- data/libxlsxwriter/src/styles.c +31 -7
- data/libxlsxwriter/src/table.c +2 -1
- data/libxlsxwriter/src/theme.c +2 -1
- data/libxlsxwriter/src/utility.c +136 -46
- data/libxlsxwriter/src/vml.c +2 -1
- data/libxlsxwriter/src/workbook.c +191 -10
- data/libxlsxwriter/src/worksheet.c +514 -34
- data/libxlsxwriter/src/xmlwriter.c +17 -22
- data/libxlsxwriter/third_party/minizip/Makefile.orig +1 -1
- data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
- data/libxlsxwriter/third_party/minizip/ioapi.h +6 -6
- data/libxlsxwriter/third_party/minizip/miniunz.c +16 -2
- data/libxlsxwriter/third_party/minizip/unzip.c +4 -4
- data/libxlsxwriter/third_party/minizip/unzip.h +1 -1
- data/libxlsxwriter/third_party/minizip/zip.c +5 -5
- data/libxlsxwriter/third_party/minizip/zip.h +3 -3
- data/libxlsxwriter/version.txt +1 -1
- data/test/validations_test.rb +3 -3
- data/test/worksheet_test.rb +10 -2
- metadata +11 -4
- data/libxlsxwriter/cmake/FindMINIZIP.cmake +0 -121
- data/libxlsxwriter/cmake/FindPackage.cmake +0 -183
- data/libxlsxwriter/cmake/i686-toolchain.cmake +0 -7
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* rich_value_rel - A library for creating Excel XLSX rich_value_rel files.
|
|
3
|
+
*
|
|
4
|
+
* Used in conjunction with the libxlsxwriter library.
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "xlsxwriter/xmlwriter.h"
|
|
11
|
+
#include "xlsxwriter/rich_value_rel.h"
|
|
12
|
+
#include "xlsxwriter/utility.h"
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Forward declarations.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*****************************************************************************
|
|
19
|
+
*
|
|
20
|
+
* Private functions.
|
|
21
|
+
*
|
|
22
|
+
****************************************************************************/
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* Create a new rich_value_rel object.
|
|
26
|
+
*/
|
|
27
|
+
lxw_rich_value_rel *
|
|
28
|
+
lxw_rich_value_rel_new(void)
|
|
29
|
+
{
|
|
30
|
+
lxw_rich_value_rel *rich_value_rel =
|
|
31
|
+
calloc(1, sizeof(lxw_rich_value_rel));
|
|
32
|
+
GOTO_LABEL_ON_MEM_ERROR(rich_value_rel, mem_error);
|
|
33
|
+
|
|
34
|
+
return rich_value_rel;
|
|
35
|
+
|
|
36
|
+
mem_error:
|
|
37
|
+
lxw_rich_value_rel_free(rich_value_rel);
|
|
38
|
+
return NULL;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Free a rich_value_rel object.
|
|
43
|
+
*/
|
|
44
|
+
void
|
|
45
|
+
lxw_rich_value_rel_free(lxw_rich_value_rel *rich_value_rel)
|
|
46
|
+
{
|
|
47
|
+
if (!rich_value_rel)
|
|
48
|
+
return;
|
|
49
|
+
|
|
50
|
+
free(rich_value_rel);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/*****************************************************************************
|
|
54
|
+
*
|
|
55
|
+
* XML functions.
|
|
56
|
+
*
|
|
57
|
+
****************************************************************************/
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Write the XML declaration.
|
|
61
|
+
*/
|
|
62
|
+
STATIC void
|
|
63
|
+
_rich_value_rel_xml_declaration(lxw_rich_value_rel *self)
|
|
64
|
+
{
|
|
65
|
+
lxw_xml_declaration(self->file);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*****************************************************************************
|
|
69
|
+
*
|
|
70
|
+
* XML file assembly functions.
|
|
71
|
+
*
|
|
72
|
+
****************************************************************************/
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Write the <rel> element.
|
|
76
|
+
*/
|
|
77
|
+
STATIC void
|
|
78
|
+
_rich_value_rel_write_rel(lxw_rich_value_rel *self, uint32_t rel_index)
|
|
79
|
+
{
|
|
80
|
+
struct xml_attribute_list attributes;
|
|
81
|
+
struct xml_attribute *attribute;
|
|
82
|
+
char r_id[LXW_MAX_ATTRIBUTE_LENGTH];
|
|
83
|
+
|
|
84
|
+
lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", rel_index);
|
|
85
|
+
|
|
86
|
+
LXW_INIT_ATTRIBUTES();
|
|
87
|
+
LXW_PUSH_ATTRIBUTES_STR("r:id", r_id);
|
|
88
|
+
|
|
89
|
+
lxw_xml_empty_tag(self->file, "rel", &attributes);
|
|
90
|
+
|
|
91
|
+
LXW_FREE_ATTRIBUTES();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* Write the <richValueRels> element.
|
|
96
|
+
*/
|
|
97
|
+
STATIC void
|
|
98
|
+
_rich_value_rel_write_rich_value_rels(lxw_rich_value_rel *self)
|
|
99
|
+
{
|
|
100
|
+
struct xml_attribute_list attributes;
|
|
101
|
+
struct xml_attribute *attribute;
|
|
102
|
+
char xmlns[] =
|
|
103
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2022/richvaluerel";
|
|
104
|
+
char xmlns_r[] =
|
|
105
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
106
|
+
|
|
107
|
+
LXW_INIT_ATTRIBUTES();
|
|
108
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
|
|
109
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
|
|
110
|
+
|
|
111
|
+
lxw_xml_start_tag(self->file, "richValueRels", &attributes);
|
|
112
|
+
|
|
113
|
+
LXW_FREE_ATTRIBUTES();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
* Assemble and write the XML file.
|
|
118
|
+
*/
|
|
119
|
+
void
|
|
120
|
+
lxw_rich_value_rel_assemble_xml_file(lxw_rich_value_rel *self)
|
|
121
|
+
{
|
|
122
|
+
uint32_t i;
|
|
123
|
+
|
|
124
|
+
/* Write the XML declaration. */
|
|
125
|
+
_rich_value_rel_xml_declaration(self);
|
|
126
|
+
|
|
127
|
+
/* Write the richValueRels element. */
|
|
128
|
+
_rich_value_rel_write_rich_value_rels(self);
|
|
129
|
+
|
|
130
|
+
for (i = 1; i <= self->num_embedded_images; i++) {
|
|
131
|
+
/* Write the rel element. */
|
|
132
|
+
_rich_value_rel_write_rel(self, i);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
lxw_xml_end_tag(self->file, "richValueRels");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*****************************************************************************
|
|
139
|
+
*
|
|
140
|
+
* Public functions.
|
|
141
|
+
*
|
|
142
|
+
****************************************************************************/
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* rich_value_structure - A library for creating Excel XLSX rich_value_structure files.
|
|
3
|
+
*
|
|
4
|
+
* Used in conjunction with the libxlsxwriter library.
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "xlsxwriter/xmlwriter.h"
|
|
11
|
+
#include "xlsxwriter/rich_value_structure.h"
|
|
12
|
+
#include "xlsxwriter/utility.h"
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Forward declarations.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*****************************************************************************
|
|
19
|
+
*
|
|
20
|
+
* Private functions.
|
|
21
|
+
*
|
|
22
|
+
****************************************************************************/
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* Create a new rich_value_structure object.
|
|
26
|
+
*/
|
|
27
|
+
lxw_rich_value_structure *
|
|
28
|
+
lxw_rich_value_structure_new(void)
|
|
29
|
+
{
|
|
30
|
+
lxw_rich_value_structure *rich_value_structure =
|
|
31
|
+
calloc(1, sizeof(lxw_rich_value_structure));
|
|
32
|
+
GOTO_LABEL_ON_MEM_ERROR(rich_value_structure, mem_error);
|
|
33
|
+
|
|
34
|
+
return rich_value_structure;
|
|
35
|
+
|
|
36
|
+
mem_error:
|
|
37
|
+
lxw_rich_value_structure_free(rich_value_structure);
|
|
38
|
+
return NULL;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Free a rich_value_structure object.
|
|
43
|
+
*/
|
|
44
|
+
void
|
|
45
|
+
lxw_rich_value_structure_free(lxw_rich_value_structure *rich_value_structure)
|
|
46
|
+
{
|
|
47
|
+
if (!rich_value_structure)
|
|
48
|
+
return;
|
|
49
|
+
|
|
50
|
+
free(rich_value_structure);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/*****************************************************************************
|
|
54
|
+
*
|
|
55
|
+
* XML functions.
|
|
56
|
+
*
|
|
57
|
+
****************************************************************************/
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Write the XML declaration.
|
|
61
|
+
*/
|
|
62
|
+
STATIC void
|
|
63
|
+
_rich_value_structure_xml_declaration(lxw_rich_value_structure *self)
|
|
64
|
+
{
|
|
65
|
+
lxw_xml_declaration(self->file);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*****************************************************************************
|
|
69
|
+
*
|
|
70
|
+
* XML file assembly functions.
|
|
71
|
+
*
|
|
72
|
+
****************************************************************************/
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Write the <k> element.
|
|
76
|
+
*/
|
|
77
|
+
STATIC void
|
|
78
|
+
_rich_value_structure_write_k(lxw_rich_value_structure *self, char *name,
|
|
79
|
+
char *type)
|
|
80
|
+
{
|
|
81
|
+
struct xml_attribute_list attributes;
|
|
82
|
+
struct xml_attribute *attribute;
|
|
83
|
+
|
|
84
|
+
LXW_INIT_ATTRIBUTES();
|
|
85
|
+
LXW_PUSH_ATTRIBUTES_STR("n", name);
|
|
86
|
+
LXW_PUSH_ATTRIBUTES_STR("t", type);
|
|
87
|
+
|
|
88
|
+
lxw_xml_empty_tag(self->file, "k", &attributes);
|
|
89
|
+
|
|
90
|
+
LXW_FREE_ATTRIBUTES();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* Write the <s> element.
|
|
95
|
+
*/
|
|
96
|
+
STATIC void
|
|
97
|
+
_rich_value_structure_write_s(lxw_rich_value_structure *self)
|
|
98
|
+
{
|
|
99
|
+
struct xml_attribute_list attributes;
|
|
100
|
+
struct xml_attribute *attribute;
|
|
101
|
+
|
|
102
|
+
LXW_INIT_ATTRIBUTES();
|
|
103
|
+
LXW_PUSH_ATTRIBUTES_STR("t", "_localImage");
|
|
104
|
+
|
|
105
|
+
lxw_xml_start_tag(self->file, "s", &attributes);
|
|
106
|
+
|
|
107
|
+
/* Write the k element. */
|
|
108
|
+
_rich_value_structure_write_k(self, "_rvRel:LocalImageIdentifier", "i");
|
|
109
|
+
_rich_value_structure_write_k(self, "CalcOrigin", "i");
|
|
110
|
+
|
|
111
|
+
if (self->has_embedded_image_descriptions)
|
|
112
|
+
_rich_value_structure_write_k(self, "Text", "s");
|
|
113
|
+
|
|
114
|
+
lxw_xml_end_tag(self->file, "s");
|
|
115
|
+
|
|
116
|
+
LXW_FREE_ATTRIBUTES();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
* Write the <rvStructures> element.
|
|
121
|
+
*/
|
|
122
|
+
STATIC void
|
|
123
|
+
_rich_value_structure_write_rv_structures(lxw_rich_value_structure *self)
|
|
124
|
+
{
|
|
125
|
+
struct xml_attribute_list attributes;
|
|
126
|
+
struct xml_attribute *attribute;
|
|
127
|
+
char xmlns[] =
|
|
128
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2017/richdata";
|
|
129
|
+
|
|
130
|
+
LXW_INIT_ATTRIBUTES();
|
|
131
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
|
|
132
|
+
LXW_PUSH_ATTRIBUTES_STR("count", "1");
|
|
133
|
+
|
|
134
|
+
lxw_xml_start_tag(self->file, "rvStructures", &attributes);
|
|
135
|
+
|
|
136
|
+
/* Write the s element. */
|
|
137
|
+
_rich_value_structure_write_s(self);
|
|
138
|
+
|
|
139
|
+
LXW_FREE_ATTRIBUTES();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Assemble and write the XML file.
|
|
144
|
+
*/
|
|
145
|
+
void
|
|
146
|
+
lxw_rich_value_structure_assemble_xml_file(lxw_rich_value_structure *self)
|
|
147
|
+
{
|
|
148
|
+
/* Write the XML declaration. */
|
|
149
|
+
_rich_value_structure_xml_declaration(self);
|
|
150
|
+
|
|
151
|
+
/* Write the rvStructures element. */
|
|
152
|
+
_rich_value_structure_write_rv_structures(self);
|
|
153
|
+
|
|
154
|
+
lxw_xml_end_tag(self->file, "rvStructures");
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/*****************************************************************************
|
|
159
|
+
*
|
|
160
|
+
* Public functions.
|
|
161
|
+
*
|
|
162
|
+
****************************************************************************/
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* rich_value_types - A library for creating Excel XLSX rich_value_types files.
|
|
3
|
+
*
|
|
4
|
+
* Used in conjunction with the libxlsxwriter library.
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "xlsxwriter/xmlwriter.h"
|
|
11
|
+
#include "xlsxwriter/rich_value_types.h"
|
|
12
|
+
#include "xlsxwriter/utility.h"
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Forward declarations.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*****************************************************************************
|
|
19
|
+
*
|
|
20
|
+
* Private functions.
|
|
21
|
+
*
|
|
22
|
+
****************************************************************************/
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* Create a new rich_value_types object.
|
|
26
|
+
*/
|
|
27
|
+
lxw_rich_value_types *
|
|
28
|
+
lxw_rich_value_types_new(void)
|
|
29
|
+
{
|
|
30
|
+
lxw_rich_value_types *rich_value_types =
|
|
31
|
+
calloc(1, sizeof(lxw_rich_value_types));
|
|
32
|
+
GOTO_LABEL_ON_MEM_ERROR(rich_value_types, mem_error);
|
|
33
|
+
|
|
34
|
+
return rich_value_types;
|
|
35
|
+
|
|
36
|
+
mem_error:
|
|
37
|
+
lxw_rich_value_types_free(rich_value_types);
|
|
38
|
+
return NULL;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Free a rich_value_types object.
|
|
43
|
+
*/
|
|
44
|
+
void
|
|
45
|
+
lxw_rich_value_types_free(lxw_rich_value_types *rich_value_types)
|
|
46
|
+
{
|
|
47
|
+
if (!rich_value_types)
|
|
48
|
+
return;
|
|
49
|
+
|
|
50
|
+
free(rich_value_types);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/*****************************************************************************
|
|
54
|
+
*
|
|
55
|
+
* XML functions.
|
|
56
|
+
*
|
|
57
|
+
****************************************************************************/
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Write the XML declaration.
|
|
61
|
+
*/
|
|
62
|
+
STATIC void
|
|
63
|
+
_rich_value_types_xml_declaration(lxw_rich_value_types *self)
|
|
64
|
+
{
|
|
65
|
+
lxw_xml_declaration(self->file);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*****************************************************************************
|
|
69
|
+
*
|
|
70
|
+
* XML file assembly functions.
|
|
71
|
+
*
|
|
72
|
+
****************************************************************************/
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Write the <rvTypesInfo> element.
|
|
76
|
+
*/
|
|
77
|
+
STATIC void
|
|
78
|
+
_rich_value_types_write_rv_types_info(lxw_rich_value_types *self)
|
|
79
|
+
{
|
|
80
|
+
struct xml_attribute_list attributes;
|
|
81
|
+
struct xml_attribute *attribute;
|
|
82
|
+
char xmlns[] =
|
|
83
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2";
|
|
84
|
+
char xmlns_mc[] =
|
|
85
|
+
"http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
86
|
+
char xmlns_x[] =
|
|
87
|
+
"http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
88
|
+
char mc_ignorable[] = "x";
|
|
89
|
+
|
|
90
|
+
LXW_INIT_ATTRIBUTES();
|
|
91
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
|
|
92
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns:mc", xmlns_mc);
|
|
93
|
+
LXW_PUSH_ATTRIBUTES_STR("mc:Ignorable", mc_ignorable);
|
|
94
|
+
LXW_PUSH_ATTRIBUTES_STR("xmlns:x", xmlns_x);
|
|
95
|
+
|
|
96
|
+
lxw_xml_start_tag(self->file, "rvTypesInfo", &attributes);
|
|
97
|
+
|
|
98
|
+
LXW_FREE_ATTRIBUTES();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* Write the <flag> element.
|
|
103
|
+
*/
|
|
104
|
+
STATIC void
|
|
105
|
+
_rich_value_types_write_flag(lxw_rich_value_types *self, char *name)
|
|
106
|
+
{
|
|
107
|
+
struct xml_attribute_list attributes;
|
|
108
|
+
struct xml_attribute *attribute;
|
|
109
|
+
|
|
110
|
+
LXW_INIT_ATTRIBUTES();
|
|
111
|
+
LXW_PUSH_ATTRIBUTES_STR("name", name);
|
|
112
|
+
LXW_PUSH_ATTRIBUTES_STR("value", "1");
|
|
113
|
+
|
|
114
|
+
lxw_xml_empty_tag(self->file, "flag", &attributes);
|
|
115
|
+
|
|
116
|
+
LXW_FREE_ATTRIBUTES();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
* Write the <key> element.
|
|
121
|
+
*/
|
|
122
|
+
STATIC void
|
|
123
|
+
_rich_value_types_write_key(lxw_rich_value_types *self, char *name)
|
|
124
|
+
{
|
|
125
|
+
struct xml_attribute_list attributes;
|
|
126
|
+
struct xml_attribute *attribute;
|
|
127
|
+
|
|
128
|
+
LXW_INIT_ATTRIBUTES();
|
|
129
|
+
LXW_PUSH_ATTRIBUTES_STR("name", name);
|
|
130
|
+
|
|
131
|
+
lxw_xml_start_tag(self->file, "key", &attributes);
|
|
132
|
+
|
|
133
|
+
LXW_FREE_ATTRIBUTES();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* Write the <keyFlags> element.
|
|
138
|
+
*/
|
|
139
|
+
STATIC void
|
|
140
|
+
_rich_value_types_write_key_flags(lxw_rich_value_types *self)
|
|
141
|
+
{
|
|
142
|
+
int i;
|
|
143
|
+
char *key_flags[10][3] = {
|
|
144
|
+
{"_Self", "ExcludeFromFile", "ExcludeFromCalcComparison"},
|
|
145
|
+
{"_DisplayString", "ExcludeFromCalcComparison", ""},
|
|
146
|
+
{"_Flags", "ExcludeFromCalcComparison", ""},
|
|
147
|
+
{"_Format", "ExcludeFromCalcComparison", ""},
|
|
148
|
+
{"_SubLabel", "ExcludeFromCalcComparison", ""},
|
|
149
|
+
{"_Attribution", "ExcludeFromCalcComparison", ""},
|
|
150
|
+
{"_Icon", "ExcludeFromCalcComparison", ""},
|
|
151
|
+
{"_Display", "ExcludeFromCalcComparison", ""},
|
|
152
|
+
{"_CanonicalPropertyNames", "ExcludeFromCalcComparison", ""},
|
|
153
|
+
{"_ClassificationId", "ExcludeFromCalcComparison", ""},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
lxw_xml_start_tag(self->file, "global", NULL);
|
|
157
|
+
lxw_xml_start_tag(self->file, "keyFlags", NULL);
|
|
158
|
+
|
|
159
|
+
for (i = 0; i < 10; i++) {
|
|
160
|
+
char **flags = key_flags[i];
|
|
161
|
+
|
|
162
|
+
_rich_value_types_write_key(self, flags[0]);
|
|
163
|
+
_rich_value_types_write_flag(self, flags[1]);
|
|
164
|
+
|
|
165
|
+
if (*flags[2]) {
|
|
166
|
+
_rich_value_types_write_flag(self, flags[2]);
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
lxw_xml_end_tag(self->file, "key");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
lxw_xml_end_tag(self->file, "keyFlags");
|
|
174
|
+
lxw_xml_end_tag(self->file, "global");
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
* Assemble and write the XML file.
|
|
179
|
+
*/
|
|
180
|
+
void
|
|
181
|
+
lxw_rich_value_types_assemble_xml_file(lxw_rich_value_types *self)
|
|
182
|
+
{
|
|
183
|
+
/* Write the XML declaration. */
|
|
184
|
+
_rich_value_types_xml_declaration(self);
|
|
185
|
+
|
|
186
|
+
/* Write the rvTypesInfo element. */
|
|
187
|
+
_rich_value_types_write_rv_types_info(self);
|
|
188
|
+
|
|
189
|
+
/* Write the keyFlags element. */
|
|
190
|
+
_rich_value_types_write_key_flags(self);
|
|
191
|
+
|
|
192
|
+
lxw_xml_end_tag(self->file, "rvTypesInfo");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/*****************************************************************************
|
|
196
|
+
*
|
|
197
|
+
* Public functions.
|
|
198
|
+
*
|
|
199
|
+
****************************************************************************/
|
data/libxlsxwriter/src/styles.c
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used in conjunction with the libxlsxwriter library.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
7
|
+
* Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
|
|
7
8
|
*
|
|
8
9
|
*/
|
|
9
10
|
|
|
@@ -370,6 +371,23 @@ _write_font_family(lxw_styles *self, uint8_t font_family)
|
|
|
370
371
|
LXW_FREE_ATTRIBUTES();
|
|
371
372
|
}
|
|
372
373
|
|
|
374
|
+
/*
|
|
375
|
+
* Write the <charset> element.
|
|
376
|
+
*/
|
|
377
|
+
STATIC void
|
|
378
|
+
_write_font_charset(lxw_styles *self, uint8_t font_charset)
|
|
379
|
+
{
|
|
380
|
+
struct xml_attribute_list attributes;
|
|
381
|
+
struct xml_attribute *attribute;
|
|
382
|
+
|
|
383
|
+
LXW_INIT_ATTRIBUTES();
|
|
384
|
+
LXW_PUSH_ATTRIBUTES_INT("val", font_charset);
|
|
385
|
+
|
|
386
|
+
lxw_xml_empty_tag(self->file, "charset", &attributes);
|
|
387
|
+
|
|
388
|
+
LXW_FREE_ATTRIBUTES();
|
|
389
|
+
}
|
|
390
|
+
|
|
373
391
|
/*
|
|
374
392
|
* Write the <scheme> element.
|
|
375
393
|
*/
|
|
@@ -526,8 +544,11 @@ _write_font(lxw_styles *self, lxw_format *format, uint8_t is_dxf,
|
|
|
526
544
|
_write_font_name(self, format->font_name, is_rich_string);
|
|
527
545
|
_write_font_family(self, format->font_family);
|
|
528
546
|
|
|
547
|
+
if (format->font_charset)
|
|
548
|
+
_write_font_charset(self, format->font_charset);
|
|
549
|
+
|
|
529
550
|
/* Only write the scheme element for the default font type if it
|
|
530
|
-
*
|
|
551
|
+
* isn't a hyperlink. */
|
|
531
552
|
if ((!*format->font_name
|
|
532
553
|
|| strcmp(LXW_DEFAULT_FONT_NAME, format->font_name) == 0)
|
|
533
554
|
&& !format->hyperlink) {
|
|
@@ -1045,13 +1066,16 @@ _write_alignment(lxw_styles *self, lxw_format *format)
|
|
|
1045
1066
|
|
|
1046
1067
|
LXW_INIT_ATTRIBUTES();
|
|
1047
1068
|
|
|
1048
|
-
/* Indent is only allowed for
|
|
1069
|
+
/* Indent is only allowed for some alignment properties. */
|
|
1049
1070
|
/* If it is defined for any other alignment or no alignment has been */
|
|
1050
1071
|
/* set then default to left alignment. */
|
|
1051
1072
|
if (format->indent
|
|
1052
1073
|
&& format->text_h_align != LXW_ALIGN_LEFT
|
|
1053
1074
|
&& format->text_h_align != LXW_ALIGN_RIGHT
|
|
1054
|
-
&& format->text_h_align != LXW_ALIGN_DISTRIBUTED
|
|
1075
|
+
&& format->text_h_align != LXW_ALIGN_DISTRIBUTED
|
|
1076
|
+
&& format->text_v_align != LXW_ALIGN_VERTICAL_TOP
|
|
1077
|
+
&& format->text_v_align != LXW_ALIGN_VERTICAL_BOTTOM
|
|
1078
|
+
&& format->text_v_align != LXW_ALIGN_VERTICAL_DISTRIBUTED) {
|
|
1055
1079
|
format->text_h_align = LXW_ALIGN_LEFT;
|
|
1056
1080
|
}
|
|
1057
1081
|
|
|
@@ -1110,9 +1134,6 @@ _write_alignment(lxw_styles *self, lxw_format *format)
|
|
|
1110
1134
|
if (format->text_v_align == LXW_ALIGN_VERTICAL_DISTRIBUTED)
|
|
1111
1135
|
LXW_PUSH_ATTRIBUTES_STR("vertical", "distributed");
|
|
1112
1136
|
|
|
1113
|
-
if (format->indent)
|
|
1114
|
-
LXW_PUSH_ATTRIBUTES_INT("indent", format->indent);
|
|
1115
|
-
|
|
1116
1137
|
/* Map rotation to Excel values. */
|
|
1117
1138
|
if (rotation) {
|
|
1118
1139
|
if (rotation == 270)
|
|
@@ -1123,6 +1144,9 @@ _write_alignment(lxw_styles *self, lxw_format *format)
|
|
|
1123
1144
|
LXW_PUSH_ATTRIBUTES_INT("textRotation", rotation);
|
|
1124
1145
|
}
|
|
1125
1146
|
|
|
1147
|
+
if (format->indent)
|
|
1148
|
+
LXW_PUSH_ATTRIBUTES_INT("indent", format->indent);
|
|
1149
|
+
|
|
1126
1150
|
if (format->text_wrap)
|
|
1127
1151
|
LXW_PUSH_ATTRIBUTES_STR("wrapText", "1");
|
|
1128
1152
|
|
data/libxlsxwriter/src/table.c
CHANGED
data/libxlsxwriter/src/theme.c
CHANGED