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
@@ -90,9 +90,9 @@ FindStaticLibs(MINIZIP)
90
90
  # -------
91
91
 
92
92
  if(MINIZIP_FOUND)
93
- file(STRINGS "${MINIZIP_INCLUDE_DIRS}/zlib.h" MINIZIP_VERSION_CONTENTS REGEX "Version [0-9]+\\.[0-9]+(\\.[0-9]+)?")
94
- string(REGEX REPLACE ".*Version ([0-9]+)\\.[0-9]+" "\\1" MINIZIP_VERSION_MAJOR "${MINIZIP_VERSION_CONTENTS}")
95
- string(REGEX REPLACE ".*Version [0-9]+\\.([0-9]+)" "\\1" MINIZIP_VERSION_MINOR "${MINIZIP_VERSION_CONTENTS}")
93
+ file(STRINGS "${MINIZIP_INCLUDE_DIRS}/zlib.h" MINIZIP_VERSION_CONTENTS REGEX "version [0-9]+\\.[0-9]+(\\.[0-9]+)?")
94
+ string(REGEX REPLACE ".*version ([0-9]+)\\.[0-9]+" "\\1" MINIZIP_VERSION_MAJOR "${MINIZIP_VERSION_CONTENTS}")
95
+ string(REGEX REPLACE ".*version [0-9]+\\.([0-9]+)" "\\1" MINIZIP_VERSION_MINOR "${MINIZIP_VERSION_CONTENTS}")
96
96
  set(MINIZIP_VERSION_PATCH 0)
97
97
 
98
98
  set(MINIZIP_VERSION_STRING "${MINIZIP_VERSION_MAJOR}.${MINIZIP_VERSION_MINOR}.${MINIZIP_VERSION_PATCH}")
@@ -4,6 +4,7 @@
4
4
  #import "app.h"
5
5
  #import "chart.h"
6
6
  #import "chartsheet.h"
7
+ #import "comment.h"
7
8
  #import "common.h"
8
9
  #import "content_types.h"
9
10
  #import "core.h"
@@ -11,17 +12,22 @@
11
12
  #import "drawing.h"
12
13
  #import "format.h"
13
14
  #import "hash_table.h"
15
+ #import "metadata.h"
14
16
  #import "packager.h"
15
17
  #import "relationships.h"
16
18
  #import "shared_strings.h"
17
19
  #import "styles.h"
20
+ #import "table.h"
18
21
  #import "theme.h"
22
+ #import "third_party/emyg_dtoa.h"
19
23
  #import "third_party/ioapi.h"
24
+ #import "third_party/md5.h"
20
25
  #import "third_party/queue.h"
21
26
  #import "third_party/tmpfileplus.h"
22
27
  #import "third_party/tree.h"
23
28
  #import "third_party/zip.h"
24
29
  #import "utility.h"
30
+ #import "vml.h"
25
31
  #import "workbook.h"
26
32
  #import "worksheet.h"
27
33
  #import "xmlwriter.h"
@@ -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
  * app - A libxlsxwriter library for creating Excel XLSX app files.
7
7
  *
@@ -46,6 +46,7 @@ typedef struct lxw_app {
46
46
 
47
47
  uint32_t num_heading_pairs;
48
48
  uint32_t num_part_names;
49
+ uint8_t doc_security;
49
50
 
50
51
  } lxw_app;
51
52
 
@@ -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
  * chart - A libxlsxwriter library for creating Excel XLSX chart files.
7
7
  *
@@ -124,6 +124,12 @@ typedef enum lxw_chart_type {
124
124
  /** Line chart. */
125
125
  LXW_CHART_LINE,
126
126
 
127
+ /** Line chart - stacked. */
128
+ LXW_CHART_LINE_STACKED,
129
+
130
+ /** Line chart - percentage stacked. */
131
+ LXW_CHART_LINE_STACKED_PERCENT,
132
+
127
133
  /** Pie chart. */
128
134
  LXW_CHART_PIE,
129
135
 
@@ -647,9 +653,6 @@ typedef struct lxw_chart_line {
647
653
  /** Set the transparency of the line. 0 - 100. Default 0. */
648
654
  uint8_t transparency;
649
655
 
650
- /* Members for internal use only. */
651
- uint8_t has_color;
652
-
653
656
  } lxw_chart_line;
654
657
 
655
658
  /**
@@ -668,9 +671,6 @@ typedef struct lxw_chart_fill {
668
671
  /** Set the transparency of the fill. 0 - 100. Default 0. */
669
672
  uint8_t transparency;
670
673
 
671
- /* Members for internal use only. */
672
- uint8_t has_color;
673
-
674
674
  } lxw_chart_fill;
675
675
 
676
676
  /**
@@ -689,10 +689,6 @@ typedef struct lxw_chart_pattern {
689
689
  /** The pattern type. See #lxw_chart_pattern_type. */
690
690
  uint8_t type;
691
691
 
692
- /* Members for internal use only. */
693
- uint8_t has_fg_color;
694
- uint8_t has_bg_color;
695
-
696
692
  } lxw_chart_pattern;
697
693
 
698
694
  /**
@@ -703,7 +699,7 @@ typedef struct lxw_chart_pattern {
703
699
  typedef struct lxw_chart_font {
704
700
 
705
701
  /** The chart font name, such as "Arial" or "Calibri". */
706
- char *name;
702
+ const char *name;
707
703
 
708
704
  /** The chart font size. The default is 11. */
709
705
  double size;
@@ -717,25 +713,27 @@ typedef struct lxw_chart_font {
717
713
  /** The chart font underline property. Set to 0 or 1. */
718
714
  uint8_t underline;
719
715
 
720
- /** The chart font rotation property. Range: -90 to 90. */
716
+ /** The chart font rotation property. Range: -90 to 90, and 270, 271 and 360:
717
+ *
718
+ * - The angles -90 to 90 are the normal range shown in the Excel user interface.
719
+ * - The angle 270 gives a stacked (top to bottom) alignment.
720
+ * - The angle 271 gives a stacked alignment for East Asian fonts.
721
+ * - The angle 360 gives an explicit angle of 0 to override the y axis default.
722
+ * */
721
723
  int32_t rotation;
722
724
 
723
725
  /** The chart font color. See @ref working_with_colors. */
724
726
  lxw_color_t color;
725
727
 
726
- /** The chart font pitch family property. Rarely required. set to 0. */
728
+ /** The chart font pitch family property. Rarely required, set to 0. */
727
729
  uint8_t pitch_family;
728
730
 
729
- /** The chart font character set property. Rarely required. set to 0. */
731
+ /** The chart font character set property. Rarely required, set to 0. */
730
732
  uint8_t charset;
731
733
 
732
- /** The chart font baseline property. Rarely required. set to 0. */
734
+ /** The chart font baseline property. Rarely required, set to 0. */
733
735
  int8_t baseline;
734
736
 
735
- /* Members for internal use only. */
736
-
737
- uint8_t has_color;
738
-
739
737
  } lxw_chart_font;
740
738
 
741
739
  typedef struct lxw_chart_marker {
@@ -792,6 +790,54 @@ typedef struct lxw_chart_point {
792
790
 
793
791
  } lxw_chart_point;
794
792
 
793
+ /**
794
+ * @brief Struct to represent an Excel chart data label.
795
+ *
796
+ * The lxw_chart_data_label struct is used to represent a data label in a
797
+ * chart series so that custom properties can be set for it.
798
+ */
799
+ typedef struct lxw_chart_data_label {
800
+
801
+ /** The string or formula value for the data label. See
802
+ * @ref chart_custom_labels. */
803
+ const char *value;
804
+
805
+ /** Option to hide/delete the data label from the chart series.
806
+ * See @ref chart_custom_labels. */
807
+ uint8_t hide;
808
+
809
+ /** The font properties for the chart data label. @ref chart_fonts. */
810
+ lxw_chart_font *font;
811
+
812
+ /** The line/border for the chart data label. See @ref chart_lines. */
813
+ lxw_chart_line *line;
814
+
815
+ /** The fill for the chart data label. See @ref chart_fills. */
816
+ lxw_chart_fill *fill;
817
+
818
+ /** The pattern for the chart data label. See @ref chart_patterns.*/
819
+ lxw_chart_pattern *pattern;
820
+
821
+ } lxw_chart_data_label;
822
+
823
+ /* Internal version of lxw_chart_data_label with more metadata. */
824
+ typedef struct lxw_chart_custom_label {
825
+
826
+ char *value;
827
+ uint8_t hide;
828
+ lxw_chart_font *font;
829
+ lxw_chart_line *line;
830
+ lxw_chart_fill *fill;
831
+ lxw_chart_pattern *pattern;
832
+
833
+ /* We use a range to hold the label formula properties even though it
834
+ * will only have 1 point in order to re-use similar functions.*/
835
+ lxw_series_range *range;
836
+
837
+ struct lxw_series_data_point data_point;
838
+
839
+ } lxw_chart_custom_label;
840
+
795
841
  /**
796
842
  * @brief Define how blank values are displayed in a chart.
797
843
  */
@@ -921,7 +967,9 @@ typedef struct lxw_chart_series {
921
967
  lxw_chart_pattern *pattern;
922
968
  lxw_chart_marker *marker;
923
969
  lxw_chart_point *points;
970
+ lxw_chart_custom_label *data_labels;
924
971
  uint16_t point_count;
972
+ uint16_t data_label_count;
925
973
 
926
974
  uint8_t smooth;
927
975
  uint8_t invert_if_negative;
@@ -939,6 +987,9 @@ typedef struct lxw_chart_series {
939
987
  uint8_t default_label_position;
940
988
  char *label_num_format;
941
989
  lxw_chart_font *label_font;
990
+ lxw_chart_line *label_line;
991
+ lxw_chart_fill *label_fill;
992
+ lxw_chart_pattern *label_pattern;
942
993
 
943
994
  lxw_series_error_bars *x_error_bars;
944
995
  lxw_series_error_bars *y_error_bars;
@@ -1024,6 +1075,7 @@ typedef struct lxw_chart_axis {
1024
1075
  uint8_t display_units_visible;
1025
1076
 
1026
1077
  uint8_t has_crossing;
1078
+ uint8_t crossing_min;
1027
1079
  uint8_t crossing_max;
1028
1080
  double crossing;
1029
1081
 
@@ -1043,8 +1095,8 @@ typedef struct lxw_chart {
1043
1095
  uint8_t subtype;
1044
1096
  uint16_t series_index;
1045
1097
 
1046
- void (*write_chart_type) (struct lxw_chart *);
1047
- void (*write_plot_area) (struct lxw_chart *);
1098
+ void (*write_chart_type)(struct lxw_chart *);
1099
+ void (*write_plot_area)(struct lxw_chart *);
1048
1100
 
1049
1101
  /**
1050
1102
  * A pointer to the chart x_axis object which can be used in functions
@@ -1627,11 +1679,11 @@ void chart_series_set_smooth(lxw_chart_series *series, uint8_t smooth);
1627
1679
  * chart_series_set_labels(series);
1628
1680
  * @endcode
1629
1681
  *
1630
- * @image html chart_labels1.png
1682
+ * @image html chart_data_labels1.png
1631
1683
  *
1632
1684
  * By default data labels are displayed in Excel with only the values shown:
1633
1685
  *
1634
- * @image html chart_labels2.png
1686
+ * @image html chart_data_labels2.png
1635
1687
  *
1636
1688
  * However, it is possible to configure other display options, as shown
1637
1689
  * in the functions below.
@@ -1656,7 +1708,7 @@ void chart_series_set_labels(lxw_chart_series *series);
1656
1708
  * chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
1657
1709
  * @endcode
1658
1710
  *
1659
- * @image html chart_labels3.png
1711
+ * @image html chart_data_labels3.png
1660
1712
  *
1661
1713
  * For more information see @ref chart_labels.
1662
1714
  */
@@ -1664,6 +1716,63 @@ void chart_series_set_labels_options(lxw_chart_series *series,
1664
1716
  uint8_t show_name, uint8_t show_category,
1665
1717
  uint8_t show_value);
1666
1718
 
1719
+ /** @brief Set the properties for data labels in a series.
1720
+ *
1721
+ * @param series A series object created via `chart_add_series()`.
1722
+ * @param data_labels An NULL terminated array of #lxw_chart_data_label pointers.
1723
+ *
1724
+ * @return A #lxw_error.
1725
+ *
1726
+ * The `%chart_series_set_labels_custom()` function is used to set the properties
1727
+ * for data labels in a series. It can also be used to delete individual data
1728
+ * labels in a series.
1729
+ *
1730
+ * In general properties are set for all the data labels in a chart
1731
+ * series. However, it is also possible to set properties for individual data
1732
+ * labels in a series using `%chart_series_set_labels_custom()`.
1733
+ *
1734
+ * The `%chart_series_set_labels_custom()` function takes a pointer to an array
1735
+ * of #lxw_chart_data_label pointers. The list should be `NULL` terminated:
1736
+ *
1737
+ * @code
1738
+ * // Add the series data labels.
1739
+ * chart_series_set_labels(series);
1740
+ *
1741
+ * // Create some custom labels.
1742
+ * lxw_chart_data_label data_label1 = {.value = "Jan"};
1743
+ * lxw_chart_data_label data_label2 = {.value = "Feb"};
1744
+ * lxw_chart_data_label data_label3 = {.value = "Mar"};
1745
+ * lxw_chart_data_label data_label4 = {.value = "Apr"};
1746
+ * lxw_chart_data_label data_label5 = {.value = "May"};
1747
+ * lxw_chart_data_label data_label6 = {.value = "Jun"};
1748
+ *
1749
+ * // Create an array of label pointers. NULL indicates the end of the array.
1750
+ * lxw_chart_data_label *data_labels[] = {
1751
+ * &data_label1,
1752
+ * &data_label2,
1753
+ * &data_label3,
1754
+ * &data_label4,
1755
+ * &data_label5,
1756
+ * &data_label6,
1757
+ * NULL
1758
+ * };
1759
+ *
1760
+ * // Set the custom labels.
1761
+ * chart_series_set_labels_custom(series, data_labels);
1762
+ * @endcode
1763
+ *
1764
+ * @image html chart_data_labels18.png
1765
+ *
1766
+ * @note The array of #lxw_chart_point pointers should be NULL terminated as
1767
+ * shown in the example. Any #lxw_chart_data_label items set to a default
1768
+ * initialization or omitted from the list will be assigned the default data
1769
+ * label value.
1770
+ *
1771
+ * For more details see @ref chart_custom_labels.
1772
+ */
1773
+ lxw_error chart_series_set_labels_custom(lxw_chart_series *series, lxw_chart_data_label
1774
+ *data_labels[]);
1775
+
1667
1776
  /**
1668
1777
  * @brief Set the separator for the data label captions.
1669
1778
  *
@@ -1690,7 +1799,7 @@ void chart_series_set_labels_options(lxw_chart_series *series,
1690
1799
  * chart_series_set_labels_separator(series, LXW_CHART_LABEL_SEPARATOR_NEWLINE);
1691
1800
  * @endcode
1692
1801
  *
1693
- * @image html chart_labels4.png
1802
+ * @image html chart_data_labels4.png
1694
1803
  *
1695
1804
  * For more information see @ref chart_labels.
1696
1805
  */
@@ -1711,7 +1820,7 @@ void chart_series_set_labels_separator(lxw_chart_series *series,
1711
1820
  * chart_series_set_labels_position(series, LXW_CHART_LABEL_POSITION_ABOVE);
1712
1821
  * @endcode
1713
1822
  *
1714
- * @image html chart_labels5.png
1823
+ * @image html chart_data_labels5.png
1715
1824
  *
1716
1825
  * In Excel the allowable data label positions vary for different chart
1717
1826
  * types. The allowable, and default, positions are:
@@ -1771,7 +1880,7 @@ void chart_series_set_labels_leader_line(lxw_chart_series *series);
1771
1880
  * chart_series_set_labels_legend(series);
1772
1881
  * @endcode
1773
1882
  *
1774
- * @image html chart_labels6.png
1883
+ * @image html chart_data_labels6.png
1775
1884
  *
1776
1885
  * For more information see @ref chart_labels.
1777
1886
  */
@@ -1792,7 +1901,7 @@ void chart_series_set_labels_legend(lxw_chart_series *series);
1792
1901
  * chart_series_set_labels_percentage(series);
1793
1902
  * @endcode
1794
1903
  *
1795
- * @image html chart_labels7.png
1904
+ * @image html chart_data_labels7.png
1796
1905
  *
1797
1906
  * For more information see @ref chart_labels.
1798
1907
  */
@@ -1812,7 +1921,7 @@ void chart_series_set_labels_percentage(lxw_chart_series *series);
1812
1921
  * chart_series_set_labels_num_format(series, "$0.00");
1813
1922
  * @endcode
1814
1923
  *
1815
- * @image html chart_labels8.png
1924
+ * @image html chart_data_labels8.png
1816
1925
  *
1817
1926
  * The number format is similar to the Worksheet Cell Format num_format,
1818
1927
  * see `format_set_num_format()`.
@@ -1839,7 +1948,7 @@ void chart_series_set_labels_num_format(lxw_chart_series *series,
1839
1948
  * chart_series_set_labels_font(series, &font);
1840
1949
  * @endcode
1841
1950
  *
1842
- * @image html chart_labels9.png
1951
+ * @image html chart_data_labels9.png
1843
1952
  *
1844
1953
  * For more information see @ref chart_fonts and @ref chart_labels.
1845
1954
  *
@@ -1847,6 +1956,67 @@ void chart_series_set_labels_num_format(lxw_chart_series *series,
1847
1956
  void chart_series_set_labels_font(lxw_chart_series *series,
1848
1957
  lxw_chart_font *font);
1849
1958
 
1959
+ /**
1960
+ * @brief Set the line properties for the data labels in a chart series.
1961
+ *
1962
+ * @param series A series object created via `chart_add_series()`.
1963
+ * @param line A #lxw_chart_line struct.
1964
+ *
1965
+ * Set the line/border properties of the data labels in a chart series:
1966
+ *
1967
+ * @code
1968
+ * lxw_chart_line line = {.color = LXW_COLOR_RED};
1969
+ * lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
1970
+ *
1971
+ * chart_series_set_labels_line(series, &line);
1972
+ * chart_series_set_labels_fill(series, &fill);
1973
+ *
1974
+ * @endcode
1975
+ *
1976
+ * @image html chart_data_labels24.png
1977
+ *
1978
+ * For more information see @ref chart_lines and @ref chart_labels.
1979
+ */
1980
+ void chart_series_set_labels_line(lxw_chart_series *series,
1981
+ lxw_chart_line *line);
1982
+
1983
+ /**
1984
+ * @brief Set the fill properties for the data labels in a chart series.
1985
+ *
1986
+ * @param series A series object created via `chart_add_series()`.
1987
+ * @param fill A #lxw_chart_fill struct.
1988
+ *
1989
+ * Set the fill properties of the data labels in a chart series:
1990
+ *
1991
+ * @code
1992
+ * lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
1993
+ *
1994
+ * chart_series_set_labels_fill(series, &fill);
1995
+ * @endcode
1996
+ *
1997
+ * See the example and image above and also see @ref chart_fills and
1998
+ * @ref chart_labels.
1999
+ */
2000
+ void chart_series_set_labels_fill(lxw_chart_series *series,
2001
+ lxw_chart_fill *fill);
2002
+
2003
+ /**
2004
+ * @brief Set the pattern properties for the data labels in a chart series.
2005
+ *
2006
+ * @param series A series object created via `chart_add_series()`.
2007
+ * @param pattern A #lxw_chart_pattern struct.
2008
+ *
2009
+ * Set the pattern properties of the data labels in a chart series:
2010
+ *
2011
+ * @code
2012
+ * chart_series_set_labels_pattern(series, &pattern);
2013
+ * @endcode
2014
+ *
2015
+ * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
2016
+ */
2017
+ void chart_series_set_labels_pattern(lxw_chart_series *series,
2018
+ lxw_chart_pattern *pattern);
2019
+
1850
2020
  /**
1851
2021
  * @brief Turn on a trendline for a chart data series.
1852
2022
  *
@@ -2534,6 +2704,26 @@ void chart_axis_set_crossing(lxw_chart_axis *axis, double value);
2534
2704
  */
2535
2705
  void chart_axis_set_crossing_max(lxw_chart_axis *axis);
2536
2706
 
2707
+ /**
2708
+ * @brief Set the opposite axis crossing position as the axis minimum.
2709
+ *
2710
+ * @param axis A pointer to a chart #lxw_chart_axis object.
2711
+ *
2712
+ * Set the position that the opposite axis will cross as the axis minimum.
2713
+ * The default axis crossing position is generally the axis minimum so this
2714
+ * function can be used to reverse the location of the axes without reversing
2715
+ * the number sequence:
2716
+ *
2717
+ * @code
2718
+ * chart_axis_set_crossing_min(chart->x_axis);
2719
+ * chart_axis_set_crossing_min(chart->y_axis);
2720
+ * @endcode
2721
+ *
2722
+ * **Axis types**: This function is applicable to to all axes types.
2723
+ * See @ref ww_charts_axes.
2724
+ */
2725
+ void chart_axis_set_crossing_min(lxw_chart_axis *axis);
2726
+
2537
2727
  /**
2538
2728
  * @brief Turn off/hide an axis.
2539
2729
  *
@@ -3045,7 +3235,7 @@ void chart_title_set_name_range(lxw_chart *chart, const char *sheetname,
3045
3235
  * chart title:
3046
3236
  *
3047
3237
  * @code
3048
- * lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
3238
+ * lxw_chart_font font = {.color = LXW_COLOR_BLUE};
3049
3239
  *
3050
3240
  * chart_title_set_name(chart, "Year End Results");
3051
3241
  * chart_title_set_name_font(chart, &font);
@@ -3053,6 +3243,20 @@ void chart_title_set_name_range(lxw_chart *chart, const char *sheetname,
3053
3243
  *
3054
3244
  * @image html chart_title_set_name_font.png
3055
3245
  *
3246
+ * In Excel a chart title font is bold by default (as shown in the image
3247
+ * above). To turn off bold in the font you cannot use #LXW_FALSE (0) since
3248
+ * that is indistinguishable from an uninitialized value. Instead you should
3249
+ * use #LXW_EXPLICIT_FALSE:
3250
+ *
3251
+ * @code
3252
+ * lxw_chart_font font = {.bold = LXW_EXPLICIT_FALSE, .color = LXW_COLOR_BLUE};
3253
+ *
3254
+ * chart_title_set_name(chart, "Year End Results");
3255
+ * chart_title_set_name_font(chart, &font);
3256
+ * @endcode
3257
+ *
3258
+ * @image html chart_title_set_name_font2.png
3259
+ *
3056
3260
  * For more information see @ref chart_fonts.
3057
3261
  */
3058
3262
  void chart_title_set_name_font(lxw_chart *chart, lxw_chart_font *font);
@@ -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
  * chartsheet - A libxlsxwriter library for creating Excel XLSX chartsheet files.
7
7
  *
@@ -77,13 +77,13 @@ typedef struct lxw_chartsheet {
77
77
  lxw_worksheet *worksheet;
78
78
  lxw_chart *chart;
79
79
 
80
- struct lxw_protection protection;
80
+ struct lxw_protection_obj protection;
81
81
  uint8_t is_protected;
82
82
 
83
- char *name;
84
- char *quoted_name;
85
- char *tmpdir;
86
- uint32_t index;
83
+ const char *name;
84
+ const char *quoted_name;
85
+ const char *tmpdir;
86
+ uint16_t index;
87
87
  uint8_t active;
88
88
  uint8_t selected;
89
89
  uint8_t hidden;
@@ -143,7 +143,7 @@ lxw_error chartsheet_set_chart(lxw_chartsheet *chartsheet, lxw_chart *chart);
143
143
  /* Not currently required since scale options aren't useful in a chartsheet. */
144
144
  lxw_error chartsheet_set_chart_opt(lxw_chartsheet *chartsheet,
145
145
  lxw_chart *chart,
146
- lxw_image_options *user_options);
146
+ lxw_chart_options *user_options);
147
147
 
148
148
  /**
149
149
  * @brief Make a chartsheet the active, i.e., visible chartsheet.
@@ -0,0 +1,76 @@
1
+ /*
2
+ * libxlsxwriter
3
+ *
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
+ *
6
+ * comment - A libxlsxwriter library for creating Excel XLSX comment files.
7
+ *
8
+ */
9
+ #ifndef __LXW_COMMENT_H__
10
+ #define __LXW_COMMENT_H__
11
+
12
+ #include <stdint.h>
13
+
14
+ #include "common.h"
15
+ #include "worksheet.h"
16
+
17
+ /* Define the tree.h RB structs for the red-black head types. */
18
+ RB_HEAD(lxw_author_ids, lxw_author_id);
19
+
20
+ /*
21
+ * Struct to represent a comment object.
22
+ */
23
+ typedef struct lxw_comment {
24
+
25
+ FILE *file;
26
+ struct lxw_comment_objs *comment_objs;
27
+ struct lxw_author_ids *author_ids;
28
+ char *comment_author;
29
+ uint32_t author_id;
30
+
31
+ } lxw_comment;
32
+
33
+ /* Struct to an author id */
34
+ typedef struct lxw_author_id {
35
+ uint32_t id;
36
+ char *author;
37
+
38
+ RB_ENTRY (lxw_author_id) tree_pointers;
39
+ } lxw_author_id;
40
+
41
+ #define LXW_RB_GENERATE_AUTHOR_IDS(name, type, field, cmp) \
42
+ RB_GENERATE_INSERT_COLOR(name, type, field, static) \
43
+ RB_GENERATE_REMOVE_COLOR(name, type, field, static) \
44
+ RB_GENERATE_INSERT(name, type, field, cmp, static) \
45
+ RB_GENERATE_REMOVE(name, type, field, static) \
46
+ RB_GENERATE_FIND(name, type, field, cmp, static) \
47
+ RB_GENERATE_NEXT(name, type, field, static) \
48
+ RB_GENERATE_MINMAX(name, type, field, static) \
49
+ /* Add unused struct to allow adding a semicolon */ \
50
+ struct lxw_rb_generate_author_ids{int unused;}
51
+
52
+
53
+ /* *INDENT-OFF* */
54
+ #ifdef __cplusplus
55
+ extern "C" {
56
+ #endif
57
+ /* *INDENT-ON* */
58
+
59
+ lxw_comment *lxw_comment_new(void);
60
+ void lxw_comment_free(lxw_comment *comment);
61
+ void lxw_comment_assemble_xml_file(lxw_comment *self);
62
+
63
+ /* Declarations required for unit testing. */
64
+ #ifdef TESTING
65
+
66
+ STATIC void _comment_xml_declaration(lxw_comment *self);
67
+
68
+ #endif /* TESTING */
69
+
70
+ /* *INDENT-OFF* */
71
+ #ifdef __cplusplus
72
+ }
73
+ #endif
74
+ /* *INDENT-ON* */
75
+
76
+ #endif /* __LXW_COMMENT_H__ */