write_xlsx 1.10.0 → 1.10.2
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/.rubocop.yml +10 -0
- data/Changes +9 -0
- data/README.md +2 -2
- data/examples/autofilter.rb +1 -1
- data/examples/chart_area.rb +12 -12
- data/examples/chart_bar.rb +12 -12
- data/examples/chart_clustered.rb +12 -12
- data/examples/chart_column.rb +12 -12
- data/examples/chart_combined.rb +25 -25
- data/examples/chart_data_labels.rb +99 -99
- data/examples/chart_data_table.rb +25 -25
- data/examples/chart_data_tools.rb +50 -50
- data/examples/chart_doughnut.rb +29 -29
- data/examples/chart_gauge.rb +18 -18
- data/examples/chart_line.rb +32 -32
- data/examples/chart_pareto.rb +16 -16
- data/examples/chart_pie.rb +17 -17
- data/examples/chart_radar.rb +38 -38
- data/examples/chart_scatter.rb +12 -12
- data/examples/chart_secondary_axis.rb +13 -13
- data/examples/chart_stock.rb +12 -12
- data/examples/chart_styles.rb +5 -5
- data/examples/colors.rb +11 -11
- data/examples/comments2.rb +15 -15
- data/examples/conditional_format.rb +74 -74
- data/examples/data_validate.rb +64 -64
- data/examples/date_time.rb +3 -3
- data/examples/demo.rb +14 -14
- data/examples/diag_border.rb +6 -6
- data/examples/dynamic_arrays.rb +2 -2
- data/examples/formats.rb +10 -10
- data/examples/hyperlink1.rb +4 -4
- data/examples/ignore_errors.rb +2 -2
- data/examples/indent.rb +2 -2
- data/examples/macros.rb +4 -4
- data/examples/merge1.rb +1 -1
- data/examples/merge2.rb +9 -9
- data/examples/merge3.rb +5 -5
- data/examples/merge4.rb +20 -20
- data/examples/merge5.rb +18 -18
- data/examples/merge6.rb +7 -7
- data/examples/outline.rb +1 -1
- data/examples/outline_collapsed.rb +1 -1
- data/examples/panes.rb +4 -4
- data/examples/properties.rb +9 -9
- data/examples/protection.rb +2 -2
- data/examples/rich_strings.rb +6 -6
- data/examples/shape1.rb +7 -7
- data/examples/shape2.rb +16 -16
- data/examples/shape3.rb +5 -5
- data/examples/shape4.rb +7 -7
- data/examples/shape5.rb +7 -7
- data/examples/shape6.rb +7 -7
- data/examples/shape7.rb +10 -10
- data/examples/shape8.rb +10 -10
- data/examples/shape_all.rb +4 -4
- data/examples/sparklines1.rb +11 -11
- data/examples/sparklines2.rb +76 -76
- data/examples/tables.rb +87 -87
- data/examples/watermark.rb +1 -1
- data/lib/write_xlsx/chart/bar.rb +4 -4
- data/lib/write_xlsx/chart/line.rb +1 -1
- data/lib/write_xlsx/chart/radar.rb +2 -2
- data/lib/write_xlsx/chart/scatter.rb +4 -4
- data/lib/write_xlsx/chart/series.rb +27 -27
- data/lib/write_xlsx/chart/stock.rb +5 -5
- data/lib/write_xlsx/chart.rb +30 -30
- data/lib/write_xlsx/colors.rb +19 -19
- data/lib/write_xlsx/package/conditional_format.rb +18 -7
- data/lib/write_xlsx/package/table.rb +33 -24
- data/lib/write_xlsx/shape.rb +5 -5
- data/lib/write_xlsx/sheets.rb +1 -1
- data/lib/write_xlsx/sparkline.rb +286 -286
- data/lib/write_xlsx/utility.rb +32 -31
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +20 -20
- data/lib/write_xlsx/worksheet/cell_data.rb +1 -1
- data/lib/write_xlsx/worksheet/data_validation.rb +13 -1
- data/lib/write_xlsx/worksheet.rb +486 -246
- metadata +3 -3
@@ -16,14 +16,14 @@ worksheet9 = workbook.add_worksheet
|
|
16
16
|
|
17
17
|
# Light red fill with dark red text.
|
18
18
|
format1 = workbook.add_format(
|
19
|
-
:
|
20
|
-
:
|
19
|
+
bg_color: '#FFC7CE',
|
20
|
+
color: '#9C0006'
|
21
21
|
)
|
22
22
|
|
23
23
|
# Green fill with dark green text.
|
24
24
|
format2 = workbook.add_format(
|
25
|
-
:
|
26
|
-
:
|
25
|
+
bg_color: '#C6EFCE',
|
26
|
+
color: '#006100'
|
27
27
|
)
|
28
28
|
|
29
29
|
# Some sample data to run the conditional formatting against.
|
@@ -55,10 +55,10 @@ worksheet1.write_col('B3', data)
|
|
55
55
|
worksheet1.conditional_formatting(
|
56
56
|
'B3:K12',
|
57
57
|
{
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
58
|
+
type: 'cell',
|
59
|
+
criteria: '>=',
|
60
|
+
value: 50,
|
61
|
+
format: format1
|
62
62
|
}
|
63
63
|
)
|
64
64
|
|
@@ -66,10 +66,10 @@ worksheet1.conditional_formatting(
|
|
66
66
|
worksheet1.conditional_formatting(
|
67
67
|
'B3:K12',
|
68
68
|
{
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
69
|
+
type: 'cell',
|
70
|
+
criteria: '<',
|
71
|
+
value: 50,
|
72
|
+
format: format2
|
73
73
|
}
|
74
74
|
)
|
75
75
|
|
@@ -86,22 +86,22 @@ worksheet2.write_col('B3', data)
|
|
86
86
|
worksheet2.conditional_formatting(
|
87
87
|
'B3:K12',
|
88
88
|
{
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
89
|
+
type: 'cell',
|
90
|
+
criteria: 'between',
|
91
|
+
minimum: 30,
|
92
|
+
maximum: 70,
|
93
|
+
format: format1
|
94
94
|
}
|
95
95
|
)
|
96
96
|
|
97
97
|
worksheet2.conditional_formatting(
|
98
98
|
'B3:K12',
|
99
99
|
{
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
100
|
+
type: 'cell',
|
101
|
+
criteria: 'not between',
|
102
|
+
minimum: 30,
|
103
|
+
maximum: 70,
|
104
|
+
format: format2
|
105
105
|
}
|
106
106
|
)
|
107
107
|
|
@@ -118,16 +118,16 @@ worksheet3.write_col('B3', data)
|
|
118
118
|
worksheet3.conditional_formatting(
|
119
119
|
'B3:K12',
|
120
120
|
{
|
121
|
-
:
|
122
|
-
:
|
121
|
+
type: 'duplicate',
|
122
|
+
format: format1
|
123
123
|
}
|
124
124
|
)
|
125
125
|
|
126
126
|
worksheet3.conditional_formatting(
|
127
127
|
'B3:K12',
|
128
128
|
{
|
129
|
-
:
|
130
|
-
:
|
129
|
+
type: 'unique',
|
130
|
+
format: format2
|
131
131
|
}
|
132
132
|
)
|
133
133
|
|
@@ -144,18 +144,18 @@ worksheet4.write_col('B3', data)
|
|
144
144
|
worksheet4.conditional_formatting(
|
145
145
|
'B3:K12',
|
146
146
|
{
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
147
|
+
type: 'average',
|
148
|
+
criteria: 'above',
|
149
|
+
format: format1
|
150
150
|
}
|
151
151
|
)
|
152
152
|
|
153
153
|
worksheet4.conditional_formatting(
|
154
154
|
'B3:K12',
|
155
155
|
{
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
156
|
+
type: 'average',
|
157
|
+
criteria: 'below',
|
158
|
+
format: format2
|
159
159
|
}
|
160
160
|
)
|
161
161
|
|
@@ -172,18 +172,18 @@ worksheet5.write_col('B3', data)
|
|
172
172
|
worksheet5.conditional_formatting(
|
173
173
|
'B3:K12',
|
174
174
|
{
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
175
|
+
type: 'top',
|
176
|
+
value: '10',
|
177
|
+
format: format1
|
178
178
|
}
|
179
179
|
)
|
180
180
|
|
181
181
|
worksheet5.conditional_formatting(
|
182
182
|
'B3:K12',
|
183
183
|
{
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
184
|
+
type: 'bottom',
|
185
|
+
value: '10',
|
186
|
+
format: format2
|
187
187
|
}
|
188
188
|
)
|
189
189
|
|
@@ -202,10 +202,10 @@ worksheet6.write_col('B3', data)
|
|
202
202
|
worksheet6.conditional_formatting(
|
203
203
|
'B3:K6,B9:K12',
|
204
204
|
{
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
205
|
+
type: 'cell',
|
206
|
+
criteria: '>=',
|
207
|
+
value: 50,
|
208
|
+
format: format1
|
209
209
|
}
|
210
210
|
)
|
211
211
|
|
@@ -213,10 +213,10 @@ worksheet6.conditional_formatting(
|
|
213
213
|
worksheet6.conditional_formatting(
|
214
214
|
'B3:K6,B9:K12',
|
215
215
|
{
|
216
|
-
:
|
217
|
-
:
|
218
|
-
:
|
219
|
-
:
|
216
|
+
type: 'cell',
|
217
|
+
criteria: '<',
|
218
|
+
value: 50,
|
219
|
+
format: format2
|
220
220
|
}
|
221
221
|
)
|
222
222
|
|
@@ -242,21 +242,21 @@ worksheet7.write_col('F3', data)
|
|
242
242
|
worksheet7.conditional_formatting(
|
243
243
|
'B3:B14',
|
244
244
|
{
|
245
|
-
:
|
245
|
+
type: '2_color_scale'
|
246
246
|
}
|
247
247
|
)
|
248
248
|
|
249
249
|
worksheet7.conditional_formatting(
|
250
250
|
'D3:D14',
|
251
251
|
{
|
252
|
-
:
|
252
|
+
type: '3_color_scale'
|
253
253
|
}
|
254
254
|
)
|
255
255
|
|
256
256
|
worksheet7.conditional_formatting(
|
257
257
|
'F3:F14',
|
258
258
|
{
|
259
|
-
:
|
259
|
+
type: 'data_bar'
|
260
260
|
}
|
261
261
|
)
|
262
262
|
|
@@ -282,27 +282,27 @@ worksheet8.write_col('F3', data)
|
|
282
282
|
worksheet8.conditional_formatting(
|
283
283
|
'B3:B14',
|
284
284
|
{
|
285
|
-
:
|
286
|
-
:
|
287
|
-
:
|
285
|
+
type: '2_color_scale',
|
286
|
+
min_color: "#FF0000",
|
287
|
+
max_color: "#00FF00"
|
288
288
|
}
|
289
289
|
)
|
290
290
|
|
291
291
|
worksheet8.conditional_formatting(
|
292
292
|
'D3:D14',
|
293
293
|
{
|
294
|
-
:
|
295
|
-
:
|
296
|
-
:
|
297
|
-
:
|
294
|
+
type: '3_color_scale',
|
295
|
+
min_color: "#C5D9F1",
|
296
|
+
mid_color: "#8DB4E3",
|
297
|
+
max_color: "#538ED5"
|
298
298
|
}
|
299
299
|
)
|
300
300
|
|
301
301
|
worksheet8.conditional_formatting(
|
302
302
|
'F3:F14',
|
303
303
|
{
|
304
|
-
:
|
305
|
-
:
|
304
|
+
type: 'data_bar',
|
305
|
+
bar_color: '#63C384'
|
306
306
|
}
|
307
307
|
)
|
308
308
|
|
@@ -328,58 +328,58 @@ worksheet9.write_col('B3', data)
|
|
328
328
|
worksheet9.conditional_formatting(
|
329
329
|
'B3:D3',
|
330
330
|
{
|
331
|
-
:
|
332
|
-
:
|
331
|
+
type: 'icon_set',
|
332
|
+
icon_style: '3_traffic_lights'
|
333
333
|
}
|
334
334
|
)
|
335
335
|
|
336
336
|
worksheet9.conditional_formatting(
|
337
337
|
'B4:D4',
|
338
338
|
{
|
339
|
-
:
|
340
|
-
:
|
341
|
-
:
|
339
|
+
type: 'icon_set',
|
340
|
+
icon_style: '3_traffic_lights',
|
341
|
+
reverse_icons: 1
|
342
342
|
}
|
343
343
|
)
|
344
344
|
|
345
345
|
worksheet9.conditional_formatting(
|
346
346
|
'B5:D5',
|
347
347
|
{
|
348
|
-
:
|
349
|
-
:
|
350
|
-
:
|
348
|
+
type: 'icon_set',
|
349
|
+
icon_style: '3_traffic_lights',
|
350
|
+
icons_only: 1
|
351
351
|
}
|
352
352
|
)
|
353
353
|
|
354
354
|
worksheet9.conditional_formatting(
|
355
355
|
'B6:D6',
|
356
356
|
{
|
357
|
-
:
|
358
|
-
:
|
357
|
+
type: 'icon_set',
|
358
|
+
icon_style: '3_arrows'
|
359
359
|
}
|
360
360
|
)
|
361
361
|
|
362
362
|
worksheet9.conditional_formatting(
|
363
363
|
'B7:E8',
|
364
364
|
{
|
365
|
-
:
|
366
|
-
:
|
365
|
+
type: 'icon_set',
|
366
|
+
icon_style: '4_arrows'
|
367
367
|
}
|
368
368
|
)
|
369
369
|
|
370
370
|
worksheet9.conditional_formatting(
|
371
371
|
'B8:F8',
|
372
372
|
{
|
373
|
-
:
|
374
|
-
:
|
373
|
+
type: 'icon_set',
|
374
|
+
icon_style: '5_arrows'
|
375
375
|
}
|
376
376
|
)
|
377
377
|
|
378
378
|
worksheet9.conditional_formatting(
|
379
379
|
'B9:F9',
|
380
380
|
{
|
381
|
-
:
|
382
|
-
:
|
381
|
+
type: 'icon_set',
|
382
|
+
icon_style: '5_ratings'
|
383
383
|
}
|
384
384
|
)
|
385
385
|
|
data/examples/data_validate.rb
CHANGED
@@ -19,12 +19,12 @@ worksheet = workbook.add_worksheet
|
|
19
19
|
|
20
20
|
# Add a format for the header cells.
|
21
21
|
header_format = workbook.add_format(
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
22
|
+
border: 1,
|
23
|
+
bg_color: '#C6EFCE',
|
24
|
+
bold: 1,
|
25
|
+
text_wrap: 1,
|
26
|
+
valign: 'vcenter',
|
27
|
+
indent: 1
|
28
28
|
)
|
29
29
|
|
30
30
|
# Set up layout of the worksheet.
|
@@ -58,10 +58,10 @@ worksheet.write(row, 0, txt)
|
|
58
58
|
worksheet.data_validation(
|
59
59
|
row, 1,
|
60
60
|
{
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
61
|
+
validate: 'integer',
|
62
|
+
criteria: 'between',
|
63
|
+
minimum: 1,
|
64
|
+
maximum: 10
|
65
65
|
}
|
66
66
|
)
|
67
67
|
|
@@ -75,10 +75,10 @@ worksheet.write(row, 0, txt)
|
|
75
75
|
worksheet.data_validation(
|
76
76
|
row, 1,
|
77
77
|
{
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
78
|
+
validate: 'integer',
|
79
|
+
criteria: 'not between',
|
80
|
+
minimum: '=E3',
|
81
|
+
maximum: '=F3'
|
82
82
|
}
|
83
83
|
)
|
84
84
|
|
@@ -92,9 +92,9 @@ worksheet.write(row, 0, txt)
|
|
92
92
|
worksheet.data_validation(
|
93
93
|
row, 1,
|
94
94
|
{
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
95
|
+
validate: 'integer',
|
96
|
+
criteria: '>',
|
97
|
+
value: 0
|
98
98
|
}
|
99
99
|
)
|
100
100
|
|
@@ -108,9 +108,9 @@ worksheet.write(row, 0, txt)
|
|
108
108
|
worksheet.data_validation(
|
109
109
|
row, 1,
|
110
110
|
{
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
111
|
+
validate: 'integer',
|
112
|
+
criteria: '<',
|
113
|
+
value: 10
|
114
114
|
}
|
115
115
|
)
|
116
116
|
|
@@ -124,10 +124,10 @@ worksheet.write(row, 0, txt)
|
|
124
124
|
worksheet.data_validation(
|
125
125
|
row, 1,
|
126
126
|
{
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
127
|
+
validate: 'decimal',
|
128
|
+
criteria: 'between',
|
129
|
+
minimum: 0.1,
|
130
|
+
maximum: 0.5
|
131
131
|
}
|
132
132
|
)
|
133
133
|
|
@@ -141,8 +141,8 @@ worksheet.write(row, 0, txt)
|
|
141
141
|
worksheet.data_validation(
|
142
142
|
row, 1,
|
143
143
|
{
|
144
|
-
:
|
145
|
-
:
|
144
|
+
validate: 'list',
|
145
|
+
source: %w[open high close]
|
146
146
|
}
|
147
147
|
)
|
148
148
|
|
@@ -156,8 +156,8 @@ worksheet.write(row, 0, txt)
|
|
156
156
|
worksheet.data_validation(
|
157
157
|
row, 1,
|
158
158
|
{
|
159
|
-
:
|
160
|
-
:
|
159
|
+
validate: 'list',
|
160
|
+
source: '=$E$4:$G$4'
|
161
161
|
}
|
162
162
|
)
|
163
163
|
|
@@ -171,10 +171,10 @@ worksheet.write(row, 0, txt)
|
|
171
171
|
worksheet.data_validation(
|
172
172
|
row, 1,
|
173
173
|
{
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
174
|
+
validate: 'date',
|
175
|
+
criteria: 'between',
|
176
|
+
minimum: '2008-01-01T',
|
177
|
+
maximum: '2008-12-12T'
|
178
178
|
}
|
179
179
|
)
|
180
180
|
|
@@ -188,10 +188,10 @@ worksheet.write(row, 0, txt)
|
|
188
188
|
worksheet.data_validation(
|
189
189
|
row, 1,
|
190
190
|
{
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
191
|
+
validate: 'time',
|
192
|
+
criteria: 'between',
|
193
|
+
minimum: 'T06:00',
|
194
|
+
maximum: 'T12:00'
|
195
195
|
}
|
196
196
|
)
|
197
197
|
|
@@ -205,9 +205,9 @@ worksheet.write(row, 0, txt)
|
|
205
205
|
worksheet.data_validation(
|
206
206
|
row, 1,
|
207
207
|
{
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
208
|
+
validate: 'length',
|
209
|
+
criteria: '>',
|
210
|
+
value: 3
|
211
211
|
}
|
212
212
|
)
|
213
213
|
|
@@ -221,8 +221,8 @@ worksheet.write(row, 0, txt)
|
|
221
221
|
worksheet.data_validation(
|
222
222
|
row, 1,
|
223
223
|
{
|
224
|
-
:
|
225
|
-
:
|
224
|
+
validate: 'custom',
|
225
|
+
value: '=AND(F5=50,G5=60)'
|
226
226
|
}
|
227
227
|
)
|
228
228
|
|
@@ -236,12 +236,12 @@ worksheet.write(row, 0, txt)
|
|
236
236
|
worksheet.data_validation(
|
237
237
|
row, 1,
|
238
238
|
{
|
239
|
-
:
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
244
|
-
:
|
239
|
+
validate: 'integer',
|
240
|
+
criteria: 'between',
|
241
|
+
minimum: 1,
|
242
|
+
maximum: 100,
|
243
|
+
input_title: 'Enter an integer:',
|
244
|
+
input_message: 'between 1 and 100'
|
245
245
|
}
|
246
246
|
)
|
247
247
|
|
@@ -255,14 +255,14 @@ worksheet.write(row, 0, txt)
|
|
255
255
|
worksheet.data_validation(
|
256
256
|
row, 1,
|
257
257
|
{
|
258
|
-
:
|
259
|
-
:
|
260
|
-
:
|
261
|
-
:
|
262
|
-
:
|
263
|
-
:
|
264
|
-
:
|
265
|
-
:
|
258
|
+
validate: 'integer',
|
259
|
+
criteria: 'between',
|
260
|
+
minimum: 1,
|
261
|
+
maximum: 100,
|
262
|
+
input_title: 'Enter an integer:',
|
263
|
+
input_message: 'between 1 and 100',
|
264
|
+
error_title: 'Input value is not valid!',
|
265
|
+
error_message: 'It should be an integer between 1 and 100'
|
266
266
|
}
|
267
267
|
)
|
268
268
|
|
@@ -276,15 +276,15 @@ worksheet.write(row, 0, txt)
|
|
276
276
|
worksheet.data_validation(
|
277
277
|
row, 1,
|
278
278
|
{
|
279
|
-
:
|
280
|
-
:
|
281
|
-
:
|
282
|
-
:
|
283
|
-
:
|
284
|
-
:
|
285
|
-
:
|
286
|
-
:
|
287
|
-
:
|
279
|
+
validate: 'integer',
|
280
|
+
criteria: 'between',
|
281
|
+
minimum: 1,
|
282
|
+
maximum: 100,
|
283
|
+
input_title: 'Enter an integer:',
|
284
|
+
input_message: 'between 1 and 100',
|
285
|
+
error_title: 'Input value is not valid!',
|
286
|
+
error_message: 'It should be an integer between 1 and 100',
|
287
|
+
error_type: 'information'
|
288
288
|
}
|
289
289
|
)
|
290
290
|
|
data/examples/date_time.rb
CHANGED
@@ -14,7 +14,7 @@ require 'write_xlsx'
|
|
14
14
|
|
15
15
|
workbook = WriteXLSX.new('date_time.xlsx')
|
16
16
|
worksheet = workbook.add_worksheet
|
17
|
-
bold = workbook.add_format(:
|
17
|
+
bold = workbook.add_format(bold: 1)
|
18
18
|
|
19
19
|
# Expand the first column so that the date is visible.
|
20
20
|
worksheet.set_column('A:B', 30)
|
@@ -64,8 +64,8 @@ date_formats.each do |date_format|
|
|
64
64
|
|
65
65
|
# Create a format for the date or time.
|
66
66
|
format = workbook.add_format(
|
67
|
-
:
|
68
|
-
:
|
67
|
+
num_format: date_format,
|
68
|
+
align: 'left'
|
69
69
|
)
|
70
70
|
|
71
71
|
# Write the same date using different formats.
|
data/examples/demo.rb
CHANGED
@@ -8,7 +8,7 @@ worksheet = workbook.add_worksheet('Demo')
|
|
8
8
|
worksheet2 = workbook.add_worksheet('Another sheet')
|
9
9
|
worksheet3 = workbook.add_worksheet('And another')
|
10
10
|
|
11
|
-
bold = workbook.add_format(:
|
11
|
+
bold = workbook.add_format(bold: 1)
|
12
12
|
|
13
13
|
#######################################################################
|
14
14
|
#
|
@@ -19,11 +19,11 @@ worksheet.set_column('B:B', 20)
|
|
19
19
|
worksheet.set_row(0, 40)
|
20
20
|
|
21
21
|
heading = workbook.add_format(
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
22
|
+
bold: 1,
|
23
|
+
color: 'blue',
|
24
|
+
size: 16,
|
25
|
+
merge: 1,
|
26
|
+
align: 'vcenter'
|
27
27
|
)
|
28
28
|
|
29
29
|
headings = ['Features of WriteXLSX', '']
|
@@ -34,11 +34,11 @@ worksheet.write_row('A1', headings, heading)
|
|
34
34
|
# Some text examples
|
35
35
|
#
|
36
36
|
text_format = workbook.add_format(
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
37
|
+
bold: 1,
|
38
|
+
italic: 1,
|
39
|
+
color: 'red',
|
40
|
+
size: 18,
|
41
|
+
font: 'Lucida Calligraphy'
|
42
42
|
)
|
43
43
|
|
44
44
|
worksheet.write('A2', "Text")
|
@@ -52,8 +52,8 @@ worksheet.write('B4', "А Б В Г Д")
|
|
52
52
|
#
|
53
53
|
# Some numeric examples
|
54
54
|
#
|
55
|
-
num1_format = workbook.add_format(:
|
56
|
-
num2_format = workbook.add_format(:
|
55
|
+
num1_format = workbook.add_format(num_format: '$#,##0.00')
|
56
|
+
num2_format = workbook.add_format(num_format: ' d mmmm yyy')
|
57
57
|
|
58
58
|
worksheet.write('A5', "Numbers")
|
59
59
|
worksheet.write('B5', 1234.56)
|
@@ -84,7 +84,7 @@ worksheet.write('B9', 'http://www.ruby-lang.org/')
|
|
84
84
|
worksheet.write('A10', "Images")
|
85
85
|
worksheet.insert_image(
|
86
86
|
'B10', 'republic.png',
|
87
|
-
:
|
87
|
+
x_offset: 16, y_offset: 8
|
88
88
|
)
|
89
89
|
|
90
90
|
#######################################################################
|
data/examples/diag_border.rb
CHANGED
@@ -6,14 +6,14 @@ require 'write_xlsx'
|
|
6
6
|
workbook = WriteXLSX.new('diag_border.xlsx')
|
7
7
|
worksheet = workbook.add_worksheet
|
8
8
|
|
9
|
-
format1 = workbook.add_format(:
|
10
|
-
format2 = workbook.add_format(:
|
11
|
-
format3 = workbook.add_format(:
|
9
|
+
format1 = workbook.add_format(diag_type: 1)
|
10
|
+
format2 = workbook.add_format(diag_type: 2)
|
11
|
+
format3 = workbook.add_format(diag_type: 3)
|
12
12
|
|
13
13
|
format4 = workbook.add_format(
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
14
|
+
diag_type: 3,
|
15
|
+
diag_border: 7,
|
16
|
+
diag_color: 'red'
|
17
17
|
)
|
18
18
|
|
19
19
|
worksheet.write('B3', 'Text', format1)
|
data/examples/dynamic_arrays.rb
CHANGED
@@ -59,8 +59,8 @@ worksheet7 = workbook.add_worksheet('Randarray')
|
|
59
59
|
worksheet8 = workbook.add_worksheet('Sequence')
|
60
60
|
worksheet9 = workbook.add_worksheet('Spill ranges')
|
61
61
|
worksheet10 = workbook.add_worksheet('Older functions')
|
62
|
-
header1 = workbook.add_format(:
|
63
|
-
header2 = workbook.add_format(:
|
62
|
+
header1 = workbook.add_format(fg_color: '#74AC4C', color: '#FFFFFF')
|
63
|
+
header2 = workbook.add_format(fg_color: '#528FD3', color: '#FFFFFF')
|
64
64
|
|
65
65
|
#
|
66
66
|
# Example of using the FILTER() function.
|