xlsxwriter 0.0.4 → 0.0.5

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 (44) hide show
  1. checksums.yaml +5 -5
  2. data/ext/xlsxwriter/libxlsxwriter/License.txt +1 -1
  3. data/ext/xlsxwriter/libxlsxwriter/Makefile +1 -1
  4. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +2 -2
  5. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
  6. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +104 -4
  7. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +7 -2
  8. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +1 -1
  9. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  10. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +1 -1
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +1 -1
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +1 -1
  15. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  16. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  17. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +1 -1
  18. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  19. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +10 -5
  20. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +1 -1
  21. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +136 -38
  22. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +2 -2
  23. data/ext/xlsxwriter/libxlsxwriter/src/Makefile +11 -1
  24. data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
  25. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +66 -10
  26. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +1 -1
  27. data/ext/xlsxwriter/libxlsxwriter/src/core.c +1 -1
  28. data/ext/xlsxwriter/libxlsxwriter/src/custom.c +2 -2
  29. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +1 -1
  30. data/ext/xlsxwriter/libxlsxwriter/src/format.c +1 -1
  31. data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
  32. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +4 -4
  33. data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
  34. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +1 -1
  35. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +1 -1
  36. data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
  37. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +27 -1
  38. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +8 -6
  39. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +143 -26
  40. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +2 -2
  41. data/ext/xlsxwriter/worksheet.c +2 -0
  42. data/lib/xlsxwriter/version.rb +1 -1
  43. data/test/test-errors.rb +19 -0
  44. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: af3bca200673e0730a5a147c1cafcf9707cbc995
4
- data.tar.gz: 980e27d4f2291b26c2d44e2991d9b8c551cadc84
2
+ SHA256:
3
+ metadata.gz: 495f1673b10c6db9e10fd486caff1f1c15810545bdd555309a4b6b124613938c
4
+ data.tar.gz: 1a49cf8826cb02d3257f44d8ec0899144d69b23af6baa5e1ef3c1addc657d6db
5
5
  SHA512:
6
- metadata.gz: 4ff2da6747e509ca895278a8b26a3b0b4a8f595a61d33eb27ac96e32923eed36a88a786a9f0ba7d378973f01f4f7a422fb5947bd5fd8c82a559ef557a574eb60
7
- data.tar.gz: 9e2178de081464fa5b6650850d8af0b750d7258c5bea6a1b9c11d325f5c553e7ea5d2a3ad339f66344eb3ac1ae17f765a1fe4b2eb2a3f3fef11f6d3c8a3eebf5
6
+ metadata.gz: ac2482347738c6009bc2ed51a0301d71877327d1e921035eb775f2fb5eec8d2330164a6b52075f0e0688ff33e00231b3bde47e2b5d140b044fef0e2ab6a27fca
7
+ data.tar.gz: 94d1339afa70ee9baf34a22b04481b4be6b6a6ab478cf3b7f9f7ffe8cd09831182f2ac042d65942d90a9c77e616e9f9b01b5cdd6dfb021f6fb6a9f760d023e1f
@@ -4,7 +4,7 @@
4
4
 
5
5
  Libxlsxwriter is released under a FreeBSD license:
6
6
 
7
- Copyright 2014-2017, John McNamara <jmcnamara@cpan.org>
7
+ Copyright 2014-2018, John McNamara <jmcnamara@cpan.org>
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Makefile for libxlsxwriter library.
4
4
  #
5
- # Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
5
+ # Copyright 2014-2018, John McNamara, jmcnamara@cpan.org
6
6
  #
7
7
 
8
8
  # Keep the output quiet by default.
@@ -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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -18,6 +18,6 @@
18
18
  #include "xlsxwriter/format.h"
19
19
  #include "xlsxwriter/utility.h"
20
20
 
21
- #define LXW_VERSION "0.7.5"
21
+ #define LXW_VERSION "0.7.7"
22
22
 
23
23
  #endif /* __LXW_XLSXWRITER_H__ */
@@ -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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * app - A libxlsxwriter library for creating Excel XLSX app files.
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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * chart - A libxlsxwriter library for creating Excel XLSX chart files.
7
7
  *
@@ -464,6 +464,17 @@ typedef enum lxw_chart_label_separator {
464
464
  LXW_CHART_LABEL_SEPARATOR_SPACE
465
465
  } lxw_chart_label_separator;
466
466
 
467
+ /**
468
+ * @brief Chart axis types.
469
+ */
470
+ typedef enum lxw_chart_axis_type {
471
+ /** Chart X axis. */
472
+ LXW_CHART_AXIS_TYPE_X,
473
+
474
+ /** Chart Y axis. */
475
+ LXW_CHART_AXIS_TYPE_Y
476
+ } lxw_chart_axis_type;
477
+
467
478
  enum lxw_chart_subtype {
468
479
 
469
480
  LXW_CHART_SUBTYPE_NONE = 0,
@@ -613,7 +624,7 @@ typedef struct lxw_chart_line {
613
624
  /** The line dash type. See #lxw_chart_line_dash_type. */
614
625
  uint8_t dash_type;
615
626
 
616
- /* Transparency for lines isn't generally useful. Undocumented for now. */
627
+ /** Set the transparency of the line. 0 - 100. Default 0. */
617
628
  uint8_t transparency;
618
629
 
619
630
  /* Members for internal use only. */
@@ -692,10 +703,17 @@ typedef struct lxw_chart_font {
692
703
  /** The chart font color. See @ref working_with_colors. */
693
704
  lxw_color_t color;
694
705
 
695
- /* Members for internal use only. */
706
+ /** The chart font pitch family property. Rarely required. set to 0. */
696
707
  uint8_t pitch_family;
708
+
709
+ /** The chart font character set property. Rarely required. set to 0. */
697
710
  uint8_t charset;
711
+
712
+ /** The chart font baseline property. Rarely required. set to 0. */
698
713
  int8_t baseline;
714
+
715
+ /* Members for internal use only. */
716
+
699
717
  uint8_t has_color;
700
718
 
701
719
  } lxw_chart_font;
@@ -808,6 +826,17 @@ typedef enum lxw_chart_error_bar_direction {
808
826
  LXW_CHART_ERROR_BAR_DIR_MINUS
809
827
  } lxw_chart_error_bar_direction;
810
828
 
829
+ /**
830
+ * @brief Direction for a data series error bar.
831
+ */
832
+ typedef enum lxw_chart_error_bar_axis {
833
+ /** X axis error bar. */
834
+ LXW_CHART_ERROR_BAR_AXIS_X,
835
+
836
+ /** Y axis error bar. */
837
+ LXW_CHART_ERROR_BAR_AXIS_Y
838
+ } lxw_chart_error_bar_axis;
839
+
811
840
  /**
812
841
  * @brief End cap styles for a data series error bar.
813
842
  */
@@ -2009,6 +2038,46 @@ void chart_series_set_trendline_name(lxw_chart_series *series,
2009
2038
  */
2010
2039
  void chart_series_set_trendline_line(lxw_chart_series *series,
2011
2040
  lxw_chart_line *line);
2041
+ /**
2042
+ * @brief Get a pointer to X or Y error bars from a chart series.
2043
+ *
2044
+ * @param series A series object created via `chart_add_series()`.
2045
+ * @param axis_type The axis type (X or Y): #lxw_chart_error_bar_axis.
2046
+ *
2047
+ * The `%chart_series_get_error_bars()` function returns a pointer to the
2048
+ * error bars of a series based on the type of #lxw_chart_error_bar_axis:
2049
+ *
2050
+ * @code
2051
+ * lxw_series_error_bars *x_error_bars;
2052
+ * lxw_series_error_bars *y_error_bars;
2053
+ *
2054
+ * x_error_bars = chart_series_get_error_bars(series, LXW_CHART_ERROR_BAR_AXIS_X);
2055
+ * y_error_bars = chart_series_get_error_bars(series, LXW_CHART_ERROR_BAR_AXIS_Y);
2056
+ *
2057
+ * // Use the error bar pointers.
2058
+ * chart_series_set_error_bars(x_error_bars,
2059
+ * LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
2060
+ *
2061
+ * chart_series_set_error_bars(y_error_bars,
2062
+ * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
2063
+ * @endcode
2064
+ *
2065
+ * Note, the series error bars can also be accessed directly:
2066
+ *
2067
+ * @code
2068
+ * // Equivalent to the above example, without function calls.
2069
+ * chart_series_set_error_bars(series->x_error_bars,
2070
+ * LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
2071
+ *
2072
+ * chart_series_set_error_bars(series->y_error_bars,
2073
+ * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
2074
+ * @endcode
2075
+ *
2076
+ * @return Pointer to the series error bars, or NULL if not found.
2077
+ */
2078
+
2079
+ lxw_series_error_bars *chart_series_get_error_bars(lxw_chart_series *series, lxw_chart_error_bar_axis
2080
+ axis_type);
2012
2081
 
2013
2082
  /**
2014
2083
  * Set the X or Y error bars for a chart series.
@@ -2072,7 +2141,7 @@ void chart_series_set_error_bars(lxw_series_error_bars *error_bars,
2072
2141
  * series.
2073
2142
  *
2074
2143
  * @param error_bars A pointer to the series X or Y error bars.
2075
- * @param direction The bar direction: #lxw_chart_error_bar_direction .
2144
+ * @param direction The bar direction: #lxw_chart_error_bar_direction.
2076
2145
  *
2077
2146
  * The `%chart_series_set_error_bars_direction()` function sets the
2078
2147
  * direction of the error bars:
@@ -2154,6 +2223,37 @@ void chart_series_set_error_bars_endcap(lxw_series_error_bars *error_bars,
2154
2223
  void chart_series_set_error_bars_line(lxw_series_error_bars *error_bars,
2155
2224
  lxw_chart_line *line);
2156
2225
 
2226
+ /**
2227
+ * @brief Get an axis pointer from a chart.
2228
+ *
2229
+ * @param chart Pointer to a lxw_chart instance to be configured.
2230
+ * @param axis_type The axis type (X or Y): #lxw_chart_axis_type.
2231
+ *
2232
+ * The `%chart_axis_get()` function returns a pointer to a chart axis based
2233
+ * on the #lxw_chart_axis_type:
2234
+ *
2235
+ * @code
2236
+ * lxw_chart_axis *x_axis = chart_axis_get(chart, LXW_CHART_AXIS_TYPE_X);
2237
+ * lxw_chart_axis *y_axis = chart_axis_get(chart, LXW_CHART_AXIS_TYPE_Y);
2238
+ *
2239
+ * // Use the axis pointer in other functions.
2240
+ * chart_axis_major_gridlines_set_visible(x_axis, LXW_TRUE);
2241
+ * chart_axis_major_gridlines_set_visible(y_axis, LXW_TRUE);
2242
+ * @endcode
2243
+ *
2244
+ * Note, the axis pointer can also be accessed directly:
2245
+ *
2246
+ * @code
2247
+ * // Equivalent to the above example, without function calls.
2248
+ * chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
2249
+ * chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_TRUE);
2250
+ * @endcode
2251
+ *
2252
+ * @return Pointer to the chart axis, or NULL if not found.
2253
+ */
2254
+ lxw_chart_axis *chart_axis_get(lxw_chart *chart,
2255
+ lxw_chart_axis_type axis_type);
2256
+
2157
2257
  /**
2158
2258
  * @brief Set the name caption of the an axis.
2159
2259
  *
@@ -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-2018, 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-2018, John McNamara, jmcnamara@cpan.org -->
13
13
  *
14
14
  */
15
15
  #ifndef __LXW_COMMON_H__
@@ -268,9 +268,14 @@ enum lxw_custom_property_types {
268
268
  (((n) & 0xFF0000) >> 8) | \
269
269
  (((n) & 0xFF000000) >> 24))
270
270
  #define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
271
+ #define LXW_UINT32_HOST(n) (n)
271
272
  #else
272
273
  #define LXW_UINT32_NETWORK(n) (n)
273
274
  #define LXW_UINT16_NETWORK(n) (n)
275
+ #define LXW_UINT32_HOST(n) ((((n) & 0xFF) << 24) | \
276
+ (((n) & 0xFF00) << 8) | \
277
+ (((n) & 0xFF0000) >> 8) | \
278
+ (((n) & 0xFF000000) >> 24))
274
279
  #endif
275
280
 
276
281
  /* *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-2018, 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.
@@ -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-2018, 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-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2018, 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-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
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-2018, 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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * packager - A libxlsxwriter library for creating Excel XLSX packager files.
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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * relationships - A libxlsxwriter library for creating Excel XLSX
7
7
  * relationships files.
@@ -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-2018, 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.
@@ -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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * styles - A libxlsxwriter library for creating Excel XLSX styles files.
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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * theme - A libxlsxwriter library for creating Excel XLSX theme files.
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-2018, 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-2018, John McNamara, jmcnamara@cpan.org -->
13
13
  *
14
14
  */
15
15
 
@@ -18,6 +18,7 @@
18
18
 
19
19
  #include <stdint.h>
20
20
  #include "common.h"
21
+ #include "xmlwriter.h"
21
22
 
22
23
  /**
23
24
  * @brief Convert an Excel `A1` cell string into a `(row, col)` pair.
@@ -153,9 +154,13 @@ void lxw_str_tolower(char *str);
153
154
 
154
155
  FILE *lxw_tmpfile(char *tmpdir);
155
156
 
156
- /* Declarations required for unit testing. */
157
- #ifdef TESTING
158
-
157
+ /* Use a user defined function to format doubles in sprintf or else a simple
158
+ * macro (the default). */
159
+ #ifdef USE_DOUBLE_FUNCTION
160
+ int lxw_sprintf_dbl(char *data, double number);
161
+ #else
162
+ #define lxw_sprintf_dbl(data, number) \
163
+ lxw_snprintf(data, LXW_ATTR_32, "%.16g", number)
159
164
  #endif
160
165
 
161
166
  /* *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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
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-2018, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  */
6
6
 
7
7
  /**
@@ -267,12 +267,14 @@ STAILQ_HEAD(lxw_chart_data, lxw_image_options);
267
267
  * Options struct for the worksheet_set_column() and worksheet_set_row()
268
268
  * functions.
269
269
  *
270
- * It has the following members but currently only the `hidden` property is
271
- * supported:
270
+ * It has the following members:
272
271
  *
273
272
  * * `hidden`
274
273
  * * `level`
275
274
  * * `collapsed`
275
+ *
276
+ * The members of this struct are explained in @ref ww_outlines_grouping.
277
+ *
276
278
  */
277
279
  typedef struct lxw_row_col_options {
278
280
  /** Hide the row/column */
@@ -696,6 +698,9 @@ typedef struct lxw_worksheet {
696
698
  uint8_t orientation;
697
699
  uint8_t outline_changed;
698
700
  uint8_t outline_on;
701
+ uint8_t outline_style;
702
+ uint8_t outline_below;
703
+ uint8_t outline_right;
699
704
  uint8_t page_order;
700
705
  uint8_t page_setup_changed;
701
706
  uint8_t page_view;
@@ -725,6 +730,8 @@ typedef struct lxw_worksheet {
725
730
  uint32_t default_col_pixels;
726
731
  uint8_t default_row_zeroed;
727
732
  uint8_t default_row_set;
733
+ uint8_t outline_row_level;
734
+ uint8_t outline_col_level;
728
735
 
729
736
  uint8_t header_footer_changed;
730
737
  char header[LXW_HEADER_FOOTER_MAX];
@@ -959,6 +966,7 @@ lxw_error worksheet_write_string(lxw_worksheet *worksheet,
959
966
  * worksheet_write_formula(worksheet, 1, 0, "=SUM(1; 2; 3)", NULL);
960
967
  * @endcode
961
968
  *
969
+ * See also @ref working_with_formulas.
962
970
  */
963
971
  lxw_error worksheet_write_formula(lxw_worksheet *worksheet,
964
972
  lxw_row_t row,
@@ -1172,7 +1180,7 @@ lxw_error worksheet_write_url_opt(lxw_worksheet *worksheet,
1172
1180
  * @endcode
1173
1181
  *
1174
1182
  *
1175
- * Alternatively, you can use Windows style forward slashes. These are
1183
+ * Alternatively, you can use Unix style forward slashes. These are
1176
1184
  * translated internally to backslashes:
1177
1185
  *
1178
1186
  * @code
@@ -1289,6 +1297,7 @@ lxw_error worksheet_write_blank(lxw_worksheet *worksheet,
1289
1297
  * worksheet_write_formula() function is the recommended way of writing
1290
1298
  * formulas.
1291
1299
  *
1300
+ * See also @ref working_with_formulas.
1292
1301
  */
1293
1302
  lxw_error worksheet_write_formula_num(lxw_worksheet *worksheet,
1294
1303
  lxw_row_t row,
@@ -1364,7 +1373,7 @@ lxw_error worksheet_set_row(lxw_worksheet *worksheet,
1364
1373
  * `worksheet_set_row()` with an additional `options` parameter.
1365
1374
  *
1366
1375
  * The `options` parameter is a #lxw_row_col_options struct. It has the
1367
- * following members but currently only the `hidden` property is supported:
1376
+ * following members:
1368
1377
  *
1369
1378
  * - `hidden`
1370
1379
  * - `level`
@@ -1374,12 +1383,41 @@ lxw_error worksheet_set_row(lxw_worksheet *worksheet,
1374
1383
  * example, to hide intermediary steps in a complicated calculation:
1375
1384
  *
1376
1385
  * @code
1377
- * lxw_row_col_options options = {.hidden = 1, .level = 0, .collapsed = 0};
1386
+ * lxw_row_col_options options1 = {.hidden = 1, .level = 0, .collapsed = 0};
1387
+ *
1388
+ * // Hide the fourth and fifth (zero indexed) rows.
1389
+ * worksheet_set_row_opt(worksheet, 3, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1390
+ * worksheet_set_row_opt(worksheet, 4, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1378
1391
  *
1379
- * // Hide the fourth row.
1380
- * worksheet_set_row(worksheet, 3, 20, NULL, &options);
1381
1392
  * @endcode
1382
1393
  *
1394
+ * @image html hide_row_col2.png
1395
+ *
1396
+ * The `"hidden"`, `"level"`, and `"collapsed"`, options can also be used to
1397
+ * create Outlines and Grouping. See @ref working_with_outlines.
1398
+ *
1399
+ * @code
1400
+ * // The option structs with the outline level set.
1401
+ * lxw_row_col_options options1 = {.hidden = 0, .level = 2, .collapsed = 0};
1402
+ * lxw_row_col_options options2 = {.hidden = 0, .level = 1, .collapsed = 0};
1403
+ *
1404
+ *
1405
+ * // Set the row options with the outline level.
1406
+ * worksheet_set_row_opt(worksheet, 1, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1407
+ * worksheet_set_row_opt(worksheet, 2, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1408
+ * worksheet_set_row_opt(worksheet, 3, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1409
+ * worksheet_set_row_opt(worksheet, 4, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1410
+ * worksheet_set_row_opt(worksheet, 5, LXW_DEF_ROW_HEIGHT, NULL, &options2);
1411
+ *
1412
+ * worksheet_set_row_opt(worksheet, 6, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1413
+ * worksheet_set_row_opt(worksheet, 7, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1414
+ * worksheet_set_row_opt(worksheet, 8, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1415
+ * worksheet_set_row_opt(worksheet, 9, LXW_DEF_ROW_HEIGHT, NULL, &options1);
1416
+ * worksheet_set_row_opt(worksheet, 10, LXW_DEF_ROW_HEIGHT, NULL, &options2);
1417
+ * @endcode
1418
+ *
1419
+ * @image html outline1.png
1420
+ *
1383
1421
  */
1384
1422
  lxw_error worksheet_set_row_opt(lxw_worksheet *worksheet,
1385
1423
  lxw_row_t row,
@@ -1487,36 +1525,48 @@ lxw_error worksheet_set_column(lxw_worksheet *worksheet,
1487
1525
  lxw_col_t last_col,
1488
1526
  double width, lxw_format *format);
1489
1527
 
1490
- /**
1491
- * @brief Set the properties for one or more columns of cells with options.
1492
- *
1493
- * @param worksheet Pointer to a lxw_worksheet instance to be updated.
1494
- * @param first_col The zero indexed first column.
1495
- * @param last_col The zero indexed last column.
1496
- * @param width The width of the column(s).
1497
- * @param format A pointer to a Format instance or NULL.
1498
- * @param options Optional row parameters: hidden, level, collapsed.
1499
- *
1500
- * The `%worksheet_set_column_opt()` function is the same as
1501
- * `worksheet_set_column()` with an additional `options` parameter.
1502
- *
1503
- * The `options` parameter is a #lxw_row_col_options struct. It has the
1504
- * following members but currently only the `hidden` property is supported:
1505
- *
1506
- * - `hidden`
1507
- * - `level`
1508
- * - `collapsed`
1509
- *
1510
- * The `"hidden"` option is used to hide a column. This can be used, for
1511
- * example, to hide intermediary steps in a complicated calculation:
1512
- *
1513
- * @code
1514
- * lxw_row_col_options options = {.hidden = 1, .level = 0, .collapsed = 0};
1515
- *
1516
- * worksheet_set_column_opt(worksheet, COLS("A:A"), 8.43, NULL, &options);
1517
- * @endcode
1518
- *
1519
- */
1528
+ /**
1529
+ * @brief Set the properties for one or more columns of cells with options.
1530
+ *
1531
+ * @param worksheet Pointer to a lxw_worksheet instance to be updated.
1532
+ * @param first_col The zero indexed first column.
1533
+ * @param last_col The zero indexed last column.
1534
+ * @param width The width of the column(s).
1535
+ * @param format A pointer to a Format instance or NULL.
1536
+ * @param options Optional row parameters: hidden, level, collapsed.
1537
+ *
1538
+ * The `%worksheet_set_column_opt()` function is the same as
1539
+ * `worksheet_set_column()` with an additional `options` parameter.
1540
+ *
1541
+ * The `options` parameter is a #lxw_row_col_options struct. It has the
1542
+ * following members:
1543
+ *
1544
+ * - `hidden`
1545
+ * - `level`
1546
+ * - `collapsed`
1547
+ *
1548
+ * The `"hidden"` option is used to hide a column. This can be used, for
1549
+ * example, to hide intermediary steps in a complicated calculation:
1550
+ *
1551
+ * @code
1552
+ * lxw_row_col_options options1 = {.hidden = 1, .level = 0, .collapsed = 0};
1553
+ *
1554
+ * worksheet_set_column_opt(worksheet, COLS("D:E"), LXW_DEF_COL_WIDTH, NULL, &options1);
1555
+ * @endcode
1556
+ *
1557
+ * @image html hide_row_col3.png
1558
+ *
1559
+ * The `"hidden"`, `"level"`, and `"collapsed"`, options can also be used to
1560
+ * create Outlines and Grouping. See @ref working_with_outlines.
1561
+ *
1562
+ * @code
1563
+ * lxw_row_col_options options1 = {.hidden = 0, .level = 1, .collapsed = 0};
1564
+ *
1565
+ * worksheet_set_column_opt(worksheet, COLS("B:G"), 5, NULL, &options1);
1566
+ * @endcode
1567
+ *
1568
+ * @image html outline8.png
1569
+ */
1520
1570
  lxw_error worksheet_set_column_opt(lxw_worksheet *worksheet,
1521
1571
  lxw_col_t first_col,
1522
1572
  lxw_col_t last_col,
@@ -2932,6 +2982,54 @@ void worksheet_set_tab_color(lxw_worksheet *worksheet, lxw_color_t color);
2932
2982
  void worksheet_protect(lxw_worksheet *worksheet, const char *password,
2933
2983
  lxw_protection *options);
2934
2984
 
2985
+ /**
2986
+ * @brief Set the Outline and Grouping display properties.
2987
+ *
2988
+ * @param worksheet Pointer to a lxw_worksheet instance to be updated.
2989
+ * @param visible Outlines are visible. Optional, defaults to True.
2990
+ * @param symbols_below Show row outline symbols below the outline bar.
2991
+ * @param symbols_right Show column outline symbols to the right of outline.
2992
+ * @param auto_style Use Automatic outline style.
2993
+ *
2994
+ * The `%worksheet_outline_settings()` method is used to control the
2995
+ * appearance of outlines in Excel. Outlines are described the section on
2996
+ * @ref working_with_outlines.
2997
+ *
2998
+ * The `visible` parameter is used to control whether or not outlines are
2999
+ * visible. Setting this parameter to False will cause all outlines on the
3000
+ * worksheet to be hidden. They can be un-hidden in Excel by means of the
3001
+ * "Show Outline Symbols" command button. The default Excel setting is True
3002
+ * for visible outlines.
3003
+ *
3004
+ * The `symbols_below` parameter is used to control whether the row outline
3005
+ * symbol will appear above or below the outline level bar. The default Excel
3006
+ * setting is True for symbols to appear below the outline level bar.
3007
+ *
3008
+ * The `symbols_right` parameter is used to control whether the column outline
3009
+ * symbol will appear to the left or the right of the outline level bar. The
3010
+ * default Excel setting is True for symbols to appear to the right of the
3011
+ * outline level bar.
3012
+ *
3013
+ * The `auto_style` parameter is used to control whether the automatic outline
3014
+ * generator in Excel uses automatic styles when creating an outline. This has
3015
+ * no effect on a file generated by XlsxWriter but it does have an effect on
3016
+ * how the worksheet behaves after it is created. The default Excel setting is
3017
+ * False for "Automatic Styles" to be turned off.
3018
+ *
3019
+ * The default settings for all of these parameters in libxlsxwriter
3020
+ * correspond to Excel's default parameters and are shown below:
3021
+ *
3022
+ * @code
3023
+ * worksheet_outline_settings(worksheet1, LXW_TRUE, LXW_TRUE, LXW_TRUE, LXW_FALSE);
3024
+ * @endcode
3025
+ *
3026
+ * The worksheet parameters controlled by `worksheet_outline_settings()` are
3027
+ * rarely used.
3028
+ */
3029
+ void worksheet_outline_settings(lxw_worksheet *worksheet, uint8_t visible,
3030
+ uint8_t symbols_below, uint8_t symbols_right,
3031
+ uint8_t auto_style);
3032
+
2935
3033
  /**
2936
3034
  * @brief Set the default row properties.
2937
3035
  *