fast_excel 0.2.2 → 0.4.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 (100) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +2 -0
  3. data/.gitignore +7 -0
  4. data/.travis.yml +32 -9
  5. data/CHANGELOG.md +36 -1
  6. data/Dockerfile.test +17 -0
  7. data/Gemfile +2 -1
  8. data/Gemfile.lock +33 -24
  9. data/LICENSE +21 -0
  10. data/Makefile +13 -0
  11. data/README.md +177 -40
  12. data/Rakefile +11 -1
  13. data/benchmarks/1k_rows.rb +17 -4
  14. data/benchmarks/20k_rows.rb +4 -0
  15. data/benchmarks/auto_width.rb +37 -0
  16. data/benchmarks/init.rb +14 -2
  17. data/benchmarks/memory.rb +8 -0
  18. data/benchmarks/profiler.rb +27 -0
  19. data/benchmarks/write_value.rb +62 -0
  20. data/examples/example.rb +3 -3
  21. data/examples/example_auto_width.rb +26 -0
  22. data/examples/example_filters.rb +36 -0
  23. data/examples/example_formula.rb +1 -3
  24. data/examples/example_hyperlink.rb +20 -0
  25. data/ext/fast_excel/extconf.rb +3 -0
  26. data/ext/fast_excel/text_width_ext.c +460 -0
  27. data/fast_excel.gemspec +3 -4
  28. data/letters.html +114 -0
  29. data/lib/fast_excel.rb +131 -25
  30. data/lib/fast_excel/binding.rb +33 -21
  31. data/lib/fast_excel/binding/chart.rb +20 -1
  32. data/lib/fast_excel/binding/format.rb +11 -4
  33. data/lib/fast_excel/binding/workbook.rb +10 -2
  34. data/lib/fast_excel/binding/worksheet.rb +44 -27
  35. data/libxlsxwriter/.gitignore +1 -0
  36. data/libxlsxwriter/.indent.pro +8 -0
  37. data/libxlsxwriter/.travis.yml +12 -0
  38. data/libxlsxwriter/CMakeLists.txt +338 -0
  39. data/libxlsxwriter/CONTRIBUTING.md +1 -1
  40. data/libxlsxwriter/Changes.txt +162 -0
  41. data/libxlsxwriter/LICENSE.txt +65 -4
  42. data/libxlsxwriter/Makefile +33 -11
  43. data/libxlsxwriter/Readme.md +3 -1
  44. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +2 -1
  45. data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +2 -2
  46. data/libxlsxwriter/include/xlsxwriter.h +2 -2
  47. data/libxlsxwriter/include/xlsxwriter/app.h +2 -2
  48. data/libxlsxwriter/include/xlsxwriter/chart.h +164 -13
  49. data/libxlsxwriter/include/xlsxwriter/chartsheet.h +544 -0
  50. data/libxlsxwriter/include/xlsxwriter/common.h +35 -6
  51. data/libxlsxwriter/include/xlsxwriter/content_types.h +5 -2
  52. data/libxlsxwriter/include/xlsxwriter/core.h +2 -2
  53. data/libxlsxwriter/include/xlsxwriter/custom.h +2 -2
  54. data/libxlsxwriter/include/xlsxwriter/drawing.h +3 -2
  55. data/libxlsxwriter/include/xlsxwriter/format.h +8 -8
  56. data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  57. data/libxlsxwriter/include/xlsxwriter/packager.h +18 -8
  58. data/libxlsxwriter/include/xlsxwriter/relationships.h +2 -2
  59. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +5 -3
  60. data/libxlsxwriter/include/xlsxwriter/styles.h +10 -5
  61. data/libxlsxwriter/include/xlsxwriter/theme.h +2 -2
  62. data/libxlsxwriter/include/xlsxwriter/utility.h +35 -5
  63. data/libxlsxwriter/include/xlsxwriter/workbook.h +234 -57
  64. data/libxlsxwriter/include/xlsxwriter/worksheet.h +780 -91
  65. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
  66. data/libxlsxwriter/libxlsxwriter.podspec +4 -2
  67. data/libxlsxwriter/src/Makefile +31 -6
  68. data/libxlsxwriter/src/app.c +2 -2
  69. data/libxlsxwriter/src/chart.c +116 -23
  70. data/libxlsxwriter/src/chartsheet.c +508 -0
  71. data/libxlsxwriter/src/content_types.c +12 -4
  72. data/libxlsxwriter/src/core.c +11 -11
  73. data/libxlsxwriter/src/custom.c +3 -3
  74. data/libxlsxwriter/src/drawing.c +114 -17
  75. data/libxlsxwriter/src/format.c +5 -5
  76. data/libxlsxwriter/src/hash_table.c +1 -1
  77. data/libxlsxwriter/src/packager.c +378 -61
  78. data/libxlsxwriter/src/relationships.c +2 -2
  79. data/libxlsxwriter/src/shared_strings.c +18 -4
  80. data/libxlsxwriter/src/styles.c +59 -12
  81. data/libxlsxwriter/src/theme.c +2 -2
  82. data/libxlsxwriter/src/utility.c +93 -6
  83. data/libxlsxwriter/src/workbook.c +379 -61
  84. data/libxlsxwriter/src/worksheet.c +1240 -174
  85. data/libxlsxwriter/src/xmlwriter.c +18 -9
  86. data/libxlsxwriter/third_party/minizip/Makefile +6 -1
  87. data/libxlsxwriter/third_party/minizip/ioapi.c +10 -0
  88. data/libxlsxwriter/third_party/minizip/zip.c +2 -0
  89. data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +2 -2
  90. data/libxlsxwriter/version.txt +1 -1
  91. data/test/auto_width_test.rb +19 -0
  92. data/test/date_test.rb +34 -0
  93. data/test/format_test.rb +8 -0
  94. data/test/reopen_test.rb +22 -0
  95. data/test/test_helper.rb +8 -5
  96. data/test/text_width_test.rb +80 -0
  97. data/test/tmpfile_test.rb +1 -0
  98. data/test/validations_test.rb +47 -0
  99. data/test/worksheet_test.rb +44 -1
  100. metadata +33 -9
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @brief Common functions and defines for the libxlsxwriter library.
11
11
  *
12
- * <!-- Copyright 2014-2017, John McNamara, jmcnamara@cpan.org -->
12
+ * <!-- Copyright 2014-2019, John McNamara, jmcnamara@cpan.org -->
13
13
  *
14
14
  */
15
15
  #ifndef __LXW_COMMON_H__
@@ -65,13 +65,25 @@ typedef enum lxw_error {
65
65
  /** Error encountered when creating a tmpfile during file assembly. */
66
66
  LXW_ERROR_CREATING_TMPFILE,
67
67
 
68
- /** Zlib error with a file operation while creating xlsx file. */
68
+ /** Error reading a tmpfile. */
69
+ LXW_ERROR_READING_TMPFILE,
70
+
71
+ /** Zip generic error ZIP_ERRNO while creating the xlsx file. */
69
72
  LXW_ERROR_ZIP_FILE_OPERATION,
70
73
 
71
- /** Zlib error when adding sub file to xlsx file. */
74
+ /** Zip error ZIP_PARAMERROR while creating the xlsx file. */
75
+ LXW_ERROR_ZIP_PARAMETER_ERROR,
76
+
77
+ /** Zip error ZIP_BADZIPFILE (use_zip64 option may be required). */
78
+ LXW_ERROR_ZIP_BAD_ZIP_FILE,
79
+
80
+ /** Zip error ZIP_INTERNALERROR while creating the xlsx file. */
81
+ LXW_ERROR_ZIP_INTERNAL_ERROR,
82
+
83
+ /** File error or unknown zip error when adding sub file to xlsx file. */
72
84
  LXW_ERROR_ZIP_FILE_ADD,
73
85
 
74
- /** Zlib error when closing xlsx file. */
86
+ /** Unknown zip error when closing xlsx file. */
75
87
  LXW_ERROR_ZIP_CLOSE,
76
88
 
77
89
  /** NULL function parameter ignored. */
@@ -83,12 +95,21 @@ typedef enum lxw_error {
83
95
  /** Worksheet name exceeds Excel's limit of 31 characters. */
84
96
  LXW_ERROR_SHEETNAME_LENGTH_EXCEEDED,
85
97
 
86
- /** Worksheet name contains invalid Excel character: '[]:*?/\\' */
98
+ /** Worksheet name cannot contain invalid characters: '[ ] : * ? / \\' */
87
99
  LXW_ERROR_INVALID_SHEETNAME_CHARACTER,
88
100
 
101
+ /** Worksheet name cannot start or end with an apostrophe. */
102
+ LXW_ERROR_SHEETNAME_START_END_APOSTROPHE,
103
+
89
104
  /** Worksheet name is already in use. */
90
105
  LXW_ERROR_SHEETNAME_ALREADY_USED,
91
106
 
107
+ /** Worksheet name 'History' is reserved by Excel. */
108
+ LXW_ERROR_SHEETNAME_RESERVED,
109
+
110
+ /** Parameter exceeds Excel's limit of 32 characters. */
111
+ LXW_ERROR_32_STRING_LENGTH_EXCEEDED,
112
+
92
113
  /** Parameter exceeds Excel's limit of 128 characters. */
93
114
  LXW_ERROR_128_STRING_LENGTH_EXCEEDED,
94
115
 
@@ -174,6 +195,9 @@ enum lxw_custom_property_types {
174
195
  #define LXW_FILENAME_LENGTH 128
175
196
  #define LXW_IGNORE 1
176
197
 
198
+ #define LXW_PORTRAIT 1
199
+ #define LXW_LANDSCAPE 0
200
+
177
201
  #define LXW_SCHEMA_MS "http://schemas.microsoft.com/office/2006/relationships"
178
202
  #define LXW_SCHEMA_ROOT "http://schemas.openxmlformats.org"
179
203
  #define LXW_SCHEMA_DRAWING LXW_SCHEMA_ROOT "/drawingml/2006"
@@ -265,9 +289,14 @@ enum lxw_custom_property_types {
265
289
  (((n) & 0xFF0000) >> 8) | \
266
290
  (((n) & 0xFF000000) >> 24))
267
291
  #define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
292
+ #define LXW_UINT32_HOST(n) (n)
268
293
  #else
269
294
  #define LXW_UINT32_NETWORK(n) (n)
270
295
  #define LXW_UINT16_NETWORK(n) (n)
296
+ #define LXW_UINT32_HOST(n) ((((n) & 0xFF) << 24) | \
297
+ (((n) & 0xFF00) << 8) | \
298
+ (((n) & 0xFF0000) >> 8) | \
299
+ (((n) & 0xFF000000) >> 24))
271
300
  #endif
272
301
 
273
302
  /* *INDENT-OFF* */
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * content_types - A libxlsxwriter library for creating Excel XLSX
7
7
  * content_types files.
@@ -17,6 +17,7 @@
17
17
 
18
18
  #define LXW_APP_PACKAGE "application/vnd.openxmlformats-package."
19
19
  #define LXW_APP_DOCUMENT "application/vnd.openxmlformats-officedocument."
20
+ #define LXW_APP_MSEXCEL "application/vnd.ms-excel."
20
21
 
21
22
  /*
22
23
  * Struct to represent a content_types.
@@ -37,7 +38,7 @@ extern "C" {
37
38
  #endif
38
39
  /* *INDENT-ON* */
39
40
 
40
- lxw_content_types *lxw_content_types_new();
41
+ lxw_content_types *lxw_content_types_new(void);
41
42
  void lxw_content_types_free(lxw_content_types *content_types);
42
43
  void lxw_content_types_assemble_xml_file(lxw_content_types *content_types);
43
44
  void lxw_ct_add_default(lxw_content_types *content_types, const char *key,
@@ -46,6 +47,8 @@ void lxw_ct_add_override(lxw_content_types *content_types, const char *key,
46
47
  const char *value);
47
48
  void lxw_ct_add_worksheet_name(lxw_content_types *content_types,
48
49
  const char *name);
50
+ void lxw_ct_add_chartsheet_name(lxw_content_types *content_types,
51
+ const char *name);
49
52
  void lxw_ct_add_chart_name(lxw_content_types *content_types,
50
53
  const char *name);
51
54
  void lxw_ct_add_drawing_name(lxw_content_types *content_types,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * core - A libxlsxwriter library for creating Excel XLSX core files.
7
7
  *
@@ -31,7 +31,7 @@ extern "C" {
31
31
  #endif
32
32
  /* *INDENT-ON* */
33
33
 
34
- lxw_core *lxw_core_new();
34
+ lxw_core *lxw_core_new(void);
35
35
  void lxw_core_free(lxw_core *core);
36
36
  void lxw_core_assemble_xml_file(lxw_core *self);
37
37
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * custom - A libxlsxwriter library for creating Excel custom property files.
7
7
  *
@@ -32,7 +32,7 @@ extern "C" {
32
32
  #endif
33
33
  /* *INDENT-ON* */
34
34
 
35
- lxw_custom *lxw_custom_new();
35
+ lxw_custom *lxw_custom_new(void);
36
36
  void lxw_custom_free(lxw_custom *custom);
37
37
  void lxw_custom_assemble_xml_file(lxw_custom *self);
38
38
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
7
7
  *
@@ -77,6 +77,7 @@ typedef struct lxw_drawing {
77
77
  FILE *file;
78
78
 
79
79
  uint8_t embedded;
80
+ uint8_t orientation;
80
81
 
81
82
  struct lxw_drawing_objects *drawing_objects;
82
83
 
@@ -89,7 +90,7 @@ extern "C" {
89
90
  #endif
90
91
  /* *INDENT-ON* */
91
92
 
92
- lxw_drawing *lxw_drawing_new();
93
+ lxw_drawing *lxw_drawing_new(void);
93
94
  void lxw_drawing_free(lxw_drawing *drawing);
94
95
  void lxw_drawing_assemble_xml_file(lxw_drawing *self);
95
96
  void lxw_free_drawing_object(struct lxw_drawing_object *drawing_object);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -81,8 +81,8 @@ typedef int32_t lxw_color_t;
81
81
  #define LXW_PROPERTY_UNSET -1
82
82
  #define LXW_COLOR_UNSET -1
83
83
  #define LXW_COLOR_MASK 0xFFFFFF
84
- #define LXW_MIN_FONT_SIZE 1
85
- #define LXW_MAX_FONT_SIZE 409
84
+ #define LXW_MIN_FONT_SIZE 1.0
85
+ #define LXW_MAX_FONT_SIZE 409.0
86
86
 
87
87
  #define LXW_FORMAT_FIELD_COPY(dst, src) \
88
88
  do{ \
@@ -360,7 +360,7 @@ typedef struct lxw_format {
360
360
  uint16_t font_index;
361
361
  uint8_t has_font;
362
362
  uint8_t has_dxf_font;
363
- uint16_t font_size;
363
+ double font_size;
364
364
  uint8_t bold;
365
365
  uint8_t italic;
366
366
  lxw_color_t font_color;
@@ -427,7 +427,7 @@ typedef struct lxw_format {
427
427
  typedef struct lxw_font {
428
428
 
429
429
  char font_name[LXW_FORMAT_FIELD_LEN];
430
- uint16_t font_size;
430
+ double font_size;
431
431
  uint8_t bold;
432
432
  uint8_t italic;
433
433
  uint8_t underline;
@@ -480,7 +480,7 @@ extern "C" {
480
480
  #endif
481
481
  /* *INDENT-ON* */
482
482
 
483
- lxw_format *lxw_format_new();
483
+ lxw_format *lxw_format_new(void);
484
484
  void lxw_format_free(lxw_format *format);
485
485
  int32_t lxw_format_get_xf_index(lxw_format *format);
486
486
  lxw_font *lxw_format_get_font_key(lxw_format *format);
@@ -529,7 +529,7 @@ void format_set_font_name(lxw_format *format, const char *font_name);
529
529
  * size in the row. You can also explicitly specify the height of a
530
530
  * row using the worksheet_set_row() function.
531
531
  */
532
- void format_set_font_size(lxw_format *format, uint16_t size);
532
+ void format_set_font_size(lxw_format *format, double size);
533
533
 
534
534
  /**
535
535
  * @brief Set the color of the font used in the cell.
@@ -691,7 +691,7 @@ void format_set_num_format(lxw_format *format, const char *num_format);
691
691
  *
692
692
  * @code
693
693
  * format = workbook_add_format(workbook);
694
- * format_set_num_format(format, 0x0F); // d-mmm-yy
694
+ * format_set_num_format_index(format, 0x0F); // d-mmm-yy
695
695
  * @endcode
696
696
  *
697
697
  * @note
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * hash_table - Hash table functions for libxlsxwriter.
7
7
  *
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * packager - A libxlsxwriter library for creating Excel XLSX packager files.
7
7
  *
@@ -10,7 +10,12 @@
10
10
  #define __LXW_PACKAGER_H__
11
11
 
12
12
  #include <stdint.h>
13
+
14
+ #ifdef USE_SYSTEM_MINIZIP
15
+ #include "minizip/zip.h"
16
+ #else
13
17
  #include "third_party/zip.h"
18
+ #endif
14
19
 
15
20
  #include "common.h"
16
21
  #include "workbook.h"
@@ -27,11 +32,17 @@
27
32
 
28
33
  #define LXW_ZIP_BUFFER_SIZE (16384)
29
34
 
30
- /* If zlib returns Z_ERRNO then errno is set and we can trap that. Otherwise
31
- * return a default libxlsxwriter error. */
35
+ /* If zip returns a ZIP_XXX error then errno is set and we can trap that in
36
+ * workbook.c. Otherwise return a default libxlsxwriter error. */
32
37
  #define RETURN_ON_ZIP_ERROR(err, default_err) \
33
- if (err == Z_ERRNO) \
38
+ if (err == ZIP_ERRNO) \
34
39
  return LXW_ERROR_ZIP_FILE_OPERATION; \
40
+ else if (err == ZIP_PARAMERROR) \
41
+ return LXW_ERROR_ZIP_PARAMETER_ERROR; \
42
+ else if (err == ZIP_BADZIPFILE) \
43
+ return LXW_ERROR_ZIP_BAD_ZIP_FILE; \
44
+ else if (err == ZIP_INTERNALERROR) \
45
+ return LXW_ERROR_ZIP_INTERNAL_ERROR; \
35
46
  else \
36
47
  return default_err;
37
48
 
@@ -49,9 +60,7 @@ typedef struct lxw_packager {
49
60
  char *filename;
50
61
  char *buffer;
51
62
  char *tmpdir;
52
-
53
- uint16_t chart_count;
54
- uint16_t drawing_count;
63
+ uint8_t use_zip64;
55
64
 
56
65
  } lxw_packager;
57
66
 
@@ -62,7 +71,8 @@ extern "C" {
62
71
  #endif
63
72
  /* *INDENT-ON* */
64
73
 
65
- lxw_packager *lxw_packager_new(const char *filename, char *tmpdir);
74
+ lxw_packager *lxw_packager_new(const char *filename, char *tmpdir,
75
+ uint8_t use_zip64);
66
76
  void lxw_packager_free(lxw_packager *packager);
67
77
  lxw_error lxw_create_package(lxw_packager *self);
68
78
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * relationships - A libxlsxwriter library for creating Excel XLSX
7
7
  * relationships files.
@@ -47,7 +47,7 @@ extern "C" {
47
47
  #endif
48
48
  /* *INDENT-ON* */
49
49
 
50
- lxw_relationships *lxw_relationships_new();
50
+ lxw_relationships *lxw_relationships_new(void);
51
51
  void lxw_free_relationships(lxw_relationships *relationships);
52
52
  void lxw_relationships_assemble_xml_file(lxw_relationships *self);
53
53
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * shared_strings - A libxlsxwriter library for creating Excel XLSX
7
7
  * sst files.
@@ -37,6 +37,7 @@ STAILQ_HEAD(sst_order_list, sst_element);
37
37
  struct sst_element {
38
38
  uint32_t index;
39
39
  char *string;
40
+ uint8_t is_rich_string;
40
41
 
41
42
  STAILQ_ENTRY (sst_element) sst_order_pointers;
42
43
  RB_ENTRY (sst_element) sst_tree_pointers;
@@ -62,9 +63,10 @@ extern "C" {
62
63
  #endif
63
64
  /* *INDENT-ON* */
64
65
 
65
- lxw_sst *lxw_sst_new();
66
+ lxw_sst *lxw_sst_new(void);
66
67
  void lxw_sst_free(lxw_sst *sst);
67
- struct sst_element *lxw_get_sst_index(lxw_sst *sst, const char *string);
68
+ struct sst_element *lxw_get_sst_index(lxw_sst *sst, const char *string,
69
+ uint8_t is_rich_string);
68
70
  void lxw_sst_assemble_xml_file(lxw_sst *self);
69
71
 
70
72
  /* Declarations required for unit testing. */
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * styles - A libxlsxwriter library for creating Excel XLSX styles files.
7
7
  *
@@ -10,6 +10,7 @@
10
10
  #define __LXW_STYLES_H__
11
11
 
12
12
  #include <stdint.h>
13
+ #include <ctype.h>
13
14
 
14
15
  #include "format.h"
15
16
 
@@ -37,21 +38,25 @@ extern "C" {
37
38
  #endif
38
39
  /* *INDENT-ON* */
39
40
 
40
- lxw_styles *lxw_styles_new();
41
+ lxw_styles *lxw_styles_new(void);
41
42
  void lxw_styles_free(lxw_styles *styles);
42
43
  void lxw_styles_assemble_xml_file(lxw_styles *self);
44
+ void lxw_styles_write_string_fragment(lxw_styles *self, char *string);
45
+ void lxw_styles_write_rich_font(lxw_styles *lxw_styles, lxw_format *format);
43
46
 
44
47
  /* Declarations required for unit testing. */
45
48
  #ifdef TESTING
46
49
 
47
50
  STATIC void _styles_xml_declaration(lxw_styles *self);
48
51
  STATIC void _write_style_sheet(lxw_styles *self);
49
- STATIC void _write_font_size(lxw_styles *self, uint16_t font_size);
52
+ STATIC void _write_font_size(lxw_styles *self, double font_size);
50
53
  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);
54
+ STATIC void _write_font_name(lxw_styles *self, const char *font_name,
55
+ uint8_t is_rich_string);
52
56
  STATIC void _write_font_family(lxw_styles *self, uint8_t font_family);
53
57
  STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme);
54
- STATIC void _write_font(lxw_styles *self, lxw_format *format);
58
+ STATIC void _write_font(lxw_styles *self, lxw_format *format,
59
+ uint8_t is_rich_string);
55
60
  STATIC void _write_fonts(lxw_styles *self);
56
61
  STATIC void _write_default_fill(lxw_styles *self, const char *pattern);
57
62
  STATIC void _write_fills(lxw_styles *self);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * theme - A libxlsxwriter library for creating Excel XLSX theme files.
7
7
  *
@@ -28,7 +28,7 @@ extern "C" {
28
28
  #endif
29
29
  /* *INDENT-ON* */
30
30
 
31
- lxw_theme *lxw_theme_new();
31
+ lxw_theme *lxw_theme_new(void);
32
32
  void lxw_theme_free(lxw_theme *theme);
33
33
  void lxw_theme_xml_declaration(lxw_theme *self);
34
34
  void lxw_theme_assemble_xml_file(lxw_theme *self);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @brief Utility functions for libxlsxwriter.
11
11
  *
12
- * <!-- Copyright 2014-2017, John McNamara, jmcnamara@cpan.org -->
12
+ * <!-- Copyright 2014-2019, John McNamara, jmcnamara@cpan.org -->
13
13
  *
14
14
  */
15
15
 
@@ -17,7 +17,9 @@
17
17
  #define __LXW_UTILITY_H__
18
18
 
19
19
  #include <stdint.h>
20
+ #include <strings.h>
20
21
  #include "common.h"
22
+ #include "xmlwriter.h"
21
23
 
22
24
  /**
23
25
  * @brief Convert an Excel `A1` cell string into a `(row, col)` pair.
@@ -85,6 +87,20 @@ extern "C" {
85
87
  #endif
86
88
  /* *INDENT-ON* */
87
89
 
90
+ /**
91
+ * @brief Retrieve the library version.
92
+ *
93
+ * @return The "X.Y.Z" version string.
94
+ *
95
+ * Get the library version as a "X.Y.Z" version string
96
+ *
97
+ * @code
98
+ * printf("Libxlsxwriter version = %s\n", lxw_version());
99
+ * @endcode
100
+ *
101
+ */
102
+ const char *lxw_version(void);
103
+
88
104
  /**
89
105
  * @brief Converts a libxlsxwriter error number to a string.
90
106
  *
@@ -145,18 +161,32 @@ uint16_t lxw_name_to_col_2(const char *col_str);
145
161
  double lxw_datetime_to_excel_date(lxw_datetime *datetime, uint8_t date_1904);
146
162
 
147
163
  char *lxw_strdup(const char *str);
164
+ char *lxw_strdup_formula(const char *formula);
148
165
 
149
166
  size_t lxw_utf8_strlen(const char *str);
150
167
 
151
168
  void lxw_str_tolower(char *str);
152
169
 
153
- FILE *lxw_tmpfile(char *tmpdir);
170
+ /* Define a portable version of strcasecmp(). */
171
+ #ifdef _MSC_VER
172
+ #define lxw_strcasecmp _stricmp
173
+ #else
174
+ #define lxw_strcasecmp strcasecmp
175
+ #endif
154
176
 
155
- /* Declarations required for unit testing. */
156
- #ifdef TESTING
177
+ FILE *lxw_tmpfile(char *tmpdir);
157
178
 
179
+ /* Use a user defined function to format doubles in sprintf or else a simple
180
+ * macro (the default). */
181
+ #ifdef USE_DOUBLE_FUNCTION
182
+ int lxw_sprintf_dbl(char *data, double number);
183
+ #else
184
+ #define lxw_sprintf_dbl(data, number) \
185
+ lxw_snprintf(data, LXW_ATTR_32, "%.16g", number)
158
186
  #endif
159
187
 
188
+ uint16_t lxw_hash_password(const char *password);
189
+
160
190
  /* *INDENT-OFF* */
161
191
  #ifdef __cplusplus
162
192
  }