write_xlsx 0.99.0 → 1.07.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -1
- data/Changes +70 -0
- data/README.md +1 -1
- data/examples/a_simple.rb +1 -1
- data/examples/add_vba_project.rb +1 -1
- data/examples/array_formula.rb +1 -1
- data/examples/chart_area.rb +5 -2
- data/examples/chart_bar.rb +5 -2
- data/examples/chart_clustered.rb +1 -1
- data/examples/chart_column.rb +5 -2
- data/examples/chart_combined.rb +1 -1
- data/examples/chart_data_labels.rb +320 -0
- data/examples/chart_data_table.rb +9 -3
- data/examples/chart_data_tools.rb +25 -7
- data/examples/chart_doughnut.rb +17 -5
- data/examples/chart_gauge.rb +73 -0
- data/examples/chart_line.rb +90 -12
- data/examples/chart_pareto.rb +1 -1
- data/examples/chart_pie.rb +9 -3
- data/examples/chart_radar.rb +13 -4
- data/examples/chart_scatter.rb +5 -2
- data/examples/chart_secondary_axis.rb +5 -2
- data/examples/chart_stock.rb +1 -1
- data/examples/chart_styles.rb +1 -1
- data/examples/colors.rb +1 -1
- data/examples/data_validate.rb +1 -1
- data/examples/date_time.rb +1 -1
- data/examples/demo.rb +4 -1
- data/examples/formats.rb +1 -1
- data/examples/headers.rb +1 -1
- data/examples/hide_row_col.rb +1 -1
- data/examples/hide_sheet.rb +1 -1
- data/examples/hyperlink1.rb +1 -1
- data/examples/indent.rb +1 -1
- data/examples/macros.rb +1 -1
- data/examples/merge1.rb +1 -1
- data/examples/merge2.rb +1 -1
- data/examples/merge3.rb +1 -1
- data/examples/merge4.rb +1 -1
- data/examples/merge5.rb +1 -1
- data/examples/merge6.rb +1 -1
- data/examples/outline.rb +1 -1
- data/examples/outline_collapsed.rb +1 -1
- data/examples/panes.rb +1 -1
- data/examples/properties.rb +1 -1
- data/examples/regions.rb +1 -1
- data/examples/rich_strings.rb +1 -1
- data/examples/right_to_left.rb +1 -1
- data/examples/shape1.rb +1 -1
- data/examples/shape2.rb +1 -1
- data/examples/shape3.rb +1 -1
- data/examples/shape4.rb +1 -1
- data/examples/shape5.rb +1 -1
- data/examples/shape6.rb +1 -1
- data/examples/shape7.rb +1 -1
- data/examples/shape8.rb +1 -1
- data/examples/shape_all.rb +1 -1
- data/examples/sparklines1.rb +1 -1
- data/examples/sparklines2.rb +1 -1
- data/examples/stats.rb +1 -1
- data/examples/stats_ext.rb +1 -1
- data/examples/stocks.rb +1 -1
- data/examples/tab_colors.rb +1 -1
- data/examples/tables.rb +78 -43
- data/lib/write_xlsx/chart.rb +163 -34
- data/lib/write_xlsx/chart/area.rb +1 -1
- data/lib/write_xlsx/chart/bar.rb +1 -1
- data/lib/write_xlsx/chart/column.rb +1 -1
- data/lib/write_xlsx/chart/doughnut.rb +1 -1
- data/lib/write_xlsx/chart/line.rb +16 -2
- data/lib/write_xlsx/chart/pie.rb +21 -8
- data/lib/write_xlsx/chart/radar.rb +1 -1
- data/lib/write_xlsx/chart/scatter.rb +1 -1
- data/lib/write_xlsx/chart/series.rb +100 -0
- data/lib/write_xlsx/chart/stock.rb +1 -1
- data/lib/write_xlsx/chartsheet.rb +5 -5
- data/lib/write_xlsx/drawing.rb +86 -30
- data/lib/write_xlsx/format.rb +5 -5
- data/lib/write_xlsx/package/comments.rb +11 -11
- data/lib/write_xlsx/package/relationships.rb +4 -4
- data/lib/write_xlsx/package/styles.rb +26 -8
- data/lib/write_xlsx/package/table.rb +8 -7
- data/lib/write_xlsx/package/vml.rb +20 -19
- data/lib/write_xlsx/shape.rb +4 -3
- data/lib/write_xlsx/sheets.rb +18 -16
- data/lib/write_xlsx/sparkline.rb +1 -1
- data/lib/write_xlsx/utility.rb +40 -7
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +69 -44
- data/lib/write_xlsx/worksheet.rb +206 -138
- data/lib/write_xlsx/worksheet/hyperlink.rb +16 -37
- data/test/drawing/test_drawing_chart_01.rb +6 -2
- data/test/drawing/test_drawing_image_01.rb +12 -3
- data/test/drawing/test_drawing_shape_01.rb +8 -5
- data/test/drawing/test_drawing_shape_02.rb +12 -5
- data/test/drawing/test_drawing_shape_03.rb +8 -5
- data/test/drawing/test_drawing_shape_04.rb +8 -24
- data/test/drawing/test_drawing_shape_05.rb +8 -5
- data/test/drawing/test_drawing_shape_06.rb +11 -6
- data/test/drawing/test_drawing_shape_07.rb +11 -6
- data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
- data/test/drawing/test_write_c_chart.rb +1 -1
- data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +1 -1
- data/test/drawing/test_write_c_nv_pr.rb +1 -1
- data/test/drawing/test_write_col.rb +1 -1
- data/test/drawing/test_write_col_off.rb +1 -1
- data/test/drawing/test_write_ext.rb +1 -1
- data/test/drawing/test_write_pos.rb +1 -1
- data/test/drawing/test_write_row.rb +1 -1
- data/test/drawing/test_write_row_off.rb +1 -1
- data/test/drawing/test_write_xfrm_extension.rb +1 -1
- data/test/drawing/test_write_xfrm_offset.rb +1 -1
- data/test/perl_output/chart_data_labels.xlsx +0 -0
- data/test/perl_output/chart_gauge.xlsx +0 -0
- data/test/perl_output/chart_line.xlsx +0 -0
- data/test/perl_output/comments2.xlsx +0 -0
- data/test/perl_output/tables.xlsx +0 -0
- data/test/regression/images/red2.png +0 -0
- data/test/regression/test_array_formula04.rb +31 -0
- data/test/regression/test_chart_axis26.rb +10 -8
- data/test/regression/test_chart_axis27.rb +1 -1
- data/test/regression/test_chart_axis28.rb +1 -1
- data/test/regression/test_chart_axis29.rb +1 -1
- data/test/regression/test_chart_axis33.rb +1 -1
- data/test/regression/test_chart_axis44.rb +54 -0
- data/test/regression/test_chart_axis45.rb +54 -0
- data/test/regression/test_chart_axis46.rb +54 -0
- data/test/regression/test_chart_combined10.rb +43 -0
- data/test/regression/test_chart_combined11.rb +63 -0
- data/test/regression/test_chart_data_labels25.rb +1 -1
- data/test/regression/test_chart_data_labels26.rb +44 -0
- data/test/regression/test_chart_data_labels27.rb +44 -0
- data/test/regression/test_chart_data_labels28.rb +52 -0
- data/test/regression/test_chart_data_labels29.rb +43 -0
- data/test/regression/test_chart_data_labels30.rb +46 -0
- data/test/regression/test_chart_data_labels31.rb +49 -0
- data/test/regression/test_chart_data_labels32.rb +54 -0
- data/test/regression/test_chart_data_labels33.rb +52 -0
- data/test/regression/test_chart_data_labels34.rb +54 -0
- data/test/regression/test_chart_data_labels35.rb +46 -0
- data/test/regression/test_chart_data_labels36.rb +54 -0
- data/test/regression/test_chart_data_labels37.rb +51 -0
- data/test/regression/test_chart_data_labels38.rb +54 -0
- data/test/regression/test_chart_data_labels39.rb +53 -0
- data/test/regression/test_chart_data_labels40.rb +53 -0
- data/test/regression/test_chart_data_labels41.rb +54 -0
- data/test/regression/test_chart_data_labels42.rb +58 -0
- data/test/regression/test_chart_data_labels43.rb +58 -0
- data/test/regression/test_chart_data_labels44.rb +56 -0
- data/test/regression/test_chart_data_labels45.rb +57 -0
- data/test/regression/test_chart_data_labels46.rb +61 -0
- data/test/regression/test_chart_data_labels47.rb +61 -0
- data/test/regression/test_chart_doughnut07.rb +37 -0
- data/test/regression/test_chart_font09.rb +1 -1
- data/test/regression/test_chart_line05.rb +43 -0
- data/test/regression/test_chart_line06.rb +43 -0
- data/test/regression/test_chart_size03.rb +4 -1
- data/test/regression/test_comment14.rb +29 -0
- data/test/regression/test_comment15.rb +28 -0
- data/test/regression/test_comment16.rb +34 -0
- data/test/regression/test_header_image15.rb +36 -0
- data/test/regression/test_header_image16.rb +42 -0
- data/test/regression/test_header_image17.rb +46 -0
- data/test/regression/test_header_image18.rb +48 -0
- data/test/regression/test_header_image19.rb +36 -0
- data/test/regression/test_hyperlink32.rb +27 -0
- data/test/regression/test_hyperlink33.rb +28 -0
- data/test/regression/test_hyperlink34.rb +33 -0
- data/test/regression/test_hyperlink35.rb +39 -0
- data/test/regression/test_hyperlink36.rb +34 -0
- data/test/regression/test_hyperlink37.rb +33 -0
- data/test/regression/test_hyperlink38.rb +27 -0
- data/test/regression/test_hyperlink39.rb +27 -0
- data/test/regression/test_hyperlink40.rb +27 -0
- data/test/regression/test_hyperlink41.rb +27 -0
- data/test/regression/test_hyperlink42.rb +27 -0
- data/test/regression/test_hyperlink43.rb +27 -0
- data/test/regression/test_hyperlink44.rb +27 -0
- data/test/regression/test_hyperlink45.rb +27 -0
- data/test/regression/test_hyperlink47.rb +27 -0
- data/test/regression/test_hyperlink48.rb +31 -0
- data/test/regression/test_hyperlink49.rb +29 -0
- data/test/regression/test_image06.rb +5 -5
- data/test/regression/test_image08.rb +5 -4
- data/test/regression/test_image15.rb +4 -2
- data/test/regression/test_image28.rb +1 -1
- data/test/regression/test_image44.rb +28 -0
- data/test/regression/test_image45.rb +29 -0
- data/test/regression/test_image46.rb +29 -0
- data/test/regression/test_image47.rb +28 -0
- data/test/regression/test_image48.rb +32 -0
- data/test/regression/test_image49.rb +38 -0
- data/test/regression/test_image50.rb +24 -0
- data/test/regression/test_image51.rb +30 -0
- data/test/regression/test_object_position01.rb +26 -0
- data/test/regression/test_object_position02.rb +26 -0
- data/test/regression/test_object_position03.rb +26 -0
- data/test/regression/test_object_position04.rb +44 -0
- data/test/regression/test_object_position06.rb +28 -0
- data/test/regression/test_object_position07.rb +28 -0
- data/test/regression/test_object_position08.rb +47 -0
- data/test/regression/test_object_position09.rb +50 -0
- data/test/regression/test_object_position10.rb +28 -0
- data/test/regression/test_object_position12.rb +25 -0
- data/test/regression/test_object_position13.rb +25 -0
- data/test/regression/test_object_position14.rb +25 -0
- data/test/regression/test_object_position15.rb +29 -0
- data/test/regression/test_object_position16.rb +29 -0
- data/test/regression/test_object_position17.rb +29 -0
- data/test/regression/test_object_position18.rb +29 -0
- data/test/regression/test_object_position19.rb +29 -0
- data/test/regression/test_object_position20.rb +29 -0
- data/test/regression/test_shape_connect01.rb +4 -2
- data/test/regression/test_table24.rb +27 -0
- data/test/regression/test_table25.rb +27 -0
- data/test/regression/xlsx_files/array_formula04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels30.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels31.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels32.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels33.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels34.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels35.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels36.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels37.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels38.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels39.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels40.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels41.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels42.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels43.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels44.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels45.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels46.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels47.xlsx +0 -0
- data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
- data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
- data/test/regression/xlsx_files/comment14.xlsx +0 -0
- data/test/regression/xlsx_files/comment15.xlsx +0 -0
- data/test/regression/xlsx_files/comment16.xlsx +0 -0
- data/test/regression/xlsx_files/header_image15.xlsx +0 -0
- data/test/regression/xlsx_files/header_image16.xlsx +0 -0
- data/test/regression/xlsx_files/header_image17.xlsx +0 -0
- data/test/regression/xlsx_files/header_image18.xlsx +0 -0
- data/test/regression/xlsx_files/header_image19.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink32.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink33.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink34.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink35.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink36.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink37.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink38.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink39.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink40.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink41.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink42.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink43.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink44.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink45.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink47.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink48.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink49.xlsx +0 -0
- data/test/regression/xlsx_files/image06.xlsx +0 -0
- data/test/regression/xlsx_files/image44.xlsx +0 -0
- data/test/regression/xlsx_files/image45.xlsx +0 -0
- data/test/regression/xlsx_files/image46.xlsx +0 -0
- data/test/regression/xlsx_files/image47.xlsx +0 -0
- data/test/regression/xlsx_files/image48.xlsx +0 -0
- data/test/regression/xlsx_files/image49.xlsx +0 -0
- data/test/regression/xlsx_files/image50.xlsx +0 -0
- data/test/regression/xlsx_files/image51.xlsx +0 -0
- data/test/regression/xlsx_files/object_position01.xlsx +0 -0
- data/test/regression/xlsx_files/object_position02.xlsx +0 -0
- data/test/regression/xlsx_files/object_position03.xlsx +0 -0
- data/test/regression/xlsx_files/object_position04.xlsx +0 -0
- data/test/regression/xlsx_files/object_position06.xlsx +0 -0
- data/test/regression/xlsx_files/object_position07.xlsx +0 -0
- data/test/regression/xlsx_files/object_position08.xlsx +0 -0
- data/test/regression/xlsx_files/object_position09.xlsx +0 -0
- data/test/regression/xlsx_files/object_position10.xlsx +0 -0
- data/test/regression/xlsx_files/object_position12.xlsx +0 -0
- data/test/regression/xlsx_files/object_position13.xlsx +0 -0
- data/test/regression/xlsx_files/object_position14.xlsx +0 -0
- data/test/regression/xlsx_files/object_position15.xlsx +0 -0
- data/test/regression/xlsx_files/object_position16.xlsx +0 -0
- data/test/regression/xlsx_files/object_position17.xlsx +0 -0
- data/test/regression/xlsx_files/object_position18.xlsx +0 -0
- data/test/regression/xlsx_files/object_position19.xlsx +0 -0
- data/test/regression/xlsx_files/object_position20.xlsx +0 -0
- data/test/regression/xlsx_files/table24.xlsx +0 -0
- data/test/regression/xlsx_files/table25.xlsx +0 -0
- data/test/test_example_match.rb +1268 -780
- data/test/workbook/test_check_sheetname.rb +51 -0
- data/write_xlsx.gemspec +1 -0
- metadata +367 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 677847fdb975ab7253b3a5ed5f6aa779a9bbf2a459e941f5037b7d557e2abfe4
|
4
|
+
data.tar.gz: 4c4b0b03ce3b510a0ad6423c30a76fc778463afe92f992da52b49bbe65c7a1ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f81d2d54e5f7a7170c34e7666f58c7f4f77b993ff3b95263327b0ff8edff5c9a0b1a6ea825ece5b43c5b1d2b91a6f01764237f22ee6442bd8c747de8e04150
|
7
|
+
data.tar.gz: 3e49064459345dbcc5d97fef0f8154159776e8361cb0709e8a4564f32dd062fe95b6e4f08976df81b5ac478a40287be9a33086726444af3c75d1cbeb5c869dc2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Changes
CHANGED
@@ -1,5 +1,75 @@
|
|
1
1
|
Change history of write_xlsx rubygem.
|
2
2
|
|
3
|
+
2021-02-17 v1.07.0
|
4
|
+
|
5
|
+
Added support for Border, Fill, Pattern and Gradient formatting to chart
|
6
|
+
data labels and chart custom data labels.
|
7
|
+
|
8
|
+
|
9
|
+
2021-02-15 v1.06.0
|
10
|
+
|
11
|
+
Fix for issue where array formulas weren't included in the output file
|
12
|
+
for certain ranges/conditions.
|
13
|
+
|
14
|
+
|
15
|
+
2021-02-15 v1.05.0
|
16
|
+
|
17
|
+
Added support for custom data labels in charts.
|
18
|
+
|
19
|
+
Remove ruby-1.9.3 travil CI check.
|
20
|
+
|
21
|
+
|
22
|
+
2021-02-14 v1.04.0
|
23
|
+
|
24
|
+
Added support for "stacked" and "percent_stacked" Line charts.
|
25
|
+
|
26
|
+
Fix for worksheet objects (charts and images) that are inserted with an
|
27
|
+
offset that starts in a hidden cell.
|
28
|
+
|
29
|
+
Removed error in add_worksheet() for sheet name "History" which is a
|
30
|
+
reserved name in English version of Excel. However, this is an allowed
|
31
|
+
worksheet name in some Excel variants so the warning has been turned into
|
32
|
+
a documentation note instead.
|
33
|
+
|
34
|
+
|
35
|
+
2021-02-13 v1.03.0
|
36
|
+
|
37
|
+
Fix for duplicate images being copied to an Excel::Writer::XLSX
|
38
|
+
file. Excel uses an optimization where it only stores one copy of a
|
39
|
+
repeated/duplicate image in a workbook. WriteXLSX didn't do
|
40
|
+
this which meant that the file size would increase when then was a large
|
41
|
+
number of repeated images. This release fixes that issue and replicates
|
42
|
+
Excel's behaviour.
|
43
|
+
|
44
|
+
2021-02-12 v1.02.0
|
45
|
+
|
46
|
+
Added support for hyperlinks in worksheet images.
|
47
|
+
|
48
|
+
Increased allowable url length from 255 to 2079 characters, as allowed in
|
49
|
+
more recent versions of Excel.
|
50
|
+
|
51
|
+
|
52
|
+
2021-02-08 v1.01.0
|
53
|
+
|
54
|
+
Added support for stacked and East Asian vertical chart fonts.
|
55
|
+
|
56
|
+
Added option to control positioning of charts or images when cells are
|
57
|
+
resized.
|
58
|
+
|
59
|
+
Added support for combining Pie/Doughnut charts.
|
60
|
+
|
61
|
+
Fixed sizing of cell comment boxes when they cross columns/rows that have
|
62
|
+
size changes that occur after the comment is written. Comments should
|
63
|
+
now behave like other worksheet objects such as images and charts.
|
64
|
+
|
65
|
+
Fix for structured reference in chart ranges.
|
66
|
+
|
67
|
+
2021-01-23 v1.00.0
|
68
|
+
|
69
|
+
Fixed issue where images that started in hidden rows/columns weren't placed
|
70
|
+
correctly in the worksheet.
|
71
|
+
|
72
|
+
|
3
73
|
2021-01-08 v0.99.0
|
4
74
|
|
5
75
|
Added font and font_size parameters to write_comment().
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
gem to create a new file in the Excel 2007+ XLSX format, and you can use the
|
7
7
|
same interface as writeexcel gem. write_xlsx is converted from Perl's module
|
8
|
-
[Excel::Writer::XLSX-
|
8
|
+
[Excel::Writer::XLSX-1.07](https://github.com/jmcnamara/excel-writer-xlsx/tree/CPAN_1.07)
|
9
9
|
|
10
10
|
## Description
|
11
11
|
|
data/examples/a_simple.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# write text and numbers to an Excel xlsx file.
|
8
8
|
#
|
9
9
|
# reverse(c), March 2001, John McNamara, jmcnamara@cpan.org
|
10
|
-
# convert to ruby by Hideo NAKAMURA,
|
10
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
11
11
|
#
|
12
12
|
|
13
13
|
require 'write_xlsx'
|
data/examples/add_vba_project.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# used to extract the vbaProject.bin file.
|
11
11
|
#
|
12
12
|
# reverse('(c)'), November 2012, John McNamara, jmcnamara@cpan.org
|
13
|
-
# convert to ruby by Hideo NAKAMURA,
|
13
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
14
14
|
#
|
15
15
|
|
16
16
|
require 'write_xlsx'
|
data/examples/array_formula.rb
CHANGED
data/examples/chart_area.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# A demo of an Area chart in Excel::Writer::XLSX.
|
7
7
|
#
|
8
8
|
# reverse('ゥ'), March 2011, John McNamara, jmcnamara@cpan.org
|
9
|
-
# convert to ruby by Hideo NAKAMURA,
|
9
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'write_xlsx'
|
@@ -53,6 +53,9 @@
|
|
53
53
|
chart.set_style(11)
|
54
54
|
|
55
55
|
# Insert the chart into the worksheet (with an offset).
|
56
|
-
worksheet.insert_chart(
|
56
|
+
worksheet.insert_chart(
|
57
|
+
'D2', chart,
|
58
|
+
:x_offset => 25, :y_offset => 10
|
59
|
+
)
|
57
60
|
|
58
61
|
workbook.close
|
data/examples/chart_bar.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# A demo of an Bar chart in Excel::Writer::XLSX.
|
7
7
|
#
|
8
8
|
# reverse('c'), March 2011, John McNamara, jmcnamara@cpan.org
|
9
|
-
# convert to ruby by Hideo NAKAMURA,
|
9
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'write_xlsx'
|
@@ -53,6 +53,9 @@
|
|
53
53
|
chart.set_style(11)
|
54
54
|
|
55
55
|
# Insert the chart into the worksheet (with an offset).
|
56
|
-
worksheet.insert_chart(
|
56
|
+
worksheet.insert_chart(
|
57
|
+
'D2', chart,
|
58
|
+
:x_offset => 25, :y_offset => 10
|
59
|
+
)
|
57
60
|
|
58
61
|
workbook.close
|
data/examples/chart_clustered.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# A demo of a clustered category chart in Excel::Writer::XLSX.
|
6
6
|
#
|
7
7
|
# reverse ('(c)'), March 2015, John McNamara, jmcnamara@cpan.org
|
8
|
-
# convert to ruby by Hideo NAKAMURA,
|
8
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'write_xlsx'
|
data/examples/chart_column.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# A demo of an Area chart in Excel::Writer::XLSX.
|
7
7
|
#
|
8
8
|
# reverse('ゥ'), March 2011, John McNamara, jmcnamara@cpan.org
|
9
|
-
# convert to ruby by Hideo NAKAMURA,
|
9
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'write_xlsx'
|
@@ -53,6 +53,9 @@
|
|
53
53
|
chart.set_style(11)
|
54
54
|
|
55
55
|
# Insert the chart into the worksheet (with an offset).
|
56
|
-
worksheet.insert_chart(
|
56
|
+
worksheet.insert_chart(
|
57
|
+
'D2', chart,
|
58
|
+
:x_offset => 25, :y_offset => 10
|
59
|
+
)
|
57
60
|
|
58
61
|
workbook.close
|
data/examples/chart_combined.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# An example of a Combined chart in WriteXLSX.
|
7
7
|
#
|
8
8
|
# reverse ('(c)'), March 2015, John McNamara, jmcnamara@cpan.org
|
9
|
-
# convert to ruby by Hideo NAKAMURA,
|
9
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'write_xlsx'
|
@@ -0,0 +1,320 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
#######################################################################
|
5
|
+
#
|
6
|
+
# A demo of an various Excel chart data label features that are available
|
7
|
+
# via an WriteXLSX chart.
|
8
|
+
#
|
9
|
+
# Copyright 2000-2020, John McNamara, jmcnamara@cpan.org
|
10
|
+
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'write_xlsx'
|
14
|
+
|
15
|
+
workbook = WriteXLSX.new('chart_data_labels.xlsx')
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
bold = workbook.add_format(:bold => 1)
|
18
|
+
|
19
|
+
# Add the worksheet data that the charts will refer to.
|
20
|
+
headings = ['Number', 'Data', 'Text']
|
21
|
+
data = [
|
22
|
+
[ 2, 3, 4, 5, 6, 7 ],
|
23
|
+
[20, 10, 20, 30, 40, 30 ],
|
24
|
+
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
|
25
|
+
]
|
26
|
+
|
27
|
+
worksheet.write('A1', headings, bold)
|
28
|
+
worksheet.write('A2', data)
|
29
|
+
|
30
|
+
|
31
|
+
#######################################################################
|
32
|
+
#
|
33
|
+
# Example with standard data labels.
|
34
|
+
#
|
35
|
+
|
36
|
+
# Create a Column chart.
|
37
|
+
chart1 = workbook.add_chart(:type => 'column', :embedded => 1)
|
38
|
+
|
39
|
+
# Configure the data series and add the data labels.
|
40
|
+
chart1.add_series(
|
41
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
42
|
+
:values => '=Sheet1!$B$2:$B$7',
|
43
|
+
:data_labels => { :value => 1 }
|
44
|
+
)
|
45
|
+
|
46
|
+
# Add a chart title.
|
47
|
+
chart1.set_title(:name => 'Chart with standard data labels')
|
48
|
+
|
49
|
+
# Turn off the chart legend.
|
50
|
+
chart1.set_legend(:none => 1)
|
51
|
+
|
52
|
+
# Insert the chart into the worksheet (with an offset).
|
53
|
+
worksheet.insert_chart('D2', chart1, { :x_offset => 25, :y_offset => 10 })
|
54
|
+
|
55
|
+
|
56
|
+
#######################################################################
|
57
|
+
#
|
58
|
+
# Example with value and category data labels.
|
59
|
+
#
|
60
|
+
|
61
|
+
# Create a Column chart.
|
62
|
+
chart2 = workbook.add_chart(:type => 'column', :embedded => 1)
|
63
|
+
|
64
|
+
# Configure the data series and add the data labels.
|
65
|
+
chart2.add_series(
|
66
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
67
|
+
:values => '=Sheet1!$B$2:$B$7',
|
68
|
+
:data_labels => { :value => 1, :category => 1 }
|
69
|
+
)
|
70
|
+
|
71
|
+
# Add a chart title.
|
72
|
+
chart2.set_title(:name => 'Category and Value data labels')
|
73
|
+
|
74
|
+
# Turn off the chart legend.
|
75
|
+
chart2.set_legend(:none => 1)
|
76
|
+
|
77
|
+
# Insert the chart into the worksheet (with an offset).
|
78
|
+
worksheet.insert_chart('D18', chart2, { :x_offset => 25, :y_offset => 10 })
|
79
|
+
|
80
|
+
|
81
|
+
#######################################################################
|
82
|
+
#
|
83
|
+
# Example with standard data labels with different font.
|
84
|
+
#
|
85
|
+
|
86
|
+
# Create a Column chart.
|
87
|
+
chart3 = workbook.add_chart(:type => 'column', :embedded => 1)
|
88
|
+
|
89
|
+
# Configure the data series and add the data labels.
|
90
|
+
chart3.add_series(
|
91
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
92
|
+
:values => '=Sheet1!$B$2:$B$7',
|
93
|
+
:data_labels => { :value => 1,
|
94
|
+
:font => {:bold => 1,
|
95
|
+
:color => 'red',
|
96
|
+
:rotation => -30}
|
97
|
+
}
|
98
|
+
)
|
99
|
+
|
100
|
+
# Add a chart title.
|
101
|
+
chart3.set_title(:name => 'Data labels with user defined font')
|
102
|
+
|
103
|
+
# Turn off the chart legend.
|
104
|
+
chart3.set_legend(:none => 1)
|
105
|
+
|
106
|
+
# Insert the chart into the worksheet (with an offset).
|
107
|
+
worksheet.insert_chart('D34', chart3, { :x_offset => 25, :y_offset => 10 })
|
108
|
+
|
109
|
+
|
110
|
+
#######################################################################
|
111
|
+
#
|
112
|
+
# Example with custom string data labels.
|
113
|
+
#
|
114
|
+
|
115
|
+
# Create a Column chart.
|
116
|
+
chart4 = workbook.add_chart(:type => 'column', :embedded => 1)
|
117
|
+
|
118
|
+
# Configure the data series and add the data labels.
|
119
|
+
chart4.add_series(
|
120
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
121
|
+
:values => '=Sheet1!$B$2:$B$7',
|
122
|
+
:data_labels => {
|
123
|
+
:value => 1,
|
124
|
+
:border => {:color => 'red'},
|
125
|
+
:fill => {:color => 'yellow'}
|
126
|
+
}
|
127
|
+
)
|
128
|
+
|
129
|
+
# Add a chart title.
|
130
|
+
chart4.set_title(:name => 'Data labels with formatting')
|
131
|
+
|
132
|
+
# Turn off the chart legend.
|
133
|
+
chart4.set_legend(:none => 1)
|
134
|
+
|
135
|
+
# Insert the chart into the worksheet (with an offset).
|
136
|
+
worksheet.insert_chart('D50', chart4, { :x_offset => 25, :y_offset => 10 })
|
137
|
+
|
138
|
+
|
139
|
+
#######################################################################
|
140
|
+
#
|
141
|
+
# Example with custom string data labels.
|
142
|
+
#
|
143
|
+
|
144
|
+
# Create a Column chart.
|
145
|
+
chart5 = workbook.add_chart( :type => 'column', :embedded => 1 )
|
146
|
+
|
147
|
+
# Some custom labels.
|
148
|
+
custom_labels = [
|
149
|
+
{ :value => 'Amy' },
|
150
|
+
{ :value => 'Bea' },
|
151
|
+
{ :value => 'Eva' },
|
152
|
+
{ :value => 'Fay' },
|
153
|
+
{ :value => 'Liv' },
|
154
|
+
{ :value => 'Una' }
|
155
|
+
]
|
156
|
+
|
157
|
+
# Configure the data series and add the data labels.
|
158
|
+
chart5.add_series(
|
159
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
160
|
+
:values => '=Sheet1!$B$2:$B$7',
|
161
|
+
:data_labels => { :value => 1, :custom => custom_labels }
|
162
|
+
)
|
163
|
+
|
164
|
+
# Add a chart title.
|
165
|
+
chart5.set_title(:name => 'Chart with custom string data labels')
|
166
|
+
|
167
|
+
# Turn off the chart legend.
|
168
|
+
chart5.set_legend(:none => 1)
|
169
|
+
|
170
|
+
# Insert the chart into the worksheet (with an offset).
|
171
|
+
worksheet.insert_chart('D66', chart5, { :x_offset => 25, :y_offset => 10 })
|
172
|
+
|
173
|
+
|
174
|
+
#######################################################################
|
175
|
+
#
|
176
|
+
# Example with custom data labels from cells.
|
177
|
+
#
|
178
|
+
|
179
|
+
# Create a Column chart.
|
180
|
+
chart6 = workbook.add_chart(:type => 'column', :embedded => 1)
|
181
|
+
|
182
|
+
# Some custom labels.
|
183
|
+
custom_labels = [
|
184
|
+
{ :value => '=Sheet1!$C$2' },
|
185
|
+
{ :value => '=Sheet1!$C$3' },
|
186
|
+
{ :value => '=Sheet1!$C$4' },
|
187
|
+
{ :value => '=Sheet1!$C$5' },
|
188
|
+
{ :value => '=Sheet1!$C$6' },
|
189
|
+
{ :value => '=Sheet1!$C$7' }
|
190
|
+
]
|
191
|
+
|
192
|
+
|
193
|
+
# Configure the data series and add the data labels.
|
194
|
+
chart6.add_series(
|
195
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
196
|
+
:values => '=Sheet1!$B$2:$B$7',
|
197
|
+
:data_labels => { :value => 1, :custom => custom_labels }
|
198
|
+
)
|
199
|
+
|
200
|
+
# Add a chart title.
|
201
|
+
chart6.set_title(:name => 'Chart with custom data labels from cells')
|
202
|
+
|
203
|
+
# Turn off the chart legend.
|
204
|
+
chart6.set_legend(:none => 1)
|
205
|
+
|
206
|
+
# Insert the chart into the worksheet (with an offset).
|
207
|
+
worksheet.insert_chart('D82', chart6, { :x_offset => 25, :y_offset => 10 })
|
208
|
+
|
209
|
+
|
210
|
+
#######################################################################
|
211
|
+
#
|
212
|
+
# Example with custom and default data labels.
|
213
|
+
#
|
214
|
+
|
215
|
+
# Create a Column chart.
|
216
|
+
chart7 = workbook.add_chart(:type => 'column', :embedded => 1)
|
217
|
+
|
218
|
+
# Some custom labels. The nil items will get the default value.
|
219
|
+
# We also set a font for the custom items as an extra example.
|
220
|
+
custom_labels = [
|
221
|
+
{ :value => '=Sheet1!$C$2', :font => { :color => 'red' } },
|
222
|
+
nil,
|
223
|
+
{ :value => '=Sheet1!$C$4', :font => { :color => 'red' } },
|
224
|
+
{ :value => '=Sheet1!$C$5', :font => { :color => 'red' } }
|
225
|
+
]
|
226
|
+
|
227
|
+
|
228
|
+
# Configure the data series and add the data labels.
|
229
|
+
chart7.add_series(
|
230
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
231
|
+
:values => '=Sheet1!$B$2:$B$7',
|
232
|
+
:data_labels => { :value => 1, :custom => custom_labels }
|
233
|
+
)
|
234
|
+
|
235
|
+
# Add a chart title.
|
236
|
+
chart7.set_title(:name => 'Mixed custom and default data labels')
|
237
|
+
|
238
|
+
# Turn off the chart legend.
|
239
|
+
chart7.set_legend(:none => 1)
|
240
|
+
|
241
|
+
# Insert the chart into the worksheet (with an offset).
|
242
|
+
worksheet.insert_chart('D98', chart7, { :x_offset => 25, :y_offset => 10 })
|
243
|
+
|
244
|
+
|
245
|
+
#######################################################################
|
246
|
+
#
|
247
|
+
# Example with deleted custom data labels.
|
248
|
+
#
|
249
|
+
|
250
|
+
# Create a Column chart.
|
251
|
+
chart8 = workbook.add_chart(:type => 'column', :embedded => 1)
|
252
|
+
|
253
|
+
# Some deleted custom labels and defaults (nil). This allows us to
|
254
|
+
# highlight certain values such as the minimum and maximum.
|
255
|
+
custom_labels = [
|
256
|
+
{ :delete => 1 },
|
257
|
+
nil,
|
258
|
+
{ :delete => 1 },
|
259
|
+
{ :delete => 1 },
|
260
|
+
nil,
|
261
|
+
{ :delete => 1 }
|
262
|
+
]
|
263
|
+
|
264
|
+
# Configure the data series and add the data labels.
|
265
|
+
chart8.add_series(
|
266
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
267
|
+
:values => '=Sheet1!$B$2:$B$7',
|
268
|
+
:data_labels => { :value => 1, :custom => custom_labels }
|
269
|
+
)
|
270
|
+
|
271
|
+
# Add a chart title.
|
272
|
+
chart8.set_title(:name => 'Chart with deleted data labels')
|
273
|
+
|
274
|
+
# Turn off the chart legend.
|
275
|
+
chart8.set_legend(:none => 1)
|
276
|
+
|
277
|
+
# Insert the chart into the worksheet (with an offset).
|
278
|
+
worksheet.insert_chart('D114', chart8, { :x_offset => 25, :y_offset => 10 })
|
279
|
+
|
280
|
+
#######################################################################
|
281
|
+
#
|
282
|
+
# Example with custom string data labels and formatting.
|
283
|
+
#
|
284
|
+
|
285
|
+
# Create a Column chart.
|
286
|
+
chart9 = workbook.add_chart( :type => 'column', :embedded => 1 )
|
287
|
+
|
288
|
+
# Some custom labels.
|
289
|
+
custom_labels = [
|
290
|
+
{ :value => 'Amy', :border => {:color => 'blue'} },
|
291
|
+
{ :value => 'Bea' },
|
292
|
+
{ :value => 'Eva' },
|
293
|
+
{ :value => 'Fay' },
|
294
|
+
{ :value => 'Liv' },
|
295
|
+
{ :value => 'Una', :fill => {:color => 'green'} }
|
296
|
+
]
|
297
|
+
|
298
|
+
|
299
|
+
# Configure the data series and add the data labels.
|
300
|
+
chart9.add_series(
|
301
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
302
|
+
:values => '=Sheet1!$B$2:$B$7',
|
303
|
+
:data_labels => {
|
304
|
+
:value => 1,
|
305
|
+
:custom => custom_labels,
|
306
|
+
:border => {:color => 'red'},
|
307
|
+
:fill => {:color => 'yellow'}
|
308
|
+
}
|
309
|
+
)
|
310
|
+
|
311
|
+
# Add a chart title.
|
312
|
+
chart9.set_title( :name => 'Chart with custom labels and formatting' )
|
313
|
+
|
314
|
+
# Turn off the chart legend.
|
315
|
+
chart9.set_legend( :none => 1 )
|
316
|
+
|
317
|
+
# Insert the chart into the worksheet (with an offset).
|
318
|
+
worksheet.insert_chart( 'D130', chart9, { :x_offset => 25, :y_offset => 10 } )
|
319
|
+
|
320
|
+
workbook.close
|