write_xlsx 1.08.1 → 1.08.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ab3f33d51239105a5d5c8e0765ada850496c199a370e713353c56d0e0764e4b
4
- data.tar.gz: 4b379953050d7a9a5c4151742825c7672c66e60b7c37146531f8d0075d32b634
3
+ metadata.gz: 15cfe1d88bbb3b997322aa3d507a8e8960bacd75afd397699a34d71e84162ab8
4
+ data.tar.gz: 0d5500191ffb1e57645eb6162ae40cfbceddcfe6008704697645a4099da7ba1b
5
5
  SHA512:
6
- metadata.gz: 128e52ae31ef667b30e8c6649c1747abf75750e48bd1a7a9a95cedd69ab3699f55755c9ef2686da4252642c662ed871b41ebb90cabe6d23e56f319b958db89b9
7
- data.tar.gz: 31b68e29186266b216aaf8dc2035619292999146e79a9388c1d46dcbdd4704d17688586733dc8bb2b6284865340a68d62c7de6cd738a1ed9f6e68c83f388e94e
6
+ metadata.gz: b5b8b723b22bab86ad2a1fe4527aa94ded8ff95661fc1b23098552774dc6f98cbaf80fdfca5be2e6422810fe9d0fc95748a329aa17770708f40e06112d507fec
7
+ data.tar.gz: 85f1ee5165c26ddd247b10b19de5ee6e2c07be360211c80316e9259dda928d7ff64052581bbbd8023c2965d8d2449daf1d4a7470c6a7e11d2b4f3f5b67fb4dc1
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ ##############################################################################
5
+ #
6
+ # An example of turning off worksheet cells errors/warnings using the
7
+ # Excel::Writer::XLSX module.
8
+ #
9
+ # Copyright 2000-2021, 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('ignore_errors.xlsx')
16
+ worksheet = workbook.add_worksheet
17
+
18
+ # Write strings that looks like numbers. This will cause an Excel warning.
19
+ worksheet.write_string('C2', '123')
20
+ worksheet.write_string('C3', '123')
21
+
22
+ # Write a divide by zero formula. This will also cause an Excel warning.
23
+ worksheet.write_formula('C5', '=1/0')
24
+ worksheet.write_formula('C6', '=1/0')
25
+
26
+ # Turn off some of the warnings:
27
+ worksheet.ignore_errors(
28
+ :number_stored_as_text => 'C3',
29
+ :eval_error => 'C6'
30
+ )
31
+
32
+ # Write some descriptions for the cells and make the column wider for clarity.
33
+ worksheet.set_column('B:B', 16)
34
+ worksheet.write('B2', 'Warning:')
35
+ worksheet.write('B3', 'Warning turned off:')
36
+ worksheet.write('B5', 'Warning:')
37
+ worksheet.write('B6', 'Warning turned off:')
38
+
39
+ workbook.close
Binary file
@@ -1 +1 @@
1
- WriteXLSX_VERSION = "1.08.1"
1
+ WriteXLSX_VERSION = "1.08.2"
Binary file
@@ -3292,6 +3292,37 @@ EOS
3292
3292
  compare_xlsx(File.join(@perl_output, @xlsx), @tempfile.path)
3293
3293
  end
3294
3294
 
3295
+ def test_ignore_errors
3296
+ @xlsx = 'ignore_errors.xlsx'
3297
+ workbook = WriteXLSX.new(@io)
3298
+ worksheet = workbook.add_worksheet
3299
+
3300
+ # Write strings that looks like numbers. This will cause an Excel warning.
3301
+ worksheet.write_string('C2', '123')
3302
+ worksheet.write_string('C3', '123')
3303
+
3304
+ # Write a divide by zero formula. This will also cause an Excel warning.
3305
+ worksheet.write_formula('C5', '=1/0')
3306
+ worksheet.write_formula('C6', '=1/0')
3307
+
3308
+ # Turn off some of the warnings:
3309
+ worksheet.ignore_errors(
3310
+ :number_stored_as_text => 'C3',
3311
+ :eval_error => 'C6'
3312
+ )
3313
+
3314
+ # Write some descriptions for the cells and make the column wider for clarity.
3315
+ worksheet.set_column('B:B', 16)
3316
+ worksheet.write('B2', 'Warning:')
3317
+ worksheet.write('B3', 'Warning turned off:')
3318
+ worksheet.write('B5', 'Warning:')
3319
+ worksheet.write('B6', 'Warning turned off:')
3320
+
3321
+ workbook.close
3322
+ store_to_tempfile
3323
+ compare_xlsx(File.join(@perl_output, @xlsx), @tempfile.path)
3324
+ end
3325
+
3295
3326
  def test_merge1
3296
3327
  @xlsx = 'merge1.xlsx'
3297
3328
  # Create a new workbook and add a worksheet
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: 1.08.1
4
+ version: 1.08.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hideo NAKAMURA
@@ -137,6 +137,7 @@ files:
137
137
  - examples/hide_row_col.rb
138
138
  - examples/hide_sheet.rb
139
139
  - examples/hyperlink1.rb
140
+ - examples/ignore_errors.rb
140
141
  - examples/indent.rb
141
142
  - examples/macros.rb
142
143
  - examples/merge1.rb
@@ -172,6 +173,7 @@ files:
172
173
  - examples/tables.rb
173
174
  - examples/update_range_format_with_params.rb
174
175
  - examples/vbaProject.bin
176
+ - ignore_errors.xlsx
175
177
  - lib/write_xlsx.rb
176
178
  - lib/write_xlsx/chart.rb
177
179
  - lib/write_xlsx/chart/area.rb
@@ -364,6 +366,7 @@ files:
364
366
  - test/perl_output/hide_row_col.xlsx
365
367
  - test/perl_output/hide_sheet.xlsx
366
368
  - test/perl_output/hyperlink.xlsx
369
+ - test/perl_output/ignore_errors.xlsx
367
370
  - test/perl_output/indent.xlsx
368
371
  - test/perl_output/merge1.xlsx
369
372
  - test/perl_output/merge2.xlsx
@@ -2284,6 +2287,7 @@ test_files:
2284
2287
  - test/perl_output/hide_row_col.xlsx
2285
2288
  - test/perl_output/hide_sheet.xlsx
2286
2289
  - test/perl_output/hyperlink.xlsx
2290
+ - test/perl_output/ignore_errors.xlsx
2287
2291
  - test/perl_output/indent.xlsx
2288
2292
  - test/perl_output/merge1.xlsx
2289
2293
  - test/perl_output/merge2.xlsx