write_xlsx 0.54.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,107 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+ require 'write_xlsx'
4
+ require 'stringio'
5
+
6
+ class TestSparkline10 < Test::Unit::TestCase
7
+ def setup
8
+ @workbook = WriteXLSX.new(StringIO.new)
9
+ @worksheet = @workbook.add_worksheet
10
+ end
11
+
12
+ def test_sparkline10
13
+ @worksheet.instance_variable_set(:@excel_version, 2010)
14
+ @worksheet.select
15
+
16
+ data = [-2, 2, 3, -1, 0]
17
+
18
+ @worksheet.write('A1', data)
19
+
20
+ # Set up sparklines
21
+
22
+ @worksheet.add_sparkline(
23
+ {
24
+ :location => 'F1',
25
+ :range => 'A1:E1',
26
+
27
+ :high_point => 1,
28
+ :low_point => 1,
29
+ :negative_points => 1,
30
+ :first_point => 1,
31
+ :last_point => 1,
32
+ :markers => 1,
33
+
34
+ :series_color => '#C00000',
35
+ :negative_color => '#FF0000',
36
+ :markers_color => '#FFC000',
37
+ :first_color => '#00B050',
38
+ :last_color => '#00B0F0',
39
+ :high_color => '#FFFF00',
40
+ :low_color => '#92D050'
41
+ }
42
+ )
43
+
44
+ # End sparklines
45
+
46
+ @worksheet.assemble_xml_file
47
+ result = got_to_array(@worksheet.instance_variable_get(:@writer).string)
48
+
49
+ expected = expected_to_array(expected_xml)
50
+ assert_equal(expected, result)
51
+ end
52
+
53
+ def expected_xml
54
+ <<EOS
55
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
56
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" mc:Ignorable="x14ac">
57
+ <dimension ref="A1:E1"/>
58
+ <sheetViews>
59
+ <sheetView tabSelected="1" workbookViewId="0"/>
60
+ </sheetViews>
61
+ <sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>
62
+ <sheetData>
63
+ <row r="1" spans="1:5" x14ac:dyDescent="0.25">
64
+ <c r="A1">
65
+ <v>-2</v>
66
+ </c>
67
+ <c r="B1">
68
+ <v>2</v>
69
+ </c>
70
+ <c r="C1">
71
+ <v>3</v>
72
+ </c>
73
+ <c r="D1">
74
+ <v>-1</v>
75
+ </c>
76
+ <c r="E1">
77
+ <v>0</v>
78
+ </c>
79
+ </row>
80
+ </sheetData>
81
+ <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
82
+ <extLst>
83
+ <ext xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}">
84
+ <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
85
+ <x14:sparklineGroup displayEmptyCellsAs="gap" markers="1" high="1" low="1" first="1" last="1" negative="1">
86
+ <x14:colorSeries rgb="FFC00000"/>
87
+ <x14:colorNegative rgb="FFFF0000"/>
88
+ <x14:colorAxis rgb="FF000000"/>
89
+ <x14:colorMarkers rgb="FFFFC000"/>
90
+ <x14:colorFirst rgb="FF00B050"/>
91
+ <x14:colorLast rgb="FF00B0F0"/>
92
+ <x14:colorHigh rgb="FFFFFF00"/>
93
+ <x14:colorLow rgb="FF92D050"/>
94
+ <x14:sparklines>
95
+ <x14:sparkline>
96
+ <xm:f>Sheet1!A1:E1</xm:f>
97
+ <xm:sqref>F1</xm:sqref>
98
+ </x14:sparkline>
99
+ </x14:sparklines>
100
+ </x14:sparklineGroup>
101
+ </x14:sparklineGroups>
102
+ </ext>
103
+ </extLst>
104
+ </worksheet>
105
+ EOS
106
+ end
107
+ end
@@ -0,0 +1,218 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+ require 'write_xlsx'
4
+ require 'stringio'
5
+
6
+ class TestSparkline11 < Test::Unit::TestCase
7
+ def setup
8
+ @workbook = WriteXLSX.new(StringIO.new)
9
+ @worksheet = @workbook.add_worksheet
10
+ end
11
+
12
+ def test_sparkline11
13
+ @worksheet.instance_variable_set(:@excel_version, 2010)
14
+ @worksheet.select
15
+
16
+ data = [-2, 2, 3, -1, 0]
17
+
18
+ @worksheet.write('A1', data)
19
+ @worksheet.write('A2', data)
20
+ @worksheet.write('A3', data)
21
+ @worksheet.write('A4', [1, 2, 3, 4, 5])
22
+
23
+ # Set up sparklines
24
+
25
+ @worksheet.add_sparkline(
26
+ {
27
+ :location => 'F1',
28
+ :range => 'A1:E1',
29
+
30
+ :max => 0.5,
31
+ :min => -0.5,
32
+ :axis => 1,
33
+ :reverse => 1,
34
+ :empty_cells => 'zero',
35
+ :weight => 0.25,
36
+
37
+ :high_point => 1,
38
+ :low_point => 1,
39
+ :negative_points => 1,
40
+ :first_point => 1,
41
+ :last_point => 1,
42
+ :markers => 1
43
+ }
44
+ )
45
+
46
+ @worksheet.add_sparkline(
47
+ {
48
+ :location => 'F2',
49
+ :range => 'A2:E2',
50
+
51
+ :max => 'group',
52
+ :min => 'group',
53
+ :empty_cells => 'connect',
54
+ :weight => 2.25
55
+ }
56
+ )
57
+
58
+ @worksheet.add_sparkline(
59
+ {
60
+ :location => 'F3',
61
+ :range => 'A3:E3',
62
+
63
+ :max => 'group',
64
+ :min => '0',
65
+ :show_hidden => 1,
66
+ :weight => 6,
67
+ :date_axis => 'A4:E4'
68
+ }
69
+ )
70
+
71
+ # End sparklines
72
+
73
+ @worksheet.assemble_xml_file
74
+ result = got_to_array(@worksheet.instance_variable_get(:@writer).string)
75
+
76
+ expected = expected_to_array(expected_xml)
77
+ assert_equal(expected, result)
78
+ end
79
+
80
+ def expected_xml
81
+ <<EOS
82
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
83
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" mc:Ignorable="x14ac">
84
+ <dimension ref="A1:E4"/>
85
+ <sheetViews>
86
+ <sheetView tabSelected="1" workbookViewId="0"/>
87
+ </sheetViews>
88
+ <sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>
89
+ <sheetData>
90
+ <row r="1" spans="1:5" x14ac:dyDescent="0.25">
91
+ <c r="A1">
92
+ <v>-2</v>
93
+ </c>
94
+ <c r="B1">
95
+ <v>2</v>
96
+ </c>
97
+ <c r="C1">
98
+ <v>3</v>
99
+ </c>
100
+ <c r="D1">
101
+ <v>-1</v>
102
+ </c>
103
+ <c r="E1">
104
+ <v>0</v>
105
+ </c>
106
+ </row>
107
+ <row r="2" spans="1:5" x14ac:dyDescent="0.25">
108
+ <c r="A2">
109
+ <v>-2</v>
110
+ </c>
111
+ <c r="B2">
112
+ <v>2</v>
113
+ </c>
114
+ <c r="C2">
115
+ <v>3</v>
116
+ </c>
117
+ <c r="D2">
118
+ <v>-1</v>
119
+ </c>
120
+ <c r="E2">
121
+ <v>0</v>
122
+ </c>
123
+ </row>
124
+ <row r="3" spans="1:5" x14ac:dyDescent="0.25">
125
+ <c r="A3">
126
+ <v>-2</v>
127
+ </c>
128
+ <c r="B3">
129
+ <v>2</v>
130
+ </c>
131
+ <c r="C3">
132
+ <v>3</v>
133
+ </c>
134
+ <c r="D3">
135
+ <v>-1</v>
136
+ </c>
137
+ <c r="E3">
138
+ <v>0</v>
139
+ </c>
140
+ </row>
141
+ <row r="4" spans="1:5" x14ac:dyDescent="0.25">
142
+ <c r="A4">
143
+ <v>1</v>
144
+ </c>
145
+ <c r="B4">
146
+ <v>2</v>
147
+ </c>
148
+ <c r="C4">
149
+ <v>3</v>
150
+ </c>
151
+ <c r="D4">
152
+ <v>4</v>
153
+ </c>
154
+ <c r="E4">
155
+ <v>5</v>
156
+ </c>
157
+ </row>
158
+ </sheetData>
159
+ <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
160
+ <extLst>
161
+ <ext xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}">
162
+ <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
163
+ <x14:sparklineGroup manualMin="0" lineWeight="6" dateAxis="1" displayEmptyCellsAs="gap" displayHidden="1" minAxisType="custom" maxAxisType="group">
164
+ <x14:colorSeries theme="4" tint="-0.499984740745262"/>
165
+ <x14:colorNegative theme="5"/>
166
+ <x14:colorAxis rgb="FF000000"/>
167
+ <x14:colorMarkers theme="4" tint="-0.499984740745262"/>
168
+ <x14:colorFirst theme="4" tint="0.39997558519241921"/>
169
+ <x14:colorLast theme="4" tint="0.39997558519241921"/>
170
+ <x14:colorHigh theme="4"/>
171
+ <x14:colorLow theme="4"/>
172
+ <xm:f>Sheet1!A4:E4</xm:f>
173
+ <x14:sparklines>
174
+ <x14:sparkline>
175
+ <xm:f>Sheet1!A3:E3</xm:f>
176
+ <xm:sqref>F3</xm:sqref>
177
+ </x14:sparkline>
178
+ </x14:sparklines>
179
+ </x14:sparklineGroup>
180
+ <x14:sparklineGroup lineWeight="2.25" displayEmptyCellsAs="span" minAxisType="group" maxAxisType="group">
181
+ <x14:colorSeries theme="4" tint="-0.499984740745262"/>
182
+ <x14:colorNegative theme="5"/>
183
+ <x14:colorAxis rgb="FF000000"/>
184
+ <x14:colorMarkers theme="4" tint="-0.499984740745262"/>
185
+ <x14:colorFirst theme="4" tint="0.39997558519241921"/>
186
+ <x14:colorLast theme="4" tint="0.39997558519241921"/>
187
+ <x14:colorHigh theme="4"/>
188
+ <x14:colorLow theme="4"/>
189
+ <x14:sparklines>
190
+ <x14:sparkline>
191
+ <xm:f>Sheet1!A2:E2</xm:f>
192
+ <xm:sqref>F2</xm:sqref>
193
+ </x14:sparkline>
194
+ </x14:sparklines>
195
+ </x14:sparklineGroup>
196
+ <x14:sparklineGroup manualMax="0.5" manualMin="-0.5" lineWeight="0.25" markers="1" high="1" low="1" first="1" last="1" negative="1" displayXAxis="1" minAxisType="custom" maxAxisType="custom" rightToLeft="1">
197
+ <x14:colorSeries theme="4" tint="-0.499984740745262"/>
198
+ <x14:colorNegative theme="5"/>
199
+ <x14:colorAxis rgb="FF000000"/>
200
+ <x14:colorMarkers theme="4" tint="-0.499984740745262"/>
201
+ <x14:colorFirst theme="4" tint="0.39997558519241921"/>
202
+ <x14:colorLast theme="4" tint="0.39997558519241921"/>
203
+ <x14:colorHigh theme="4"/>
204
+ <x14:colorLow theme="4"/>
205
+ <x14:sparklines>
206
+ <x14:sparkline>
207
+ <xm:f>Sheet1!A1:E1</xm:f>
208
+ <xm:sqref>F1</xm:sqref>
209
+ </x14:sparkline>
210
+ </x14:sparklines>
211
+ </x14:sparklineGroup>
212
+ </x14:sparklineGroups>
213
+ </ext>
214
+ </extLst>
215
+ </worksheet>
216
+ EOS
217
+ end
218
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: write_xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.54.0
4
+ version: 0.55.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
@@ -100,6 +100,8 @@ files:
100
100
  - examples/shape7.rb
101
101
  - examples/shape8.rb
102
102
  - examples/shape_all.rb
103
+ - examples/sparklines1.rb
104
+ - examples/sparklines2.rb
103
105
  - examples/stats.rb
104
106
  - examples/stats_ext.rb
105
107
  - examples/stocks.rb
@@ -302,6 +304,8 @@ files:
302
304
  - test/perl_output/shape7.xlsx
303
305
  - test/perl_output/shape8.xlsx
304
306
  - test/perl_output/shape_all.xlsx
307
+ - test/perl_output/sparklines1.xlsx
308
+ - test/perl_output/sparklines2.xlsx
305
309
  - test/perl_output/stats.xlsx
306
310
  - test/perl_output/stats_ext.xlsx
307
311
  - test/perl_output/stocks.xlsx
@@ -912,6 +916,7 @@ files:
912
916
  - test/worksheet/test_cond_format_17.rb
913
917
  - test/worksheet/test_cond_format_18.rb
914
918
  - test/worksheet/test_cond_format_19.rb
919
+ - test/worksheet/test_cond_format_20.rb
915
920
  - test/worksheet/test_convert_date_time_01.rb
916
921
  - test/worksheet/test_convert_date_time_02.rb
917
922
  - test/worksheet/test_convert_date_time_03.rb
@@ -919,6 +924,17 @@ files:
919
924
  - test/worksheet/test_parse_filter_expression.rb
920
925
  - test/worksheet/test_position_object.rb
921
926
  - test/worksheet/test_repeat_formula.rb
927
+ - test/worksheet/test_sparkline_01.rb
928
+ - test/worksheet/test_sparkline_02.rb
929
+ - test/worksheet/test_sparkline_03.rb
930
+ - test/worksheet/test_sparkline_04.rb
931
+ - test/worksheet/test_sparkline_05.rb
932
+ - test/worksheet/test_sparkline_06.rb
933
+ - test/worksheet/test_sparkline_07.rb
934
+ - test/worksheet/test_sparkline_08.rb
935
+ - test/worksheet/test_sparkline_09.rb
936
+ - test/worksheet/test_sparkline_10.rb
937
+ - test/worksheet/test_sparkline_11.rb
922
938
  - test/worksheet/test_worksheet_01.rb
923
939
  - test/worksheet/test_worksheet_02.rb
924
940
  - test/worksheet/test_worksheet_03.rb
@@ -936,8 +952,6 @@ files:
936
952
  - test/worksheet/test_write_data_validation_01.rb
937
953
  - test/worksheet/test_write_data_validation_02.rb
938
954
  - test/worksheet/test_write_dimension.rb
939
- - test/worksheet/test_write_ext.rb
940
- - test/worksheet/test_write_ext_lst.rb
941
955
  - test/worksheet/test_write_filter.rb
942
956
  - test/worksheet/test_write_filter_column.rb
943
957
  - test/worksheet/test_write_filters.rb
@@ -948,7 +962,6 @@ files:
948
962
  - test/worksheet/test_write_merge_cell.rb
949
963
  - test/worksheet/test_write_merge_cells.rb
950
964
  - test/worksheet/test_write_methods.rb
951
- - test/worksheet/test_write_mx_plv.rb
952
965
  - test/worksheet/test_write_page_margins.rb
953
966
  - test/worksheet/test_write_page_set_up_pr.rb
954
967
  - test/worksheet/test_write_page_setup.rb
@@ -1165,6 +1178,8 @@ test_files:
1165
1178
  - test/perl_output/shape7.xlsx
1166
1179
  - test/perl_output/shape8.xlsx
1167
1180
  - test/perl_output/shape_all.xlsx
1181
+ - test/perl_output/sparklines1.xlsx
1182
+ - test/perl_output/sparklines2.xlsx
1168
1183
  - test/perl_output/stats.xlsx
1169
1184
  - test/perl_output/stats_ext.xlsx
1170
1185
  - test/perl_output/stocks.xlsx
@@ -1775,6 +1790,7 @@ test_files:
1775
1790
  - test/worksheet/test_cond_format_17.rb
1776
1791
  - test/worksheet/test_cond_format_18.rb
1777
1792
  - test/worksheet/test_cond_format_19.rb
1793
+ - test/worksheet/test_cond_format_20.rb
1778
1794
  - test/worksheet/test_convert_date_time_01.rb
1779
1795
  - test/worksheet/test_convert_date_time_02.rb
1780
1796
  - test/worksheet/test_convert_date_time_03.rb
@@ -1782,6 +1798,17 @@ test_files:
1782
1798
  - test/worksheet/test_parse_filter_expression.rb
1783
1799
  - test/worksheet/test_position_object.rb
1784
1800
  - test/worksheet/test_repeat_formula.rb
1801
+ - test/worksheet/test_sparkline_01.rb
1802
+ - test/worksheet/test_sparkline_02.rb
1803
+ - test/worksheet/test_sparkline_03.rb
1804
+ - test/worksheet/test_sparkline_04.rb
1805
+ - test/worksheet/test_sparkline_05.rb
1806
+ - test/worksheet/test_sparkline_06.rb
1807
+ - test/worksheet/test_sparkline_07.rb
1808
+ - test/worksheet/test_sparkline_08.rb
1809
+ - test/worksheet/test_sparkline_09.rb
1810
+ - test/worksheet/test_sparkline_10.rb
1811
+ - test/worksheet/test_sparkline_11.rb
1785
1812
  - test/worksheet/test_worksheet_01.rb
1786
1813
  - test/worksheet/test_worksheet_02.rb
1787
1814
  - test/worksheet/test_worksheet_03.rb
@@ -1799,8 +1826,6 @@ test_files:
1799
1826
  - test/worksheet/test_write_data_validation_01.rb
1800
1827
  - test/worksheet/test_write_data_validation_02.rb
1801
1828
  - test/worksheet/test_write_dimension.rb
1802
- - test/worksheet/test_write_ext.rb
1803
- - test/worksheet/test_write_ext_lst.rb
1804
1829
  - test/worksheet/test_write_filter.rb
1805
1830
  - test/worksheet/test_write_filter_column.rb
1806
1831
  - test/worksheet/test_write_filters.rb
@@ -1811,7 +1836,6 @@ test_files:
1811
1836
  - test/worksheet/test_write_merge_cell.rb
1812
1837
  - test/worksheet/test_write_merge_cells.rb
1813
1838
  - test/worksheet/test_write_methods.rb
1814
- - test/worksheet/test_write_mx_plv.rb
1815
1839
  - test/worksheet/test_write_page_margins.rb
1816
1840
  - test/worksheet/test_write_page_set_up_pr.rb
1817
1841
  - test/worksheet/test_write_page_setup.rb