write_xlsx 0.90.0 → 0.97.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.
- checksums.yaml +4 -4
- data/Changes +37 -0
- data/README.md +1 -1
- data/examples/a_simple.rb +1 -6
- data/examples/conditional_format.rb +73 -46
- data/examples/demo.rb +1 -7
- data/examples/hyperlink1.rb +4 -11
- data/lib/write_xlsx/chart.rb +81 -205
- data/lib/write_xlsx/chart/axis.rb +2 -2
- data/lib/write_xlsx/chart/caption.rb +3 -1
- data/lib/write_xlsx/chart/pie.rb +2 -0
- data/lib/write_xlsx/chart/series.rb +11 -7
- data/lib/write_xlsx/format.rb +15 -11
- data/lib/write_xlsx/package/conditional_format.rb +351 -38
- data/lib/write_xlsx/package/content_types.rb +10 -0
- data/lib/write_xlsx/package/custom.rb +125 -0
- data/lib/write_xlsx/package/packager.rb +26 -0
- data/lib/write_xlsx/package/styles.rb +53 -21
- data/lib/write_xlsx/package/table.rb +11 -4
- data/lib/write_xlsx/utility.rb +234 -34
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +88 -1
- data/lib/write_xlsx/worksheet.rb +247 -23
- data/test/helper.rb +6 -1
- data/test/regression/_test_hyperlink31.rb +26 -0
- data/test/regression/images/zero_dpi.jpg +0 -0
- data/test/regression/test_chart_bar08.rb +3 -0
- data/test/regression/test_chart_bar11.rb +3 -0
- data/test/regression/test_chart_bar14.rb +3 -0
- data/test/regression/test_chart_chartarea05.rb +16 -17
- data/test/regression/test_chart_chartarea06.rb +49 -0
- data/test/regression/test_chart_data_labels25.rb +61 -0
- data/test/regression/test_chart_format26.rb +48 -0
- data/test/regression/test_chart_format27.rb +58 -0
- data/test/regression/test_chart_format28.rb +52 -0
- data/test/regression/test_chart_format29.rb +59 -0
- data/test/regression/test_chart_format30.rb +53 -0
- data/test/regression/test_chart_format31.rb +60 -0
- data/test/regression/test_chart_table03.rb +56 -0
- data/test/regression/test_cond_format14.rb +42 -0
- data/test/regression/test_cond_format15.rb +53 -0
- data/test/regression/test_cond_format16.rb +53 -0
- data/test/regression/test_cond_format17.rb +37 -0
- data/test/regression/test_cond_format18.rb +136 -0
- data/test/regression/test_date_1904_01.rb +1 -1
- data/test/regression/test_escapes04.rb +3 -0
- data/test/regression/test_escapes05.rb +3 -0
- data/test/regression/test_escapes07.rb +3 -0
- data/test/regression/test_escapes08.rb +3 -0
- data/test/regression/test_hyperlink01.rb +3 -0
- data/test/regression/test_hyperlink02.rb +3 -0
- data/test/regression/test_hyperlink03.rb +4 -0
- data/test/regression/test_hyperlink04.rb +3 -0
- data/test/regression/test_hyperlink05.rb +3 -0
- data/test/regression/test_hyperlink06.rb +3 -0
- data/test/regression/test_hyperlink07.rb +3 -0
- data/test/regression/test_hyperlink08.rb +3 -0
- data/test/regression/test_hyperlink09.rb +3 -0
- data/test/regression/test_hyperlink10.rb +3 -0
- data/test/regression/test_hyperlink11.rb +3 -0
- data/test/regression/test_hyperlink12.rb +3 -0
- data/test/regression/test_hyperlink13.rb +3 -0
- data/test/regression/test_hyperlink14.rb +3 -0
- data/test/regression/test_hyperlink15.rb +3 -0
- data/test/regression/test_hyperlink16.rb +3 -0
- data/test/regression/test_hyperlink17.rb +3 -0
- data/test/regression/test_hyperlink18.rb +3 -0
- data/test/regression/test_hyperlink20.rb +3 -0
- data/test/regression/test_hyperlink21.rb +3 -0
- data/test/regression/test_hyperlink22.rb +3 -0
- data/test/regression/test_hyperlink23.rb +3 -0
- data/test/regression/test_hyperlink24.rb +3 -0
- data/test/regression/test_hyperlink25.rb +3 -0
- data/test/regression/test_hyperlink26.rb +3 -0
- data/test/regression/test_hyperlink27.rb +3 -0
- data/test/regression/test_hyperlink28.rb +50 -0
- data/test/regression/test_hyperlink29.rb +27 -0
- data/test/regression/test_hyperlink30.rb +36 -0
- data/test/regression/test_image35.rb +26 -0
- data/test/regression/test_properties01.rb +1 -4
- data/test/regression/test_properties02.rb +1 -4
- data/test/regression/test_properties03.rb +26 -0
- data/test/regression/test_properties04.rb +61 -0
- data/test/regression/test_properties05.rb +30 -0
- data/test/regression/test_table03.rb +3 -0
- data/test/regression/test_table04.rb +3 -0
- data/test/regression/test_table05.rb +3 -0
- data/test/regression/test_table06.rb +3 -0
- data/test/regression/test_table20.rb +34 -0
- data/test/regression/test_table21.rb +36 -0
- data/test/regression/test_table22.rb +32 -0
- data/test/regression/xlsx_files/chart_chartarea05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_chartarea06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format30.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format31.xlsx +0 -0
- data/test/regression/xlsx_files/chart_table03.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format14.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format15.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format16.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format17.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format18.xlsx +0 -0
- data/test/regression/xlsx_files/date_1904_01.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink28.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink29.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink30.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink31.xlsx +0 -0
- data/test/regression/xlsx_files/image35.xlsx +0 -0
- data/test/regression/xlsx_files/properties03.xlsx +0 -0
- data/test/regression/xlsx_files/properties04.xlsx +0 -0
- data/test/regression/xlsx_files/properties05.xlsx +0 -0
- data/test/regression/xlsx_files/table21.xlsx +0 -0
- data/test/regression/xlsx_files/table22.xlsx +0 -0
- data/test/workbook/test_write_workbook_view.rb +81 -0
- data/test/worksheet/test_cond_format_22.rb +266 -0
- data/test/worksheet/test_cond_format_23.rb +242 -0
- data/test/worksheet/test_cond_format_24.rb +303 -0
- data/test/worksheet/test_data_bar_01.rb +53 -0
- data/test/worksheet/test_data_bar_02.rb +79 -0
- data/test/worksheet/test_data_bar_03.rb +147 -0
- data/test/worksheet/test_data_bar_04.rb +145 -0
- data/test/worksheet/test_data_bar_05.rb +147 -0
- data/test/worksheet/test_data_bar_06.rb +145 -0
- data/test/worksheet/test_data_bar_07.rb +146 -0
- data/test/worksheet/test_data_bar_08.rb +54 -0
- data/test/worksheet/test_data_bar_09.rb +80 -0
- data/test/worksheet/test_data_bar_10.rb +165 -0
- data/test/worksheet/test_data_bar_11.rb +167 -0
- data/test/worksheet/test_data_bar_12.rb +104 -0
- data/test/worksheet/test_write_data_validation_02.rb +27 -0
- metadata +135 -2
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
require 'write_xlsx'
|
|
4
|
+
require 'stringio'
|
|
5
|
+
|
|
6
|
+
class TestCondFormat22 < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
@workbook = WriteXLSX.new(StringIO.new)
|
|
9
|
+
@worksheet = @workbook.add_worksheet('')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
###############################################################################
|
|
13
|
+
#
|
|
14
|
+
# Tests for Excel::Writer::XLSX::Worksheet methods.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
###############################################################################
|
|
18
|
+
#
|
|
19
|
+
# Test the _assemble_xml_file() method.
|
|
20
|
+
#
|
|
21
|
+
# Test conditional formats.
|
|
22
|
+
#
|
|
23
|
+
def test_conditional_formats
|
|
24
|
+
@worksheet.select
|
|
25
|
+
|
|
26
|
+
# Start test code.
|
|
27
|
+
@worksheet.write('A1', 1)
|
|
28
|
+
@worksheet.write('A2', 2)
|
|
29
|
+
@worksheet.write('A3', 3)
|
|
30
|
+
@worksheet.write('A4', 4)
|
|
31
|
+
@worksheet.write('A5', 5)
|
|
32
|
+
@worksheet.write('A6', 6)
|
|
33
|
+
@worksheet.write('A7', 7)
|
|
34
|
+
@worksheet.write('A8', 8)
|
|
35
|
+
@worksheet.write('A9', 9)
|
|
36
|
+
|
|
37
|
+
@worksheet.conditional_formatting(
|
|
38
|
+
'A1',
|
|
39
|
+
{
|
|
40
|
+
:type => 'icon_set',
|
|
41
|
+
:icon_style => '3_arrows'
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
@worksheet.conditional_formatting(
|
|
46
|
+
'A2',
|
|
47
|
+
{
|
|
48
|
+
:type => 'icon_set',
|
|
49
|
+
:icon_style => '3_flags'
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@worksheet.conditional_formatting(
|
|
54
|
+
'A3',
|
|
55
|
+
{
|
|
56
|
+
:type => 'icon_set',
|
|
57
|
+
:icon_style => '3_traffic_lights_rimmed'
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
@worksheet.conditional_formatting(
|
|
62
|
+
'A4',
|
|
63
|
+
{
|
|
64
|
+
:type => 'icon_set',
|
|
65
|
+
:icon_style => '3_symbols_circled'
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
@worksheet.conditional_formatting(
|
|
70
|
+
'A5',
|
|
71
|
+
{
|
|
72
|
+
:type => 'icon_set',
|
|
73
|
+
:icon_style => '4_arrows'
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
@worksheet.conditional_formatting(
|
|
78
|
+
'A6',
|
|
79
|
+
{
|
|
80
|
+
:type => 'icon_set',
|
|
81
|
+
:icon_style => '4_red_to_black'
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
@worksheet.conditional_formatting(
|
|
86
|
+
'A7',
|
|
87
|
+
{
|
|
88
|
+
:type => 'icon_set',
|
|
89
|
+
:icon_style => '4_traffic_lights'
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
@worksheet.conditional_formatting(
|
|
94
|
+
'A8',
|
|
95
|
+
{
|
|
96
|
+
:type => 'icon_set',
|
|
97
|
+
:icon_style => '5_arrows_gray'
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
@worksheet.conditional_formatting(
|
|
102
|
+
'A9',
|
|
103
|
+
{
|
|
104
|
+
:type => 'icon_set',
|
|
105
|
+
:icon_style => '5_quarters'
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# End test code.
|
|
110
|
+
|
|
111
|
+
@worksheet.assemble_xml_file
|
|
112
|
+
result = got_to_array(@worksheet.instance_variable_get(:@writer).string)
|
|
113
|
+
|
|
114
|
+
expected = expected_to_array(expected_xml)
|
|
115
|
+
assert_equal(expected, result)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def expected_xml
|
|
119
|
+
<<EOS
|
|
120
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
121
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
122
|
+
<dimension ref="A1:A9"/>
|
|
123
|
+
<sheetViews>
|
|
124
|
+
<sheetView tabSelected="1" workbookViewId="0"/>
|
|
125
|
+
</sheetViews>
|
|
126
|
+
<sheetFormatPr defaultRowHeight="15"/>
|
|
127
|
+
<sheetData>
|
|
128
|
+
<row r="1" spans="1:1">
|
|
129
|
+
<c r="A1">
|
|
130
|
+
<v>1</v>
|
|
131
|
+
</c>
|
|
132
|
+
</row>
|
|
133
|
+
<row r="2" spans="1:1">
|
|
134
|
+
<c r="A2">
|
|
135
|
+
<v>2</v>
|
|
136
|
+
</c>
|
|
137
|
+
</row>
|
|
138
|
+
<row r="3" spans="1:1">
|
|
139
|
+
<c r="A3">
|
|
140
|
+
<v>3</v>
|
|
141
|
+
</c>
|
|
142
|
+
</row>
|
|
143
|
+
<row r="4" spans="1:1">
|
|
144
|
+
<c r="A4">
|
|
145
|
+
<v>4</v>
|
|
146
|
+
</c>
|
|
147
|
+
</row>
|
|
148
|
+
<row r="5" spans="1:1">
|
|
149
|
+
<c r="A5">
|
|
150
|
+
<v>5</v>
|
|
151
|
+
</c>
|
|
152
|
+
</row>
|
|
153
|
+
<row r="6" spans="1:1">
|
|
154
|
+
<c r="A6">
|
|
155
|
+
<v>6</v>
|
|
156
|
+
</c>
|
|
157
|
+
</row>
|
|
158
|
+
<row r="7" spans="1:1">
|
|
159
|
+
<c r="A7">
|
|
160
|
+
<v>7</v>
|
|
161
|
+
</c>
|
|
162
|
+
</row>
|
|
163
|
+
<row r="8" spans="1:1">
|
|
164
|
+
<c r="A8">
|
|
165
|
+
<v>8</v>
|
|
166
|
+
</c>
|
|
167
|
+
</row>
|
|
168
|
+
<row r="9" spans="1:1">
|
|
169
|
+
<c r="A9">
|
|
170
|
+
<v>9</v>
|
|
171
|
+
</c>
|
|
172
|
+
</row>
|
|
173
|
+
</sheetData>
|
|
174
|
+
<conditionalFormatting sqref="A1">
|
|
175
|
+
<cfRule type="iconSet" priority="1">
|
|
176
|
+
<iconSet iconSet="3Arrows">
|
|
177
|
+
<cfvo type="percent" val="0"/>
|
|
178
|
+
<cfvo type="percent" val="33"/>
|
|
179
|
+
<cfvo type="percent" val="67"/>
|
|
180
|
+
</iconSet>
|
|
181
|
+
</cfRule>
|
|
182
|
+
</conditionalFormatting>
|
|
183
|
+
<conditionalFormatting sqref="A2">
|
|
184
|
+
<cfRule type="iconSet" priority="2">
|
|
185
|
+
<iconSet iconSet="3Flags">
|
|
186
|
+
<cfvo type="percent" val="0"/>
|
|
187
|
+
<cfvo type="percent" val="33"/>
|
|
188
|
+
<cfvo type="percent" val="67"/>
|
|
189
|
+
</iconSet>
|
|
190
|
+
</cfRule>
|
|
191
|
+
</conditionalFormatting>
|
|
192
|
+
<conditionalFormatting sqref="A3">
|
|
193
|
+
<cfRule type="iconSet" priority="3">
|
|
194
|
+
<iconSet iconSet="3TrafficLights2">
|
|
195
|
+
<cfvo type="percent" val="0"/>
|
|
196
|
+
<cfvo type="percent" val="33"/>
|
|
197
|
+
<cfvo type="percent" val="67"/>
|
|
198
|
+
</iconSet>
|
|
199
|
+
</cfRule>
|
|
200
|
+
</conditionalFormatting>
|
|
201
|
+
<conditionalFormatting sqref="A4">
|
|
202
|
+
<cfRule type="iconSet" priority="4">
|
|
203
|
+
<iconSet iconSet="3Symbols">
|
|
204
|
+
<cfvo type="percent" val="0"/>
|
|
205
|
+
<cfvo type="percent" val="33"/>
|
|
206
|
+
<cfvo type="percent" val="67"/>
|
|
207
|
+
</iconSet>
|
|
208
|
+
</cfRule>
|
|
209
|
+
</conditionalFormatting>
|
|
210
|
+
<conditionalFormatting sqref="A5">
|
|
211
|
+
<cfRule type="iconSet" priority="5">
|
|
212
|
+
<iconSet iconSet="4Arrows">
|
|
213
|
+
<cfvo type="percent" val="0"/>
|
|
214
|
+
<cfvo type="percent" val="25"/>
|
|
215
|
+
<cfvo type="percent" val="50"/>
|
|
216
|
+
<cfvo type="percent" val="75"/>
|
|
217
|
+
</iconSet>
|
|
218
|
+
</cfRule>
|
|
219
|
+
</conditionalFormatting>
|
|
220
|
+
<conditionalFormatting sqref="A6">
|
|
221
|
+
<cfRule type="iconSet" priority="6">
|
|
222
|
+
<iconSet iconSet="4RedToBlack">
|
|
223
|
+
<cfvo type="percent" val="0"/>
|
|
224
|
+
<cfvo type="percent" val="25"/>
|
|
225
|
+
<cfvo type="percent" val="50"/>
|
|
226
|
+
<cfvo type="percent" val="75"/>
|
|
227
|
+
</iconSet>
|
|
228
|
+
</cfRule>
|
|
229
|
+
</conditionalFormatting>
|
|
230
|
+
<conditionalFormatting sqref="A7">
|
|
231
|
+
<cfRule type="iconSet" priority="7">
|
|
232
|
+
<iconSet iconSet="4TrafficLights">
|
|
233
|
+
<cfvo type="percent" val="0"/>
|
|
234
|
+
<cfvo type="percent" val="25"/>
|
|
235
|
+
<cfvo type="percent" val="50"/>
|
|
236
|
+
<cfvo type="percent" val="75"/>
|
|
237
|
+
</iconSet>
|
|
238
|
+
</cfRule>
|
|
239
|
+
</conditionalFormatting>
|
|
240
|
+
<conditionalFormatting sqref="A8">
|
|
241
|
+
<cfRule type="iconSet" priority="8">
|
|
242
|
+
<iconSet iconSet="5ArrowsGray">
|
|
243
|
+
<cfvo type="percent" val="0"/>
|
|
244
|
+
<cfvo type="percent" val="20"/>
|
|
245
|
+
<cfvo type="percent" val="40"/>
|
|
246
|
+
<cfvo type="percent" val="60"/>
|
|
247
|
+
<cfvo type="percent" val="80"/>
|
|
248
|
+
</iconSet>
|
|
249
|
+
</cfRule>
|
|
250
|
+
</conditionalFormatting>
|
|
251
|
+
<conditionalFormatting sqref="A9">
|
|
252
|
+
<cfRule type="iconSet" priority="9">
|
|
253
|
+
<iconSet iconSet="5Quarters">
|
|
254
|
+
<cfvo type="percent" val="0"/>
|
|
255
|
+
<cfvo type="percent" val="20"/>
|
|
256
|
+
<cfvo type="percent" val="40"/>
|
|
257
|
+
<cfvo type="percent" val="60"/>
|
|
258
|
+
<cfvo type="percent" val="80"/>
|
|
259
|
+
</iconSet>
|
|
260
|
+
</cfRule>
|
|
261
|
+
</conditionalFormatting>
|
|
262
|
+
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
|
|
263
|
+
</worksheet>
|
|
264
|
+
EOS
|
|
265
|
+
end
|
|
266
|
+
end
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
require 'write_xlsx'
|
|
4
|
+
require 'stringio'
|
|
5
|
+
|
|
6
|
+
class TestCondFormat23 < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
@workbook = WriteXLSX.new(StringIO.new)
|
|
9
|
+
@worksheet = @workbook.add_worksheet('')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
###############################################################################
|
|
13
|
+
#
|
|
14
|
+
# Tests for Excel::Writer::XLSX::Worksheet methods.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
###############################################################################
|
|
18
|
+
#
|
|
19
|
+
# Test the _assemble_xml_file() method.
|
|
20
|
+
#
|
|
21
|
+
# Test conditional formats.
|
|
22
|
+
#
|
|
23
|
+
def test_conditional_formats
|
|
24
|
+
@worksheet.select
|
|
25
|
+
|
|
26
|
+
# Start test code.
|
|
27
|
+
@worksheet.write('A1', 1)
|
|
28
|
+
@worksheet.write('A2', 2)
|
|
29
|
+
@worksheet.write('A3', 3)
|
|
30
|
+
@worksheet.write('A4', 4)
|
|
31
|
+
@worksheet.write('A5', 5)
|
|
32
|
+
@worksheet.write('A6', 6)
|
|
33
|
+
@worksheet.write('A7', 7)
|
|
34
|
+
@worksheet.write('A8', 8)
|
|
35
|
+
|
|
36
|
+
@worksheet.conditional_formatting(
|
|
37
|
+
'A1',
|
|
38
|
+
{
|
|
39
|
+
:type => 'icon_set',
|
|
40
|
+
:icon_style => '3_arrows_gray'
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
@worksheet.conditional_formatting(
|
|
45
|
+
'A2',
|
|
46
|
+
{
|
|
47
|
+
:type => 'icon_set',
|
|
48
|
+
:icon_style => '3_traffic_lights'
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
@worksheet.conditional_formatting(
|
|
53
|
+
'A3',
|
|
54
|
+
{
|
|
55
|
+
:type => 'icon_set',
|
|
56
|
+
:icon_style => '3_signs'
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
@worksheet.conditional_formatting(
|
|
61
|
+
'A4',
|
|
62
|
+
{
|
|
63
|
+
:type => 'icon_set',
|
|
64
|
+
:icon_style => '3_symbols'
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
@worksheet.conditional_formatting(
|
|
69
|
+
'A5',
|
|
70
|
+
{
|
|
71
|
+
:type => 'icon_set',
|
|
72
|
+
:icon_style => '4_arrows_gray'
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
@worksheet.conditional_formatting(
|
|
77
|
+
'A6',
|
|
78
|
+
{
|
|
79
|
+
:type => 'icon_set',
|
|
80
|
+
:icon_style => '4_ratings'
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
@worksheet.conditional_formatting(
|
|
85
|
+
'A7',
|
|
86
|
+
{
|
|
87
|
+
:type => 'icon_set',
|
|
88
|
+
:icon_style => '5_arrows'
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
@worksheet.conditional_formatting(
|
|
93
|
+
'A8',
|
|
94
|
+
{
|
|
95
|
+
:type => 'icon_set',
|
|
96
|
+
:icon_style => '5_ratings'
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# End test code.
|
|
101
|
+
|
|
102
|
+
@worksheet.assemble_xml_file
|
|
103
|
+
result = got_to_array(@worksheet.instance_variable_get(:@writer).string)
|
|
104
|
+
|
|
105
|
+
expected = expected_to_array(expected_xml)
|
|
106
|
+
assert_equal(expected, result)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def expected_xml
|
|
110
|
+
<<EOS
|
|
111
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
112
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
113
|
+
<dimension ref="A1:A8"/>
|
|
114
|
+
<sheetViews>
|
|
115
|
+
<sheetView tabSelected="1" workbookViewId="0"/>
|
|
116
|
+
</sheetViews>
|
|
117
|
+
<sheetFormatPr defaultRowHeight="15"/>
|
|
118
|
+
<sheetData>
|
|
119
|
+
<row r="1" spans="1:1">
|
|
120
|
+
<c r="A1">
|
|
121
|
+
<v>1</v>
|
|
122
|
+
</c>
|
|
123
|
+
</row>
|
|
124
|
+
<row r="2" spans="1:1">
|
|
125
|
+
<c r="A2">
|
|
126
|
+
<v>2</v>
|
|
127
|
+
</c>
|
|
128
|
+
</row>
|
|
129
|
+
<row r="3" spans="1:1">
|
|
130
|
+
<c r="A3">
|
|
131
|
+
<v>3</v>
|
|
132
|
+
</c>
|
|
133
|
+
</row>
|
|
134
|
+
<row r="4" spans="1:1">
|
|
135
|
+
<c r="A4">
|
|
136
|
+
<v>4</v>
|
|
137
|
+
</c>
|
|
138
|
+
</row>
|
|
139
|
+
<row r="5" spans="1:1">
|
|
140
|
+
<c r="A5">
|
|
141
|
+
<v>5</v>
|
|
142
|
+
</c>
|
|
143
|
+
</row>
|
|
144
|
+
<row r="6" spans="1:1">
|
|
145
|
+
<c r="A6">
|
|
146
|
+
<v>6</v>
|
|
147
|
+
</c>
|
|
148
|
+
</row>
|
|
149
|
+
<row r="7" spans="1:1">
|
|
150
|
+
<c r="A7">
|
|
151
|
+
<v>7</v>
|
|
152
|
+
</c>
|
|
153
|
+
</row>
|
|
154
|
+
<row r="8" spans="1:1">
|
|
155
|
+
<c r="A8">
|
|
156
|
+
<v>8</v>
|
|
157
|
+
</c>
|
|
158
|
+
</row>
|
|
159
|
+
</sheetData>
|
|
160
|
+
<conditionalFormatting sqref="A1">
|
|
161
|
+
<cfRule type="iconSet" priority="1">
|
|
162
|
+
<iconSet iconSet="3ArrowsGray">
|
|
163
|
+
<cfvo type="percent" val="0"/>
|
|
164
|
+
<cfvo type="percent" val="33"/>
|
|
165
|
+
<cfvo type="percent" val="67"/>
|
|
166
|
+
</iconSet>
|
|
167
|
+
</cfRule>
|
|
168
|
+
</conditionalFormatting>
|
|
169
|
+
<conditionalFormatting sqref="A2">
|
|
170
|
+
<cfRule type="iconSet" priority="2">
|
|
171
|
+
<iconSet>
|
|
172
|
+
<cfvo type="percent" val="0"/>
|
|
173
|
+
<cfvo type="percent" val="33"/>
|
|
174
|
+
<cfvo type="percent" val="67"/>
|
|
175
|
+
</iconSet>
|
|
176
|
+
</cfRule>
|
|
177
|
+
</conditionalFormatting>
|
|
178
|
+
<conditionalFormatting sqref="A3">
|
|
179
|
+
<cfRule type="iconSet" priority="3">
|
|
180
|
+
<iconSet iconSet="3Signs">
|
|
181
|
+
<cfvo type="percent" val="0"/>
|
|
182
|
+
<cfvo type="percent" val="33"/>
|
|
183
|
+
<cfvo type="percent" val="67"/>
|
|
184
|
+
</iconSet>
|
|
185
|
+
</cfRule>
|
|
186
|
+
</conditionalFormatting>
|
|
187
|
+
<conditionalFormatting sqref="A4">
|
|
188
|
+
<cfRule type="iconSet" priority="4">
|
|
189
|
+
<iconSet iconSet="3Symbols2">
|
|
190
|
+
<cfvo type="percent" val="0"/>
|
|
191
|
+
<cfvo type="percent" val="33"/>
|
|
192
|
+
<cfvo type="percent" val="67"/>
|
|
193
|
+
</iconSet>
|
|
194
|
+
</cfRule>
|
|
195
|
+
</conditionalFormatting>
|
|
196
|
+
<conditionalFormatting sqref="A5">
|
|
197
|
+
<cfRule type="iconSet" priority="5">
|
|
198
|
+
<iconSet iconSet="4ArrowsGray">
|
|
199
|
+
<cfvo type="percent" val="0"/>
|
|
200
|
+
<cfvo type="percent" val="25"/>
|
|
201
|
+
<cfvo type="percent" val="50"/>
|
|
202
|
+
<cfvo type="percent" val="75"/>
|
|
203
|
+
</iconSet>
|
|
204
|
+
</cfRule>
|
|
205
|
+
</conditionalFormatting>
|
|
206
|
+
<conditionalFormatting sqref="A6">
|
|
207
|
+
<cfRule type="iconSet" priority="6">
|
|
208
|
+
<iconSet iconSet="4Rating">
|
|
209
|
+
<cfvo type="percent" val="0"/>
|
|
210
|
+
<cfvo type="percent" val="25"/>
|
|
211
|
+
<cfvo type="percent" val="50"/>
|
|
212
|
+
<cfvo type="percent" val="75"/>
|
|
213
|
+
</iconSet>
|
|
214
|
+
</cfRule>
|
|
215
|
+
</conditionalFormatting>
|
|
216
|
+
<conditionalFormatting sqref="A7">
|
|
217
|
+
<cfRule type="iconSet" priority="7">
|
|
218
|
+
<iconSet iconSet="5Arrows">
|
|
219
|
+
<cfvo type="percent" val="0"/>
|
|
220
|
+
<cfvo type="percent" val="20"/>
|
|
221
|
+
<cfvo type="percent" val="40"/>
|
|
222
|
+
<cfvo type="percent" val="60"/>
|
|
223
|
+
<cfvo type="percent" val="80"/>
|
|
224
|
+
</iconSet>
|
|
225
|
+
</cfRule>
|
|
226
|
+
</conditionalFormatting>
|
|
227
|
+
<conditionalFormatting sqref="A8">
|
|
228
|
+
<cfRule type="iconSet" priority="8">
|
|
229
|
+
<iconSet iconSet="5Rating">
|
|
230
|
+
<cfvo type="percent" val="0"/>
|
|
231
|
+
<cfvo type="percent" val="20"/>
|
|
232
|
+
<cfvo type="percent" val="40"/>
|
|
233
|
+
<cfvo type="percent" val="60"/>
|
|
234
|
+
<cfvo type="percent" val="80"/>
|
|
235
|
+
</iconSet>
|
|
236
|
+
</cfRule>
|
|
237
|
+
</conditionalFormatting>
|
|
238
|
+
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
|
|
239
|
+
</worksheet>
|
|
240
|
+
EOS
|
|
241
|
+
end
|
|
242
|
+
end
|