write_xlsx 0.85.2 → 0.85.3
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 +3 -0
- data/README.md +1 -1
- data/lib/write_xlsx/sheets.rb +4 -0
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +11 -10
- data/lib/write_xlsx/worksheet.rb +3 -2
- data/test/perl_output/hide_first_sheet.xlsx +0 -0
- data/test/test_example_match.rb +13 -0
- data/test/worksheet/test_write_methods.rb +6 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 451a49314f7a14e2c9d5bfc5c4df3ca7f54e2718
|
4
|
+
data.tar.gz: 040af462094068f22464c341ea38fa971b5e4403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47524ba5498e8529ccc789da00036e0cf7a901d116f6661c75d8ee7b74485181aeb5ee7f657844cdbf756a1dfaa6337faf25c307586960fb32465fcca4764249
|
7
|
+
data.tar.gz: b582ea2f76e0bf02a37484581d732c9a329161d606fae13a381cd6541824b0a4ee061f8196385277a4e8b92f0965db79b5d426bf77cc7107201f55f18b1e0b76
|
data/Changes
CHANGED
data/README.md
CHANGED
@@ -85,7 +85,7 @@ the first worksheet in an Excel XML spreadsheet called ruby.xlsx:
|
|
85
85
|
Original Perl module was written by John McNamara(jmcnamara@cpan.org).
|
86
86
|
|
87
87
|
Converted to ruby by Hideo NAKAMURA(cxn03651@msj.biglobe.ne.jp)
|
88
|
-
Copyright (c) 2012-
|
88
|
+
Copyright (c) 2012-2018 Hideo NAKAMURA.
|
89
89
|
|
90
90
|
See LICENSE.txt for further details.
|
91
91
|
|
data/lib/write_xlsx/sheets.rb
CHANGED
data/lib/write_xlsx/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
WriteXLSX_VERSION = "0.85.
|
1
|
+
WriteXLSX_VERSION = "0.85.3"
|
data/lib/write_xlsx/workbook.rb
CHANGED
@@ -1019,6 +1019,14 @@ def non_chartsheets
|
|
1019
1019
|
@worksheets.worksheets
|
1020
1020
|
end
|
1021
1021
|
|
1022
|
+
def firstsheet #:nodoc:
|
1023
|
+
@firstsheet ||= 0
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
def activesheet #:nodoc:
|
1027
|
+
@activesheet ||= 0
|
1028
|
+
end
|
1029
|
+
|
1022
1030
|
private
|
1023
1031
|
|
1024
1032
|
def filename
|
@@ -1270,14 +1278,6 @@ def write_io(str) #:nodoc:
|
|
1270
1278
|
str
|
1271
1279
|
end
|
1272
1280
|
|
1273
|
-
def firstsheet #:nodoc:
|
1274
|
-
@firstsheet ||= 0
|
1275
|
-
end
|
1276
|
-
|
1277
|
-
def activesheet #:nodoc:
|
1278
|
-
@activesheet ||= 0
|
1279
|
-
end
|
1280
|
-
|
1281
1281
|
# for test
|
1282
1282
|
def defined_names #:nodoc:
|
1283
1283
|
@defined_names ||= []
|
@@ -1291,9 +1291,10 @@ def store_workbook #:nodoc:
|
|
1291
1291
|
add_worksheet if @worksheets.empty?
|
1292
1292
|
|
1293
1293
|
# Ensure that at least one worksheet has been selected.
|
1294
|
-
@worksheets.
|
1294
|
+
@worksheets.visible_first.select if @activesheet == 0
|
1295
1295
|
|
1296
1296
|
# Set the active sheet.
|
1297
|
+
@activesheet = @worksheets.visible_first.index if @activesheet == 0
|
1297
1298
|
@worksheets[@activesheet].activate
|
1298
1299
|
|
1299
1300
|
# Prepare the worksheet VML elements such as comments and buttons.
|
@@ -1917,7 +1918,7 @@ def process_png(data)
|
|
1917
1918
|
type = 'png'
|
1918
1919
|
width = 0
|
1919
1920
|
height = 0
|
1920
|
-
|
1921
|
+
x_dpi = 96
|
1921
1922
|
y_dpi = 96
|
1922
1923
|
|
1923
1924
|
offset = 8
|
data/lib/write_xlsx/worksheet.rb
CHANGED
@@ -509,8 +509,8 @@ def activate
|
|
509
509
|
def hide
|
510
510
|
@hidden = true
|
511
511
|
@selected = false
|
512
|
-
@workbook.activesheet = 0
|
513
|
-
@workbook.firstsheet = 0
|
512
|
+
@workbook.activesheet = 0 if @workbook.activesheet == @index
|
513
|
+
@workbook.firstsheet = 0 if @workbook.firstsheet == @index
|
514
514
|
end
|
515
515
|
|
516
516
|
def hidden? # :nodoc:
|
@@ -2225,6 +2225,7 @@ def write_number(*args)
|
|
2225
2225
|
def write_string(*args)
|
2226
2226
|
# Check for a cell reference in A1 notation and substitute row and column
|
2227
2227
|
row, col, str, xf = row_col_notation(args)
|
2228
|
+
str &&= str.to_s
|
2228
2229
|
raise WriteXLSXInsufficientArgumentError if [row, col, str].include?(nil)
|
2229
2230
|
|
2230
2231
|
# Check that row and col are valid and store max and min values
|
Binary file
|
data/test/test_example_match.rb
CHANGED
@@ -2711,6 +2711,19 @@ def test_headers
|
|
2711
2711
|
compare_xlsx(File.join(@perl_output, @xlsx), @xlsx)
|
2712
2712
|
end
|
2713
2713
|
|
2714
|
+
def test_hide_first_sheet
|
2715
|
+
@xlsx = 'hide_first_sheet.xlsx'
|
2716
|
+
workbook = WriteXLSX.new(@xlsx)
|
2717
|
+
worksheet1 = workbook.add_worksheet
|
2718
|
+
worksheet2 = workbook.add_worksheet
|
2719
|
+
|
2720
|
+
worksheet2.activate
|
2721
|
+
worksheet1.hide
|
2722
|
+
|
2723
|
+
workbook.close
|
2724
|
+
compare_xlsx(File.join(@perl_output, @xlsx), @xlsx)
|
2725
|
+
end
|
2726
|
+
|
2714
2727
|
def test_hide_sheet
|
2715
2728
|
@xlsx = 'hide_sheet.xlsx'
|
2716
2729
|
workbook = WriteXLSX.new(@xlsx)
|
@@ -59,6 +59,12 @@ def test_write_number_with_valid_arg_not_raise
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_write_string_with_non_string_value
|
63
|
+
assert_nothing_raised do
|
64
|
+
@worksheet.write_string(0, 0, 1)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
62
68
|
def test_write_string_with_insufficient_args_raise_InsufficientArgumentError
|
63
69
|
assert_raise(WriteXLSXInsufficientArgumentError) do
|
64
70
|
@worksheet.write_string()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.85.
|
4
|
+
version: 0.85.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -337,6 +337,7 @@ files:
|
|
337
337
|
- test/perl_output/fit_to_pages.xlsx
|
338
338
|
- test/perl_output/formats.xlsx
|
339
339
|
- test/perl_output/headers.xlsx
|
340
|
+
- test/perl_output/hide_first_sheet.xlsx
|
340
341
|
- test/perl_output/hide_row_col.xlsx
|
341
342
|
- test/perl_output/hide_sheet.xlsx
|
342
343
|
- test/perl_output/hyperlink.xlsx
|
@@ -1707,7 +1708,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1707
1708
|
version: '0'
|
1708
1709
|
requirements: []
|
1709
1710
|
rubyforge_project:
|
1710
|
-
rubygems_version: 2.5.2
|
1711
|
+
rubygems_version: 2.5.2.1
|
1711
1712
|
signing_key:
|
1712
1713
|
specification_version: 4
|
1713
1714
|
summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
@@ -1846,6 +1847,7 @@ test_files:
|
|
1846
1847
|
- test/perl_output/fit_to_pages.xlsx
|
1847
1848
|
- test/perl_output/formats.xlsx
|
1848
1849
|
- test/perl_output/headers.xlsx
|
1850
|
+
- test/perl_output/hide_first_sheet.xlsx
|
1849
1851
|
- test/perl_output/hide_row_col.xlsx
|
1850
1852
|
- test/perl_output/hide_sheet.xlsx
|
1851
1853
|
- test/perl_output/hyperlink.xlsx
|