xlsxwriter 0.2.1.pre.2 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -3
  3. data/ext/xlsxwriter/chart.c +20 -2
  4. data/ext/xlsxwriter/extconf.rb +8 -8
  5. data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
  6. data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
  7. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
  8. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
  9. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
  10. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  15. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
  16. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
  17. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  18. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
  19. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  20. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  21. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
  22. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  23. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
  24. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
  25. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  26. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
  27. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
  28. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
  29. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
  30. data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
  31. data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
  32. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
  33. data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
  34. data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
  35. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
  36. data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
  37. data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
  38. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
  39. data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
  40. data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
  41. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
  42. data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
  43. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
  44. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
  45. data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
  46. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
  47. data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
  48. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
  49. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
  50. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
  51. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
  52. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
  53. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
  54. data/ext/xlsxwriter/shared_strings.c +65 -0
  55. data/ext/xlsxwriter/shared_strings.h +15 -0
  56. data/ext/xlsxwriter/workbook.c +56 -1
  57. data/ext/xlsxwriter/worksheet.c +31 -2
  58. data/ext/xlsxwriter/worksheet.h +1 -0
  59. data/ext/xlsxwriter/xlsxwriter.c +2 -0
  60. data/lib/xlsxwriter/rich_string.rb +0 -2
  61. data/lib/xlsxwriter/version.rb +1 -1
  62. data/lib/xlsxwriter/worksheet.rb +2 -2
  63. data/test/{run-test.rb → run_test.rb} +3 -3
  64. data/test/support/chart_test.rb +3 -3
  65. data/test/support/with_xlsx_file.rb +4 -2
  66. data/test/support/xlsx_comparable.rb +40 -26
  67. data/test/test_array_formula.rb +42 -0
  68. data/test/test_autofilter.rb +72 -0
  69. data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
  70. data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
  71. data/test/test_chart_bar.rb +382 -0
  72. data/test/test_chart_blank.rb +27 -0
  73. data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
  74. data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
  75. data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
  76. data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
  77. data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
  78. data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
  79. data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
  80. data/test/{test-chartsheet.rb → test_chartsheet.rb} +2 -2
  81. data/test/{test-data.rb → test_data.rb} +1 -1
  82. data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
  83. data/test/{test-default-row.rb → test_default_row.rb} +1 -1
  84. data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
  85. data/test/{test-escapes.rb → test_escapes.rb} +5 -2
  86. data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
  87. data/test/{test-formatting.rb → test_formatting.rb} +10 -10
  88. data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
  89. data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
  90. data/test/{test-image.rb → test_image.rb} +6 -4
  91. data/test/{test-macro.rb → test_macro.rb} +1 -1
  92. data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
  93. data/test/{test-misc.rb → test_misc.rb} +2 -2
  94. data/test/{test-optimize.rb → test_optimize.rb} +2 -4
  95. data/test/{test-outline.rb → test_outline.rb} +14 -14
  96. data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
  97. data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
  98. data/test/{test-panes.rb → test_panes.rb} +1 -1
  99. data/test/{test-print-area.rb → test_print_area.rb} +3 -3
  100. data/test/{test-print-options.rb → test_print_options.rb} +7 -7
  101. data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
  102. data/test/{test-properties.rb → test_properties.rb} +2 -2
  103. data/test/{test-protect.rb → test_protect.rb} +3 -3
  104. data/test/{test-repeat.rb → test_repeat.rb} +3 -3
  105. data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
  106. data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
  107. data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
  108. data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
  109. data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
  110. data/test/{test-simple.rb → test_simple.rb} +10 -10
  111. data/test/{test-types.rb → test_types.rb} +1 -1
  112. data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
  113. metadata +132 -106
  114. data/test/test-array-formula.rb +0 -35
  115. data/test/test-autofilter.rb +0 -72
  116. data/test/test-chart-bar.rb +0 -74
  117. /data/test/{test-errors.rb → test_errors.rb} +0 -0
@@ -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-2020, 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
  /**
@@ -717,25 +713,24 @@ 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.
717
+ * The angle 270 gives a stacked (top to bottom) alignment.
718
+ * The angle 271 gives a stacked alignment for East Asian fonts.
719
+ * */
721
720
  int32_t rotation;
722
721
 
723
722
  /** The chart font color. See @ref working_with_colors. */
724
723
  lxw_color_t color;
725
724
 
726
- /** The chart font pitch family property. Rarely required. set to 0. */
725
+ /** The chart font pitch family property. Rarely required, set to 0. */
727
726
  uint8_t pitch_family;
728
727
 
729
- /** The chart font character set property. Rarely required. set to 0. */
728
+ /** The chart font character set property. Rarely required, set to 0. */
730
729
  uint8_t charset;
731
730
 
732
- /** The chart font baseline property. Rarely required. set to 0. */
731
+ /** The chart font baseline property. Rarely required, set to 0. */
733
732
  int8_t baseline;
734
733
 
735
- /* Members for internal use only. */
736
-
737
- uint8_t has_color;
738
-
739
734
  } lxw_chart_font;
740
735
 
741
736
  typedef struct lxw_chart_marker {
@@ -792,6 +787,54 @@ typedef struct lxw_chart_point {
792
787
 
793
788
  } lxw_chart_point;
794
789
 
790
+ /**
791
+ * @brief Struct to represent an Excel chart data label.
792
+ *
793
+ * The lxw_chart_data_label struct is used to represent a data label in a
794
+ * chart series so that custom properties can be set for it.
795
+ */
796
+ typedef struct lxw_chart_data_label {
797
+
798
+ /** The string or formula value for the data label. See
799
+ * @ref chart_custom_labels. */
800
+ char *value;
801
+
802
+ /** Option to hide/delete the data label from the chart series.
803
+ * See @ref chart_custom_labels. */
804
+ uint8_t hide;
805
+
806
+ /** The font properties for the chart data label. @ref chart_fonts. */
807
+ lxw_chart_font *font;
808
+
809
+ /** The line/border for the chart data label. See @ref chart_lines. */
810
+ lxw_chart_line *line;
811
+
812
+ /** The fill for the chart data label. See @ref chart_fills. */
813
+ lxw_chart_fill *fill;
814
+
815
+ /** The pattern for the chart data label. See @ref chart_patterns.*/
816
+ lxw_chart_pattern *pattern;
817
+
818
+ } lxw_chart_data_label;
819
+
820
+ /* Internal version of lxw_chart_data_label with more metadata. */
821
+ typedef struct lxw_chart_custom_label {
822
+
823
+ char *value;
824
+ uint8_t hide;
825
+ lxw_chart_font *font;
826
+ lxw_chart_line *line;
827
+ lxw_chart_fill *fill;
828
+ lxw_chart_pattern *pattern;
829
+
830
+ /* We use a range to hold the label formula properties even though it
831
+ * will only have 1 point in order to re-use similar functions.*/
832
+ lxw_series_range *range;
833
+
834
+ struct lxw_series_data_point data_point;
835
+
836
+ } lxw_chart_custom_label;
837
+
795
838
  /**
796
839
  * @brief Define how blank values are displayed in a chart.
797
840
  */
@@ -921,7 +964,9 @@ typedef struct lxw_chart_series {
921
964
  lxw_chart_pattern *pattern;
922
965
  lxw_chart_marker *marker;
923
966
  lxw_chart_point *points;
967
+ lxw_chart_custom_label *data_labels;
924
968
  uint16_t point_count;
969
+ uint16_t data_label_count;
925
970
 
926
971
  uint8_t smooth;
927
972
  uint8_t invert_if_negative;
@@ -939,6 +984,9 @@ typedef struct lxw_chart_series {
939
984
  uint8_t default_label_position;
940
985
  char *label_num_format;
941
986
  lxw_chart_font *label_font;
987
+ lxw_chart_line *label_line;
988
+ lxw_chart_fill *label_fill;
989
+ lxw_chart_pattern *label_pattern;
942
990
 
943
991
  lxw_series_error_bars *x_error_bars;
944
992
  lxw_series_error_bars *y_error_bars;
@@ -1043,8 +1091,8 @@ typedef struct lxw_chart {
1043
1091
  uint8_t subtype;
1044
1092
  uint16_t series_index;
1045
1093
 
1046
- void (*write_chart_type) (struct lxw_chart *);
1047
- void (*write_plot_area) (struct lxw_chart *);
1094
+ void (*write_chart_type)(struct lxw_chart *);
1095
+ void (*write_plot_area)(struct lxw_chart *);
1048
1096
 
1049
1097
  /**
1050
1098
  * A pointer to the chart x_axis object which can be used in functions
@@ -1627,11 +1675,11 @@ void chart_series_set_smooth(lxw_chart_series *series, uint8_t smooth);
1627
1675
  * chart_series_set_labels(series);
1628
1676
  * @endcode
1629
1677
  *
1630
- * @image html chart_labels1.png
1678
+ * @image html chart_data_labels1.png
1631
1679
  *
1632
1680
  * By default data labels are displayed in Excel with only the values shown:
1633
1681
  *
1634
- * @image html chart_labels2.png
1682
+ * @image html chart_data_labels2.png
1635
1683
  *
1636
1684
  * However, it is possible to configure other display options, as shown
1637
1685
  * in the functions below.
@@ -1656,7 +1704,7 @@ void chart_series_set_labels(lxw_chart_series *series);
1656
1704
  * chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
1657
1705
  * @endcode
1658
1706
  *
1659
- * @image html chart_labels3.png
1707
+ * @image html chart_data_labels3.png
1660
1708
  *
1661
1709
  * For more information see @ref chart_labels.
1662
1710
  */
@@ -1664,6 +1712,63 @@ void chart_series_set_labels_options(lxw_chart_series *series,
1664
1712
  uint8_t show_name, uint8_t show_category,
1665
1713
  uint8_t show_value);
1666
1714
 
1715
+ /** @brief Set the properties for data labels in a series.
1716
+ *
1717
+ * @param series A series object created via `chart_add_series()`.
1718
+ * @param data_labels An NULL terminated array of #lxw_chart_data_label pointers.
1719
+ *
1720
+ * @return A #lxw_error.
1721
+ *
1722
+ * The `%chart_series_set_labels_custom()` function is used to set the properties
1723
+ * for data labels in a series. It can also be used to delete individual data
1724
+ * labels in a series.
1725
+ *
1726
+ * In general properties are set for all the data labels in a chart
1727
+ * series. However, it is also possible to set properties for individual data
1728
+ * labels in a series using `%chart_series_set_labels_custom()`.
1729
+ *
1730
+ * The `%chart_series_set_labels_custom()` function takes a pointer to an array
1731
+ * of #lxw_chart_data_label pointers. The list should be `NULL` terminated:
1732
+ *
1733
+ * @code
1734
+ * // Add the series data labels.
1735
+ * chart_series_set_labels(series);
1736
+ *
1737
+ * // Create some custom labels.
1738
+ * lxw_chart_data_label data_label1 = {.value = "Jan"};
1739
+ * lxw_chart_data_label data_label2 = {.value = "Feb"};
1740
+ * lxw_chart_data_label data_label3 = {.value = "Mar"};
1741
+ * lxw_chart_data_label data_label4 = {.value = "Apr"};
1742
+ * lxw_chart_data_label data_label5 = {.value = "May"};
1743
+ * lxw_chart_data_label data_label6 = {.value = "Jun"};
1744
+ *
1745
+ * // Create an array of label pointers. NULL indicates the end of the array.
1746
+ * lxw_chart_data_label *data_labels[] = {
1747
+ * &data_label1,
1748
+ * &data_label2,
1749
+ * &data_label3,
1750
+ * &data_label4,
1751
+ * &data_label5,
1752
+ * &data_label6,
1753
+ * NULL
1754
+ * };
1755
+ *
1756
+ * // Set the custom labels.
1757
+ * chart_series_set_labels_custom(series, data_labels);
1758
+ * @endcode
1759
+ *
1760
+ * @image html chart_data_labels18.png
1761
+ *
1762
+ * @note The array of #lxw_chart_point pointers should be NULL terminated as
1763
+ * shown in the example. Any #lxw_chart_data_label items set to a default
1764
+ * initialization or omitted from the list will be assigned the default data
1765
+ * label value.
1766
+ *
1767
+ * For more details see @ref chart_custom_labels.
1768
+ */
1769
+ lxw_error chart_series_set_labels_custom(lxw_chart_series *series, lxw_chart_data_label
1770
+ *data_labels[]);
1771
+
1667
1772
  /**
1668
1773
  * @brief Set the separator for the data label captions.
1669
1774
  *
@@ -1690,7 +1795,7 @@ void chart_series_set_labels_options(lxw_chart_series *series,
1690
1795
  * chart_series_set_labels_separator(series, LXW_CHART_LABEL_SEPARATOR_NEWLINE);
1691
1796
  * @endcode
1692
1797
  *
1693
- * @image html chart_labels4.png
1798
+ * @image html chart_data_labels4.png
1694
1799
  *
1695
1800
  * For more information see @ref chart_labels.
1696
1801
  */
@@ -1711,7 +1816,7 @@ void chart_series_set_labels_separator(lxw_chart_series *series,
1711
1816
  * chart_series_set_labels_position(series, LXW_CHART_LABEL_POSITION_ABOVE);
1712
1817
  * @endcode
1713
1818
  *
1714
- * @image html chart_labels5.png
1819
+ * @image html chart_data_labels5.png
1715
1820
  *
1716
1821
  * In Excel the allowable data label positions vary for different chart
1717
1822
  * types. The allowable, and default, positions are:
@@ -1771,7 +1876,7 @@ void chart_series_set_labels_leader_line(lxw_chart_series *series);
1771
1876
  * chart_series_set_labels_legend(series);
1772
1877
  * @endcode
1773
1878
  *
1774
- * @image html chart_labels6.png
1879
+ * @image html chart_data_labels6.png
1775
1880
  *
1776
1881
  * For more information see @ref chart_labels.
1777
1882
  */
@@ -1792,7 +1897,7 @@ void chart_series_set_labels_legend(lxw_chart_series *series);
1792
1897
  * chart_series_set_labels_percentage(series);
1793
1898
  * @endcode
1794
1899
  *
1795
- * @image html chart_labels7.png
1900
+ * @image html chart_data_labels7.png
1796
1901
  *
1797
1902
  * For more information see @ref chart_labels.
1798
1903
  */
@@ -1812,7 +1917,7 @@ void chart_series_set_labels_percentage(lxw_chart_series *series);
1812
1917
  * chart_series_set_labels_num_format(series, "$0.00");
1813
1918
  * @endcode
1814
1919
  *
1815
- * @image html chart_labels8.png
1920
+ * @image html chart_data_labels8.png
1816
1921
  *
1817
1922
  * The number format is similar to the Worksheet Cell Format num_format,
1818
1923
  * see `format_set_num_format()`.
@@ -1839,7 +1944,7 @@ void chart_series_set_labels_num_format(lxw_chart_series *series,
1839
1944
  * chart_series_set_labels_font(series, &font);
1840
1945
  * @endcode
1841
1946
  *
1842
- * @image html chart_labels9.png
1947
+ * @image html chart_data_labels9.png
1843
1948
  *
1844
1949
  * For more information see @ref chart_fonts and @ref chart_labels.
1845
1950
  *
@@ -1847,6 +1952,67 @@ void chart_series_set_labels_num_format(lxw_chart_series *series,
1847
1952
  void chart_series_set_labels_font(lxw_chart_series *series,
1848
1953
  lxw_chart_font *font);
1849
1954
 
1955
+ /**
1956
+ * @brief Set the line properties for the data labels in a chart series.
1957
+ *
1958
+ * @param series A series object created via `chart_add_series()`.
1959
+ * @param line A #lxw_chart_line struct.
1960
+ *
1961
+ * Set the line/border properties of the data labels in a chart series:
1962
+ *
1963
+ * @code
1964
+ * lxw_chart_line line = {.color = LXW_COLOR_RED};
1965
+ * lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
1966
+ *
1967
+ * chart_series_set_labels_line(series, &line);
1968
+ * chart_series_set_labels_fill(series, &fill);
1969
+ *
1970
+ * @endcode
1971
+ *
1972
+ * @image html chart_data_labels24.png
1973
+ *
1974
+ * For more information see @ref chart_lines and @ref chart_labels.
1975
+ */
1976
+ void chart_series_set_labels_line(lxw_chart_series *series,
1977
+ lxw_chart_line *line);
1978
+
1979
+ /**
1980
+ * @brief Set the fill properties for the data labels in a chart series.
1981
+ *
1982
+ * @param series A series object created via `chart_add_series()`.
1983
+ * @param fill A #lxw_chart_fill struct.
1984
+ *
1985
+ * Set the fill properties of the data labels in a chart series:
1986
+ *
1987
+ * @code
1988
+ * lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
1989
+ *
1990
+ * chart_series_set_labels_fill(series, &fill);
1991
+ * @endcode
1992
+ *
1993
+ * See the example and image above and also see @ref chart_fills and
1994
+ * @ref chart_labels.
1995
+ */
1996
+ void chart_series_set_labels_fill(lxw_chart_series *series,
1997
+ lxw_chart_fill *fill);
1998
+
1999
+ /**
2000
+ * @brief Set the pattern properties for the data labels in a chart series.
2001
+ *
2002
+ * @param series A series object created via `chart_add_series()`.
2003
+ * @param pattern A #lxw_chart_pattern struct.
2004
+ *
2005
+ * Set the pattern properties of the data labels in a chart series:
2006
+ *
2007
+ * @code
2008
+ * chart_series_set_labels_pattern(series, &pattern);
2009
+ * @endcode
2010
+ *
2011
+ * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
2012
+ */
2013
+ void chart_series_set_labels_pattern(lxw_chart_series *series,
2014
+ lxw_chart_pattern *pattern);
2015
+
1850
2016
  /**
1851
2017
  * @brief Turn on a trendline for a chart data series.
1852
2018
  *
@@ -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-2020, 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,7 +77,7 @@ 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
83
  char *name;
@@ -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-2020, 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__ */
@@ -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-2020, 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-2019, John McNamara, jmcnamara@cpan.org -->
12
+ * <!-- Copyright 2014-2020, John McNamara, jmcnamara@cpan.org -->
13
13
  *
14
14
  */
15
15
  #ifndef __LXW_COMMON_H__
@@ -25,6 +25,16 @@
25
25
  #define STATIC
26
26
  #endif
27
27
 
28
+ #ifndef DEPRECATED
29
+ #if __GNUC__ >= 5
30
+ #define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
31
+ #elif defined(_MSC_VER)
32
+ #define DEPRECATED(func, msg) __declspec(deprecated, msg) func
33
+ #else
34
+ #define DEPRECATED(func, msg) func
35
+ #endif
36
+ #endif
37
+
28
38
  /** Integer data type to represent a row value. Equivalent to `uint32_t`.
29
39
  *
30
40
  * The maximum row in Excel is 1,048,576.
@@ -86,6 +96,9 @@ typedef enum lxw_error {
86
96
  /** Unknown zip error when closing xlsx file. */
87
97
  LXW_ERROR_ZIP_CLOSE,
88
98
 
99
+ /** Feature is not currently supported in this configuration. */
100
+ LXW_ERROR_FEATURE_NOT_SUPPORTED,
101
+
89
102
  /** NULL function parameter ignored. */
90
103
  LXW_ERROR_NULL_PARAMETER_IGNORED,
91
104
 
@@ -104,9 +117,6 @@ typedef enum lxw_error {
104
117
  /** Worksheet name is already in use. */
105
118
  LXW_ERROR_SHEETNAME_ALREADY_USED,
106
119
 
107
- /** Worksheet name 'History' is reserved by Excel. */
108
- LXW_ERROR_SHEETNAME_RESERVED,
109
-
110
120
  /** Parameter exceeds Excel's limit of 32 characters. */
111
121
  LXW_ERROR_32_STRING_LENGTH_EXCEEDED,
112
122
 
@@ -125,6 +135,9 @@ typedef enum lxw_error {
125
135
  /** Worksheet row or column index out of range. */
126
136
  LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE,
127
137
 
138
+ /** Maximum hyperlink length (2079) exceeded. */
139
+ LXW_ERROR_WORKSHEET_MAX_URL_LENGTH_EXCEEDED,
140
+
128
141
  /** Maximum number of worksheet URLs (65530) exceeded. */
129
142
  LXW_ERROR_WORKSHEET_MAX_NUMBER_URLS_EXCEEDED,
130
143
 
@@ -164,6 +177,9 @@ enum lxw_custom_property_types {
164
177
  LXW_CUSTOM_DATETIME
165
178
  };
166
179
 
180
+ /* Size of MD5 byte arrays. */
181
+ #define LXW_MD5_SIZE 16
182
+
167
183
  /* Excel sheetname max of 31 chars. */
168
184
  #define LXW_SHEETNAME_MAX 31
169
185
 
@@ -188,6 +204,9 @@ enum lxw_custom_property_types {
188
204
  /* Datetime string length. */
189
205
  #define LXW_DATETIME_LENGTH sizeof("2016-12-12T23:00:00Z")
190
206
 
207
+ /* GUID string length. */
208
+ #define LXW_GUID_LENGTH sizeof("{12345678-1234-1234-1234-1234567890AB}")
209
+
191
210
  #define LXW_EPOCH_1900 0
192
211
  #define LXW_EPOCH_1904 1
193
212
 
@@ -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-2020, 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.
@@ -53,6 +53,10 @@ void lxw_ct_add_chart_name(lxw_content_types *content_types,
53
53
  const char *name);
54
54
  void lxw_ct_add_drawing_name(lxw_content_types *content_types,
55
55
  const char *name);
56
+ void lxw_ct_add_comment_name(lxw_content_types *content_types,
57
+ const char *name);
58
+ void lxw_ct_add_vml_name(lxw_content_types *content_types);
59
+
56
60
  void lxw_ct_add_shared_strings(lxw_content_types *content_types);
57
61
  void lxw_ct_add_calc_chain(lxw_content_types *content_types);
58
62
  void lxw_ct_add_custom_properties(lxw_content_types *content_types);
@@ -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-2020, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * core - A libxlsxwriter library for creating Excel XLSX core files.
7
7
  *
@@ -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-2020, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * custom - A libxlsxwriter library for creating Excel custom property files.
7
7
  *
@@ -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-2020, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
7
7
  *
@@ -10,6 +10,7 @@
10
10
  #define __LXW_DRAWING_H__
11
11
 
12
12
  #include <stdint.h>
13
+ #include <string.h>
13
14
 
14
15
  #include "common.h"
15
16
 
@@ -22,19 +23,6 @@ enum lxw_drawing_types {
22
23
  LXW_DRAWING_SHAPE
23
24
  };
24
25
 
25
- enum lxw_anchor_types {
26
- LXW_ANCHOR_TYPE_NONE = 0,
27
- LXW_ANCHOR_TYPE_IMAGE,
28
- LXW_ANCHOR_TYPE_CHART
29
- };
30
-
31
- enum lxw_anchor_edit_types {
32
- LXW_ANCHOR_EDIT_AS_NONE = 0,
33
- LXW_ANCHOR_EDIT_AS_RELATIVE,
34
- LXW_ANCHOR_EDIT_AS_ONE_CELL,
35
- LXW_ANCHOR_EDIT_AS_ABSOLUTE
36
- };
37
-
38
26
  enum image_types {
39
27
  LXW_IMAGE_UNKNOWN = 0,
40
28
  LXW_IMAGE_PNG,
@@ -52,8 +40,8 @@ typedef struct lxw_drawing_coords {
52
40
 
53
41
  /* Object to represent the properties of a drawing. */
54
42
  typedef struct lxw_drawing_object {
55
- uint8_t anchor_type;
56
- uint8_t edit_as;
43
+ uint8_t type;
44
+ uint8_t anchor;
57
45
  struct lxw_drawing_coords from;
58
46
  struct lxw_drawing_coords to;
59
47
  uint32_t col_absolute;
@@ -61,8 +49,9 @@ typedef struct lxw_drawing_object {
61
49
  uint32_t width;
62
50
  uint32_t height;
63
51
  uint8_t shape;
52
+ uint32_t rel_index;
53
+ uint32_t url_rel_index;
64
54
  char *description;
65
- char *url;
66
55
  char *tip;
67
56
 
68
57
  STAILQ_ENTRY (lxw_drawing_object) list_pointers;