fast_excel 0.4.1 → 0.5.0

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.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -7
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +1 -1
  5. data/examples/example.rb +2 -0
  6. data/examples/example_date_time.rb +38 -0
  7. data/fast_excel.gemspec +2 -2
  8. data/lib/fast_excel/binding/format.rb +17 -0
  9. data/lib/fast_excel/binding/workbook.rb +39 -17
  10. data/lib/fast_excel/binding/worksheet.rb +57 -13
  11. data/lib/fast_excel/binding.rb +7 -7
  12. data/lib/fast_excel.rb +27 -20
  13. data/libxlsxwriter/.github/FUNDING.yml +1 -0
  14. data/libxlsxwriter/.github/ISSUE_TEMPLATE.md +85 -0
  15. data/libxlsxwriter/.github/PULL_REQUEST_TEMPLATE.md +130 -0
  16. data/libxlsxwriter/.github/workflows/cmake_actions.yml +48 -0
  17. data/libxlsxwriter/.github/workflows/code_style.yml +23 -0
  18. data/libxlsxwriter/.github/workflows/coverity.yml +22 -0
  19. data/libxlsxwriter/.github/workflows/make_actions.yml +52 -0
  20. data/libxlsxwriter/.github/workflows/valgrind.yml +23 -0
  21. data/libxlsxwriter/.github/workflows/windows_build.yml +54 -0
  22. data/libxlsxwriter/.github/workflows/zig_build.yml +22 -0
  23. data/libxlsxwriter/.gitignore +16 -1
  24. data/libxlsxwriter/.indent.pro +24 -0
  25. data/libxlsxwriter/CMakeLists.txt +156 -56
  26. data/libxlsxwriter/CONTRIBUTING.md +2 -2
  27. data/libxlsxwriter/Changes.txt +344 -2
  28. data/libxlsxwriter/LICENSE.txt +66 -8
  29. data/libxlsxwriter/Makefile +151 -54
  30. data/libxlsxwriter/Package.swift +42 -0
  31. data/libxlsxwriter/Readme.md +4 -2
  32. data/libxlsxwriter/build.zig +324 -0
  33. data/libxlsxwriter/build.zig.zon +11 -0
  34. data/libxlsxwriter/cmake/FindMINIZIP.cmake +3 -3
  35. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +6 -0
  36. data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
  37. data/libxlsxwriter/include/xlsxwriter/chart.h +236 -32
  38. data/libxlsxwriter/include/xlsxwriter/chartsheet.h +7 -7
  39. data/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  40. data/libxlsxwriter/include/xlsxwriter/common.h +111 -50
  41. data/libxlsxwriter/include/xlsxwriter/content_types.h +8 -1
  42. data/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  43. data/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  44. data/libxlsxwriter/include/xlsxwriter/drawing.h +11 -20
  45. data/libxlsxwriter/include/xlsxwriter/format.h +121 -8
  46. data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  47. data/libxlsxwriter/include/xlsxwriter/metadata.h +49 -0
  48. data/libxlsxwriter/include/xlsxwriter/packager.h +27 -16
  49. data/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  50. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  51. data/libxlsxwriter/include/xlsxwriter/styles.h +13 -7
  52. data/libxlsxwriter/include/xlsxwriter/table.h +51 -0
  53. data/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  54. data/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h +26 -0
  55. data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +27 -25
  56. data/libxlsxwriter/include/xlsxwriter/third_party/md5.h +45 -0
  57. data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +155 -153
  58. data/libxlsxwriter/include/xlsxwriter/utility.h +70 -8
  59. data/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  60. data/libxlsxwriter/include/xlsxwriter/workbook.h +218 -47
  61. data/libxlsxwriter/include/xlsxwriter/worksheet.h +2770 -241
  62. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +12 -8
  63. data/libxlsxwriter/include/xlsxwriter.h +4 -2
  64. data/libxlsxwriter/libxlsxwriter.podspec +8 -5
  65. data/libxlsxwriter/src/Makefile +58 -21
  66. data/libxlsxwriter/src/app.c +5 -2
  67. data/libxlsxwriter/src/chart.c +396 -81
  68. data/libxlsxwriter/src/chartsheet.c +22 -22
  69. data/libxlsxwriter/src/comment.c +443 -0
  70. data/libxlsxwriter/src/content_types.c +40 -1
  71. data/libxlsxwriter/src/core.c +2 -2
  72. data/libxlsxwriter/src/custom.c +1 -1
  73. data/libxlsxwriter/src/drawing.c +160 -40
  74. data/libxlsxwriter/src/format.c +109 -25
  75. data/libxlsxwriter/src/hash_table.c +1 -1
  76. data/libxlsxwriter/src/metadata.c +283 -0
  77. data/libxlsxwriter/src/packager.c +794 -94
  78. data/libxlsxwriter/src/relationships.c +1 -1
  79. data/libxlsxwriter/src/shared_strings.c +2 -4
  80. data/libxlsxwriter/src/styles.c +353 -58
  81. data/libxlsxwriter/src/table.c +304 -0
  82. data/libxlsxwriter/src/theme.c +1 -1
  83. data/libxlsxwriter/src/utility.c +143 -43
  84. data/libxlsxwriter/src/vml.c +1062 -0
  85. data/libxlsxwriter/src/workbook.c +567 -77
  86. data/libxlsxwriter/src/worksheet.c +6668 -1462
  87. data/libxlsxwriter/src/xmlwriter.c +95 -5
  88. data/libxlsxwriter/third_party/dtoa/Makefile +42 -0
  89. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.c +461 -0
  90. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.h +26 -0
  91. data/libxlsxwriter/third_party/md5/Makefile +42 -0
  92. data/libxlsxwriter/third_party/md5/md5.c +291 -0
  93. data/libxlsxwriter/third_party/md5/md5.h +45 -0
  94. data/libxlsxwriter/third_party/minizip/Makefile +3 -8
  95. data/libxlsxwriter/third_party/minizip/Makefile.orig +8 -4
  96. data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +1 -1
  97. data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
  98. data/libxlsxwriter/third_party/minizip/crypt.h +13 -16
  99. data/libxlsxwriter/third_party/minizip/ioapi.c +31 -57
  100. data/libxlsxwriter/third_party/minizip/ioapi.h +31 -23
  101. data/libxlsxwriter/third_party/minizip/iowin32.c +29 -45
  102. data/libxlsxwriter/third_party/minizip/iowin32.h +4 -4
  103. data/libxlsxwriter/third_party/minizip/miniunz.c +29 -56
  104. data/libxlsxwriter/third_party/minizip/minizip.c +38 -49
  105. data/libxlsxwriter/third_party/minizip/mztools.c +1 -7
  106. data/libxlsxwriter/third_party/minizip/unzip.c +202 -342
  107. data/libxlsxwriter/third_party/minizip/unzip.h +74 -74
  108. data/libxlsxwriter/third_party/minizip/zip.c +165 -218
  109. data/libxlsxwriter/third_party/minizip/zip.h +164 -154
  110. data/libxlsxwriter/third_party/tmpfileplus/Makefile +3 -3
  111. data/libxlsxwriter/version.txt +1 -1
  112. data/test/auto_width_test.rb +20 -0
  113. data/test/default_format_test.rb +1 -1
  114. data/test/validations_test.rb +3 -3
  115. data/test/worksheet_test.rb +6 -1
  116. metadata +33 -7
  117. data/libxlsxwriter/.travis.yml +0 -37
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * xmlwriter - A libxlsxwriter library for creating Excel XLSX
7
7
  * XML files.
@@ -24,7 +24,7 @@
24
24
  #include <stdint.h>
25
25
  #include "utility.h"
26
26
 
27
- #define LXW_MAX_ATTRIBUTE_LENGTH 256
27
+ #define LXW_MAX_ATTRIBUTE_LENGTH 2080 /* Max URL length. */
28
28
  #define LXW_ATTR_32 32
29
29
 
30
30
  #define LXW_ATTRIBUTE_COPY(dst, src) \
@@ -55,7 +55,7 @@ STAILQ_HEAD(xml_attribute_list, xml_attribute);
55
55
  /* Create a new attribute struct to add to a xml_attribute_list. */
56
56
  struct xml_attribute *lxw_new_attribute_str(const char *key,
57
57
  const char *value);
58
- struct xml_attribute *lxw_new_attribute_int(const char *key, uint32_t value);
58
+ struct xml_attribute *lxw_new_attribute_int(const char *key, uint64_t value);
59
59
  struct xml_attribute *lxw_new_attribute_dbl(const char *key, double value);
60
60
 
61
61
  /* Macro to initialize the xml_attribute_list pointers. */
@@ -85,11 +85,13 @@ struct xml_attribute *lxw_new_attribute_dbl(const char *key, double value);
85
85
 
86
86
  /* Macro to free xml_attribute_list and attribute. */
87
87
  #define LXW_FREE_ATTRIBUTES() \
88
- while (!STAILQ_EMPTY(&attributes)) { \
89
- attribute = STAILQ_FIRST(&attributes); \
90
- STAILQ_REMOVE_HEAD(&attributes, list_entries); \
91
- free(attribute); \
92
- }
88
+ do { \
89
+ while (!STAILQ_EMPTY(&attributes)) { \
90
+ attribute = STAILQ_FIRST(&attributes); \
91
+ STAILQ_REMOVE_HEAD(&attributes, list_entries); \
92
+ free(attribute); \
93
+ } \
94
+ } while (0)
93
95
 
94
96
  /**
95
97
  * Create the XML declaration in an XML file.
@@ -167,7 +169,9 @@ void lxw_xml_data_element(FILE * xmlfile,
167
169
 
168
170
  void lxw_xml_rich_si_element(FILE * xmlfile, const char *string);
169
171
 
172
+ uint8_t lxw_has_control_characters(const char *string);
170
173
  char *lxw_escape_control_characters(const char *string);
174
+ char *lxw_escape_url_characters(const char *string, uint8_t escape_hash);
171
175
 
172
176
  char *lxw_escape_data(const char *data);
173
177
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -18,6 +18,8 @@
18
18
  #include "xlsxwriter/format.h"
19
19
  #include "xlsxwriter/utility.h"
20
20
 
21
- #define LXW_VERSION "0.8.6"
21
+ #define LXW_VERSION "1.1.5"
22
+ #define LXW_VERSION_ID 115
23
+ #define LXW_SOVERSION "5"
22
24
 
23
25
  #endif /* __LXW_XLSXWRITER_H__ */
@@ -1,8 +1,8 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "libxlsxwriter"
3
- s.version = "0.8.6"
3
+ s.version = "1.1.5"
4
4
  s.summary = "Libxlsxwriter: A C library for creating Excel XLSX files."
5
- s.ios.deployment_target = "6.0"
5
+ s.ios.deployment_target = "8.0"
6
6
  s.osx.deployment_target = "10.8"
7
7
 
8
8
  s.description = <<-DESC
@@ -17,7 +17,10 @@ Pod::Spec.new do |s|
17
17
  * Autofilters.
18
18
  * Charts.
19
19
  * Data validation and drop down lists.
20
- * Worksheet PNG/JPEG images.
20
+ * Conditional formatting.
21
+ * Worksheet PNG/JPEG/GIF images.
22
+ * Cell comments.
23
+ * Support for adding Macros.
21
24
  * Memory optimisation mode for writing large files.
22
25
  * Source code available on [GitHub](https://github.com/jmcnamara/libxlsxwriter).
23
26
  * FreeBSD license.
@@ -35,8 +38,8 @@ Pod::Spec.new do |s|
35
38
  s.author = { "John McNamara" => "jmcnamara@cpan.org" }
36
39
 
37
40
  s.source = { :git => "https://github.com/jmcnamara/libxlsxwriter.git", :tag => "RELEASE_" + s.version.to_s }
38
- s.source_files = "src/**/*.c", "third_party/**/{zip.c,ioapi.c,tmpfileplus.c}", "include/**/*.h"
39
-
41
+ s.source_files = "src/*.c", "third_party/**/{zip.c,ioapi.c,tmpfileplus.c,md5.c}", "include/**/*.h"
42
+ s.preserve_paths = [ 'third_party/**/*.h' ]
40
43
  s.header_dir = "xlsxwriter"
41
44
  s.header_mappings_dir = "include"
42
45
  s.library = "z"
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Makefile for libxlsxwriter library.
4
4
  #
5
- # Copyright 2014-2019, John McNamara, jmcnamara@cpan.org
5
+ # Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
6
6
  #
7
7
 
8
8
  # Keep the output quiet by default.
@@ -11,6 +11,13 @@ ifdef V
11
11
  Q=
12
12
  endif
13
13
 
14
+ DESTDIR ?=
15
+ PREFIX ?= /usr/local
16
+ OPT_LEVEL ?= -O3
17
+
18
+ SOVERSION = $(shell sed -n -e 's/.*LXW_SOVERSION \"\(.*\)\"/\1/p' ../include/xlsxwriter.h)
19
+
20
+
14
21
  # Directory variables.
15
22
  OBJS_DIR = .
16
23
  INC_DIR = ../include
@@ -27,7 +34,6 @@ MINIZIP_OBJ = $(MINIZIP_DIR)/ioapi.o $(MINIZIP_DIR)/zip.o
27
34
  MINIZIP_SO = $(MINIZIP_DIR)/ioapi.so $(MINIZIP_DIR)/zip.so
28
35
  endif
29
36
 
30
-
31
37
  ifdef USE_STANDARD_TMPFILE
32
38
  # Use standard/C tmpfile().
33
39
  CFLAGS += -DUSE_STANDARD_TMPFILE
@@ -38,24 +44,45 @@ TMPFILEPLUS_OBJ = $(TMPFILEPLUS_DIR)/tmpfileplus.o
38
44
  TMPFILEPLUS_SO = $(TMPFILEPLUS_DIR)/tmpfileplus.so
39
45
  endif
40
46
 
47
+ ifdef USE_NO_MD5
48
+ # Don't use MD5 to avoid duplicate image files.
49
+ CFLAGS += -DUSE_NO_MD5
50
+ else
51
+ ifdef USE_OPENSSL_MD5
52
+ CFLAGS += -DUSE_OPENSSL_MD5 -Wno-deprecated-declarations
53
+ LIBS += -lcrypto
54
+ else
55
+ # Use md5 (the default).
56
+ MD5_DIR = ../third_party/md5
57
+ MD5_OBJ = $(MD5_DIR)/md5.o
58
+ MD5_SO = $(MD5_DIR)/md5.so
59
+ endif
60
+ endif
61
+
41
62
  # Set flag for big endian architecture.
42
63
  ifdef USE_BIG_ENDIAN
43
64
  CFLAGS += -DLXW_BIG_ENDIAN
44
65
  endif
45
66
 
46
- # Use a user-defined double number formatting function.
47
- ifdef USE_DOUBLE_FUNCTION
48
- CFLAGS += -DUSE_DOUBLE_FUNCTION
67
+ # Use a third party double number formatting function.
68
+ ifdef USE_DTOA_LIBRARY
69
+ CFLAGS += -DUSE_DTOA_LIBRARY
70
+ DTOA_LIB_DIR = ../third_party/dtoa
71
+ DTOA_LIB_OBJ = $(DTOA_LIB_DIR)/emyg_dtoa.o
72
+ DTOA_LIB_SO = $(DTOA_LIB_DIR)/emyg_dtoa.so
49
73
  endif
50
74
 
51
- # Flags passed to compiler.
52
- CFLAGS += -g -O3 -Wall -Wextra -pedantic -ansi
75
+ # Use fmemopen()/open_memstream() to avoid creating temporary files
76
+ ifdef USE_MEM_FILE
77
+ USE_FMEMOPEN = 1
78
+ endif
53
79
 
54
- # Fix for modified zconf.h on Gentoo.
55
- ifneq (,$(findstring gentoo, $(shell uname -sr)))
56
- CFLAGS += -DOF=_Z_OF
80
+ ifdef USE_FMEMOPEN
81
+ CFLAGS += -DUSE_FMEMOPEN
57
82
  endif
58
83
 
84
+ # Flags passed to compiler.
85
+ CFLAGS += -g $(OPT_LEVEL) -Wall -Wextra -Wstrict-prototypes -pedantic -ansi
59
86
 
60
87
  # Ignore icc remarks about inlining limits.
61
88
  ifeq ($(CC),icc)
@@ -64,7 +91,7 @@ endif
64
91
 
65
92
  # Library names.
66
93
  LIBXLSXWRITER_A = libxlsxwriter.a
67
- LIBXLSXWRITER_SO = libxlsxwriter.so
94
+ LIBXLSXWRITER_SO = libxlsxwriter.so.$(SOVERSION)
68
95
 
69
96
  # Library with additional non-static functions for testing.
70
97
  LIBXLSXWRITER_TO = libxlsxwriter_test.a
@@ -74,15 +101,15 @@ ARFLAGS = rc
74
101
 
75
102
  # Flags passed to dynamic linker.
76
103
  FPIC = -fPIC
77
- SOFLAGS = -shared $(FPIC)
104
+ SOFLAGS = -shared $(FPIC) -Wl,-soname,$(LIBXLSXWRITER_SO)
78
105
 
79
106
  # Get Env/OS name.
80
107
  UNAME := $(shell uname)
81
108
 
82
109
  # Change make options on OS X.
83
110
  ifeq ($(UNAME), Darwin)
84
- LIBXLSXWRITER_SO = libxlsxwriter.dylib
85
- SOFLAGS = -dynamiclib $(FPIC) -install_name /usr/lib/$(LIBXLSXWRITER_SO)
111
+ LIBXLSXWRITER_SO = libxlsxwriter.$(SOVERSION).dylib
112
+ SOFLAGS = -dynamiclib $(FPIC) -compatibility_version $(SOVERSION) -install_name $(PREFIX)/lib/$(LIBXLSXWRITER_SO) $(GCOV)
86
113
  endif
87
114
 
88
115
  # Check for MinGW/MinGW64/Cygwin environments.
@@ -118,11 +145,21 @@ TOBJS = $(patsubst %.c,%.to,$(SRCS))
118
145
  all : $(LIBXLSXWRITER_A) $(LIBXLSXWRITER_SO)
119
146
  $(Q)cp $(LIBXLSXWRITER_A) $(LIBXLSXWRITER_SO) ../lib
120
147
 
148
+ ifeq ($(UNAME), Darwin)
149
+ $(Q)rm -f ../lib/libxlsxwriter.dylib
150
+ $(Q)ln -s $(LIBXLSXWRITER_SO) ../lib/libxlsxwriter.dylib
151
+ endif
152
+
153
+ ifneq ($(UNAME), Darwin)
154
+ $(Q)rm -f ../lib/libxlsxwriter.so
155
+ $(Q)ln -s $(LIBXLSXWRITER_SO) ../lib/libxlsxwriter.so
156
+ endif
157
+
121
158
  test_lib : libxlsxwriter_test.a
122
159
 
123
160
  # The static library.
124
161
  $(LIBXLSXWRITER_A) : $(OBJS)
125
- $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $^
162
+ $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $(DTOA_LIB_OBJ) $(MD5_OBJ) $^
126
163
 
127
164
  # The dynamic library.
128
165
  ifeq ($(findstring m32,$(CFLAGS)),m32)
@@ -130,26 +167,26 @@ ARCH = -m32
130
167
  endif
131
168
 
132
169
  $(LIBXLSXWRITER_SO) : $(SOBJS)
133
- $(Q)$(CC) $(LDFLAGS) $(SOFLAGS) $(ARCH) -o $@ $(MINIZIP_SO) $(TMPFILEPLUS_SO) $^ $(LIBS)
170
+ $(Q)$(CC) $(LDFLAGS) $(SOFLAGS) $(ARCH) $(TARGET_ARCH) -o $@ $(MINIZIP_SO) $(TMPFILEPLUS_SO) $(MD5_SO) $(DTOA_LIB_SO) $^ $(LIBS)
134
171
 
135
172
  # The test library.
136
173
  $(LIBXLSXWRITER_TO) : $(TOBJS)
137
- $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $^
174
+ $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $(DTOA_LIB_SO) $(MD5_OBJ) $^
138
175
 
139
176
  # Minimal target for quick compile without creating the libs.
140
177
  test_compile : $(OBJS)
141
178
 
142
179
  # Targets for the object files.
143
180
  %.o : %.c $(HDRS)
144
- $(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) -c $<
181
+ $(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) $(GCOV) -c $<
145
182
 
146
183
  %.so : %.c $(HDRS)
147
- $(Q)$(CC) $(FPIC) -I$(INC_DIR) $(LDFLAGS) $(CFLAGS) $(CXXFLAGS) -c $< -o $@
184
+ $(Q)$(CC) $(FPIC) -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) $(GCOV) -c $< -o $@
148
185
 
149
186
  %.to : %.c $(HDRS)
150
- $(Q)$(CC) -g -O3 -DTESTING -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) -c $< -o $@
187
+ $(Q)$(CC) -g $(OPT_LEVEL) -DTESTING -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(GCOV) -c $< -o $@
151
188
 
152
189
 
153
190
  # Clean up any temp/build files.
154
191
  clean :
155
- $(Q)rm -f *.o *.a *.so *.to *.dylib *.dll
192
+ $(Q)rm -f *.o *.a *.so *.so.* *.to *.dylib *.dll *.gcno *.gcda
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Used in conjunction with the libxlsxwriter library.
5
5
  *
6
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
6
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
7
7
  *
8
8
  */
9
9
 
@@ -132,7 +132,10 @@ _write_application(lxw_app *self)
132
132
  STATIC void
133
133
  _write_doc_security(lxw_app *self)
134
134
  {
135
- lxw_xml_data_element(self->file, "DocSecurity", "0", NULL);
135
+ if (self->doc_security == 2)
136
+ lxw_xml_data_element(self->file, "DocSecurity", "2", NULL);
137
+ else
138
+ lxw_xml_data_element(self->file, "DocSecurity", "0", NULL);
136
139
  }
137
140
 
138
141
  /*