writeexcel 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test-suite.yml +26 -0
- data/README.rdoc +11 -2
- data/lib/writeexcel/biffwriter.rb +2 -1
- data/lib/writeexcel/cell_range.rb +1 -0
- data/lib/writeexcel/chart.rb +2 -3
- data/lib/writeexcel/charts/area.rb +1 -1
- data/lib/writeexcel/charts/pie.rb +1 -1
- data/lib/writeexcel/charts/scatter.rb +1 -1
- data/lib/writeexcel/charts/stock.rb +1 -1
- data/lib/writeexcel/col_info.rb +2 -2
- data/lib/writeexcel/comments.rb +2 -1
- data/lib/writeexcel/convert_date_time.rb +7 -7
- data/lib/writeexcel/excelformulaparser.rb +50 -50
- data/lib/writeexcel/format.rb +1 -1
- data/lib/writeexcel/formula.rb +1 -1
- data/lib/writeexcel/helper.rb +3 -3
- data/lib/writeexcel/properties.rb +1 -1
- data/lib/writeexcel/shared_string_table.rb +5 -5
- data/lib/writeexcel/storage_lite.rb +2 -9
- data/lib/writeexcel/version.rb +2 -4
- data/lib/writeexcel/workbook.rb +14 -25
- data/lib/writeexcel/worksheet.rb +73 -56
- data/lib/writeexcel/worksheets.rb +1 -2
- data/lib/writeexcel.rb +3 -5
- data/test/helper.rb +12 -4
- data/test/test_00_IEEE_double.rb +1 -1
- data/test/test_04_dimensions.rb +6 -6
- data/test/test_05_rows.rb +14 -17
- data/test/test_06_extsst.rb +8 -11
- data/test/test_11_date_time.rb +1 -1
- data/test/test_12_date_only.rb +1 -1
- data/test/test_13_date_seconds.rb +1 -1
- data/test/test_21_escher.rb +5 -5
- data/test/test_22_mso_drawing_group.rb +37 -40
- data/test/test_23_note.rb +5 -5
- data/test/test_24_txo.rb +5 -5
- data/test/test_25_position_object.rb +5 -5
- data/test/test_26_autofilter.rb +1 -1
- data/test/test_27_autofilter.rb +1 -1
- data/test/test_28_autofilter.rb +1 -1
- data/test/test_29_process_jpg.rb +1 -43
- data/test/test_30_validation_dval.rb +5 -5
- data/test/test_31_validation_dv_strings.rb +8 -8
- data/test/test_32_validation_dv_formula.rb +5 -5
- data/test/test_40_property_types.rb +1 -1
- data/test/test_41_properties.rb +1 -1
- data/test/test_42_set_properties.rb +30 -37
- data/test/test_50_name_stored.rb +1 -19
- data/test/test_51_name_print_area.rb +3 -13
- data/test/test_52_name_print_titles.rb +3 -21
- data/test/test_53_autofilter.rb +1 -5
- data/test/test_60_chart_generic.rb +3 -3
- data/test/test_61_chart_subclasses.rb +2 -1
- data/test/test_62_chart_formats.rb +9 -21
- data/test/test_63_chart_area_formats.rb +1 -1
- data/test/test_compatibility.rb +1 -1
- data/test/test_example_match.rb +835 -835
- data/test/test_format.rb +1 -114
- data/test/test_formula.rb +1 -1
- data/test/test_properties.rb +1 -2
- data/test/test_storage_lite.rb +2 -2
- data/test/test_workbook.rb +1 -66
- data/test/test_worksheet.rb +1 -18
- data/test/test_write_formula_does_not_change_formula_string.rb +1 -1
- data/writeexcel.gemspec +6 -3
- metadata +24 -21
- data/test/test_01_add_worksheet.rb +0 -43
- data/test/test_02_merge_formats.rb +0 -49
- data/test/test_biff.rb +0 -71
- data/test/test_big_workbook.rb +0 -17
- data/test/test_ole.rb +0 -102
data/test/test_format.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'helper'
|
3
3
|
require 'stringio'
|
4
4
|
|
5
|
-
class TC_Format < Test
|
5
|
+
class TC_Format < Minitest::Test
|
6
6
|
|
7
7
|
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
8
8
|
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
@@ -253,14 +253,6 @@ set_italic()
|
|
253
253
|
assert_equal(value, fmt.italic, "arg : #{arg}")
|
254
254
|
end
|
255
255
|
|
256
|
-
# invalid arg
|
257
|
-
[-1, 0.2, 100, 'italic', true, false, nil].each do |arg|
|
258
|
-
assert_raise(ArgumentError,
|
259
|
-
"set_italic(#{arg}) : invalid arg. arg must be 0, 1 or none."){
|
260
|
-
fmt = Writeexcel::Format.new
|
261
|
-
fmt.set_italic(arg)
|
262
|
-
}
|
263
|
-
end
|
264
256
|
end
|
265
257
|
|
266
258
|
=begin
|
@@ -292,15 +284,6 @@ Set the underline property of the font.
|
|
292
284
|
fmt.set_underline(arg)
|
293
285
|
assert_equal(arg, fmt.underline, "arg : #{arg}")
|
294
286
|
end
|
295
|
-
|
296
|
-
# invalid args
|
297
|
-
[-1, 0.2, 100, 'under', true, false, nil].each do |arg|
|
298
|
-
assert_raise(ArgumentError,
|
299
|
-
"set_underline(#{arg}) : arg must be 0, 1 or none, 2, 33, 34."){
|
300
|
-
fmt = Writeexcel::Format.new
|
301
|
-
fmt.set_underline(arg)
|
302
|
-
}
|
303
|
-
end
|
304
287
|
end
|
305
288
|
|
306
289
|
=begin
|
@@ -326,15 +309,6 @@ Set the strikeout property of the font.
|
|
326
309
|
fmt.set_font_strikeout(arg)
|
327
310
|
assert_equal(arg, fmt.font_strikeout, "arg : #{arg}")
|
328
311
|
end
|
329
|
-
|
330
|
-
# invalid args
|
331
|
-
[-1, 0.2, 100, 'strikeout', true, false, nil].each do |arg|
|
332
|
-
assert_raise(ArgumentError,
|
333
|
-
"set_font_strikeout(#{arg}) : arg must be 0, 1 or none."){
|
334
|
-
fmt = Writeexcel::Format.new
|
335
|
-
fmt.set_font_strikeout(arg)
|
336
|
-
}
|
337
|
-
end
|
338
312
|
end
|
339
313
|
|
340
314
|
=begin
|
@@ -362,16 +336,6 @@ Set the superscript/subscript property of the font. This format is currently not
|
|
362
336
|
fmt.set_font_script(arg)
|
363
337
|
assert_equal(arg, fmt.font_script, "arg : #{arg}")
|
364
338
|
end
|
365
|
-
|
366
|
-
# invalid args
|
367
|
-
[-1, 0.2, 100, 'script', true, false, nil].each do |arg|
|
368
|
-
assert_raise(ArgumentError,
|
369
|
-
"set_font_script(#{arg}) : arg must be 0, 1 or none, or 2."){
|
370
|
-
fmt = Writeexcel::Format.new
|
371
|
-
fmt.set_font_script(arg)
|
372
|
-
}
|
373
|
-
end
|
374
|
-
|
375
339
|
end
|
376
340
|
|
377
341
|
=begin
|
@@ -397,15 +361,6 @@ Macintosh only.
|
|
397
361
|
fmt.set_font_outline(arg)
|
398
362
|
assert_equal(arg, fmt.font_outline, "arg : #{arg}")
|
399
363
|
end
|
400
|
-
|
401
|
-
# invalid args
|
402
|
-
[-1, 0.2, 100, 'outline', true, false, nil].each do |arg|
|
403
|
-
assert_raise(ArgumentError,
|
404
|
-
"set_font_outline(#{arg}) : arg must be 0, 1 or none."){
|
405
|
-
fmt = Writeexcel::Format.new
|
406
|
-
fmt.set_font_outline(arg)
|
407
|
-
}
|
408
|
-
end
|
409
364
|
end
|
410
365
|
|
411
366
|
=begin
|
@@ -431,15 +386,6 @@ Macintosh only.
|
|
431
386
|
fmt.set_font_shadow(arg)
|
432
387
|
assert_equal(arg, fmt.font_shadow, "arg : #{arg}")
|
433
388
|
end
|
434
|
-
|
435
|
-
# invalid args
|
436
|
-
[-1, 0.2, 100, 'shadow', true, false, nil].each do |arg|
|
437
|
-
assert_raise(ArgumentError,
|
438
|
-
"set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
|
439
|
-
fmt = Writeexcel::Format.new
|
440
|
-
fmt.set_font_shadow(arg)
|
441
|
-
}
|
442
|
-
end
|
443
389
|
end
|
444
390
|
|
445
391
|
=begin
|
@@ -515,15 +461,6 @@ Note: This offers weak protection even with a password,
|
|
515
461
|
fmt.set_locked(arg)
|
516
462
|
assert_equal(arg, fmt.locked, "arg : #{arg}")
|
517
463
|
end
|
518
|
-
|
519
|
-
# invalid args
|
520
|
-
[-1, 0.2, 100, 'locked', true, false, nil].each do |arg|
|
521
|
-
assert_raise(ArgumentError,
|
522
|
-
"set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
|
523
|
-
fmt = Writeexcel::Format.new
|
524
|
-
fmt.set_locked(arg)
|
525
|
-
}
|
526
|
-
end
|
527
464
|
end
|
528
465
|
=begin
|
529
466
|
set_hidden()
|
@@ -564,15 +501,6 @@ Note: This offers weak protection even with a password,
|
|
564
501
|
fmt.set_hidden(arg)
|
565
502
|
assert_equal(arg, fmt.hidden, "arg : #{arg}")
|
566
503
|
end
|
567
|
-
|
568
|
-
# invalid args
|
569
|
-
[-1, 0.2, 100, 'hidden', true, false, nil].each do |arg|
|
570
|
-
assert_raise(ArgumentError,
|
571
|
-
"set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
|
572
|
-
fmt = Writeexcel::Format.new
|
573
|
-
fmt.set_hidden(arg)
|
574
|
-
}
|
575
|
-
end
|
576
504
|
end
|
577
505
|
|
578
506
|
=begin
|
@@ -703,15 +631,6 @@ set_text_wrap()
|
|
703
631
|
fmt.set_text_wrap(arg)
|
704
632
|
assert_equal(arg, fmt.text_wrap, "arg : #{arg}")
|
705
633
|
end
|
706
|
-
|
707
|
-
# invalid args
|
708
|
-
[-1, 0.2, 100, 'text_wrap', true, false, nil].each do |arg|
|
709
|
-
assert_raise(ArgumentError,
|
710
|
-
"set_text_wrap(#{arg}) : arg must be 0, 1 or none."){
|
711
|
-
fmt = Writeexcel::Format.new
|
712
|
-
fmt.set_text_wrap(arg)
|
713
|
-
}
|
714
|
-
end
|
715
634
|
end
|
716
635
|
|
717
636
|
=begin
|
@@ -1025,20 +944,6 @@ Note: this is not a copy constructor, both objects must exist prior to copying.
|
|
1025
944
|
assert_equal(contents, rcontents, "Contents not the same")
|
1026
945
|
end
|
1027
946
|
|
1028
|
-
def test_initialize
|
1029
|
-
assert_nothing_raised {
|
1030
|
-
Writeexcel::Format.new(
|
1031
|
-
:bold => true,
|
1032
|
-
:size => 10,
|
1033
|
-
:color => 'black',
|
1034
|
-
:fg_color => 43,
|
1035
|
-
:align => 'top',
|
1036
|
-
:text_wrap => true,
|
1037
|
-
:border => 1
|
1038
|
-
)
|
1039
|
-
}
|
1040
|
-
end
|
1041
|
-
|
1042
947
|
# added by Nakamura
|
1043
948
|
|
1044
949
|
def test_get_xf
|
@@ -1133,24 +1038,6 @@ Note: this is not a copy constructor, both objects must exist prior to copying.
|
|
1133
1038
|
# :align => 'left',
|
1134
1039
|
|
1135
1040
|
def get_format_property(format)
|
1136
|
-
text_h_align = {
|
1137
|
-
1 => 'left',
|
1138
|
-
2 => 'center/centre',
|
1139
|
-
3 => 'right',
|
1140
|
-
4 => 'fill',
|
1141
|
-
5 => 'justiry',
|
1142
|
-
6 => 'center_across/centre_across/merge',
|
1143
|
-
7 => 'distributed/equal_space'
|
1144
|
-
}
|
1145
|
-
|
1146
|
-
text_v_align = {
|
1147
|
-
0 => 'top',
|
1148
|
-
1 => 'vcenter/vcentre',
|
1149
|
-
2 => 'bottom',
|
1150
|
-
3 => 'vjustify',
|
1151
|
-
4 => 'vdistributed/vequal_space'
|
1152
|
-
}
|
1153
|
-
|
1154
1041
|
return {
|
1155
1042
|
:font => format.font,
|
1156
1043
|
:size => format.size,
|
data/test/test_formula.rb
CHANGED
data/test/test_properties.rb
CHANGED
@@ -3,13 +3,12 @@
|
|
3
3
|
require 'helper'
|
4
4
|
require 'stringio'
|
5
5
|
|
6
|
-
class TestProperties < Test
|
6
|
+
class TestProperties < Minitest::Test
|
7
7
|
def setup
|
8
8
|
@workbook = WriteExcel.new(StringIO.new)
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_pack_VT_FILETIME
|
12
|
-
filetime =
|
13
12
|
assert_equal(
|
14
13
|
'40 00 00 00 00 FD 2D ED CE 48 CE 01',
|
15
14
|
unpack_record(pack_VT_FILETIME(Time.gm(2013, 5, 4, 13, 54, 42)))
|
data/test/test_storage_lite.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'helper'
|
3
3
|
require 'stringio'
|
4
4
|
|
5
|
-
class TC_OLEStorageLite < Test
|
5
|
+
class TC_OLEStorageLite < Minitest::Test
|
6
6
|
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
7
7
|
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
8
8
|
EXCEL_OUTDIR = File.join(TEST_DIR, 'excelfile')
|
@@ -45,7 +45,7 @@ class TC_OLEStorageLite < Test::Unit::TestCase
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
class TC_OLEStorageLitePPSFile < Test
|
48
|
+
class TC_OLEStorageLitePPSFile < Minitest::Test
|
49
49
|
def test_constructor
|
50
50
|
data = [
|
51
51
|
{ :name => 'name', :data => 'data' },
|
data/test/test_workbook.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'helper'
|
3
3
|
require "stringio"
|
4
4
|
|
5
|
-
class TC_Workbook < Test
|
5
|
+
class TC_Workbook < Minitest::Test
|
6
6
|
|
7
7
|
def setup
|
8
8
|
@test_file = StringIO.new
|
@@ -24,71 +24,6 @@ class TC_Workbook < Test::Unit::TestCase
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_set_tempdir_after_sheet_added
|
28
|
-
# after shees added, call set_tempdir raise RuntimeError
|
29
|
-
@workbook.add_worksheet('name')
|
30
|
-
assert_raise(RuntimeError, "already sheet exists, but set_tempdir() doesn't raise"){
|
31
|
-
@workbook.set_tempdir
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_set_tempdir_with_invalid_dir
|
36
|
-
# invalid dir raise RuntimeError
|
37
|
-
while true do
|
38
|
-
dir = Time.now.to_s
|
39
|
-
break unless FileTest.directory?(dir)
|
40
|
-
sleep 0.1
|
41
|
-
end
|
42
|
-
assert_raise(RuntimeError, "set_tempdir() doesn't raise invalid dir:#{dir}."){
|
43
|
-
@workbook.set_tempdir(dir)
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_check_sheetname
|
48
|
-
worksheet1 = @workbook.add_worksheet # implicit name 'Sheet1'
|
49
|
-
worksheet2 = @workbook.add_worksheet # implicit name 'Sheet2'
|
50
|
-
worksheet3 = @workbook.add_worksheet 'Sheet3' # explicit name 'Sheet3'
|
51
|
-
worksheet4 = @workbook.add_worksheet 'Sheetz' # explicit name 'Sheetz'
|
52
|
-
|
53
|
-
valid_sheetnames.each do |test|
|
54
|
-
target = test[0]
|
55
|
-
sheetname = test[1]
|
56
|
-
caption = test[2]
|
57
|
-
assert_nothing_raised { @workbook.add_worksheet(sheetname) }
|
58
|
-
end
|
59
|
-
|
60
|
-
invalid_sheetnames.each do |test|
|
61
|
-
target = test[0]
|
62
|
-
sheetname = test[1]
|
63
|
-
caption = test[2]
|
64
|
-
assert_raise(RuntimeError, "sheetname: #{sheetname}") {
|
65
|
-
@workbook.add_worksheet(sheetname)
|
66
|
-
}
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_check_sheetname_raise_if_same_utf16be_sheet_name
|
71
|
-
smily = [0x263a].pack('n')
|
72
|
-
@workbook.add_worksheet(smily, true)
|
73
|
-
assert_raise(RuntimeError) { @workbook.add_worksheet(smily, true)}
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_check_sheetname_utf8_only
|
77
|
-
['Лист 1', 'Лист 2', 'Лист 3'].each do |sheetname|
|
78
|
-
assert_nothing_raised { @workbook.add_worksheet(sheetname) }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_check_unicode_bytes_even
|
83
|
-
assert_nothing_raised(RuntimeError){ @workbook.add_worksheet('ab', 1)}
|
84
|
-
assert_raise(RuntimeError){ @workbook.add_worksheet('abc', 1)}
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_raise_set_compatibility_after_sheet_creation
|
88
|
-
@workbook.add_worksheet
|
89
|
-
assert_raise(RuntimeError) { @workbook.compatibility_mode }
|
90
|
-
end
|
91
|
-
|
92
27
|
def valid_sheetnames
|
93
28
|
[
|
94
29
|
# Tests for valid names
|
data/test/test_worksheet.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'helper'
|
3
3
|
require 'stringio'
|
4
4
|
|
5
|
-
class TC_Worksheet < Test
|
5
|
+
class TC_Worksheet < Minitest::Test
|
6
6
|
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
7
7
|
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
8
8
|
|
@@ -31,23 +31,6 @@ class TC_Worksheet < Test::Unit::TestCase
|
|
31
31
|
assert_respond_to(@ws, :write_col)
|
32
32
|
end
|
33
33
|
|
34
|
-
def test_methods_no_error
|
35
|
-
assert_nothing_raised{ @ws.write(0,0,nil) }
|
36
|
-
assert_nothing_raised{ @ws.write(0,0,"Hello") }
|
37
|
-
assert_nothing_raised{ @ws.write(0,0,888) }
|
38
|
-
assert_nothing_raised{ @ws.write_row(0,0,["one","two","three"]) }
|
39
|
-
assert_nothing_raised{ @ws.write_row(0,0,[1,2,3]) }
|
40
|
-
assert_nothing_raised{ @ws.write_col(0,0,["one","two","three"]) }
|
41
|
-
assert_nothing_raised{ @ws.write_col(0,0,[1,2,3]) }
|
42
|
-
assert_nothing_raised{ @ws.write_blank(0,0,nil) }
|
43
|
-
assert_nothing_raised{ @ws.write_url(0,0,"http://www.ruby-lang.org") }
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_write_syntax
|
47
|
-
assert_nothing_raised{@ws.write(0,0,"Hello")}
|
48
|
-
assert_nothing_raised{@ws.write(0,0,666)}
|
49
|
-
end
|
50
|
-
|
51
34
|
def test_store_dimensions
|
52
35
|
file = "delete_this"
|
53
36
|
File.open(file,"w+"){ |f| f.print @ws.__send__("store_dimensions") }
|
data/writeexcel.gemspec
CHANGED
@@ -5,9 +5,9 @@ require 'writeexcel/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "writeexcel"
|
8
|
-
gem.version =
|
8
|
+
gem.version = Writeexcel::VERSION
|
9
9
|
gem.authors = ["Hideo NAKAMURA"]
|
10
|
-
gem.email = ["
|
10
|
+
gem.email = ["nakamura.hideo@gmail.com"]
|
11
11
|
gem.description = "Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells."
|
12
12
|
gem.summary = "Write to a cross-platform Excel binary file."
|
13
13
|
gem.homepage = "http://github.com/cxn03651/writeexcel#readme"
|
@@ -17,7 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
gem.
|
20
|
+
gem.required_ruby_version = '>= 2.4.0'
|
21
|
+
gem.add_development_dependency 'minitest'
|
22
|
+
gem.add_runtime_dependency 'racc' if RUBY_VERSION >= '3.3'
|
23
|
+
gem.add_development_dependency 'rake'
|
21
24
|
gem.extra_rdoc_files = [
|
22
25
|
"LICENSE.txt",
|
23
26
|
"README.rdoc"
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: writeexcel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
@@ -42,7 +56,7 @@ description: Multiple worksheets can be added to a workbook and formatting can b
|
|
42
56
|
applied to cells. Text, numbers, formulas, hyperlinks and images can be written
|
43
57
|
to the cells.
|
44
58
|
email:
|
45
|
-
-
|
59
|
+
- nakamura.hideo@gmail.com
|
46
60
|
executables: []
|
47
61
|
extensions: []
|
48
62
|
extra_rdoc_files:
|
@@ -51,6 +65,7 @@ extra_rdoc_files:
|
|
51
65
|
files:
|
52
66
|
- ".document"
|
53
67
|
- ".gitattributes"
|
68
|
+
- ".github/workflows/test-suite.yml"
|
54
69
|
- ".gitignore"
|
55
70
|
- Gemfile
|
56
71
|
- LICENSE.txt
|
@@ -263,8 +278,6 @@ files:
|
|
263
278
|
- test/perl_output/ws_store_window2
|
264
279
|
- test/republic.png
|
265
280
|
- test/test_00_IEEE_double.rb
|
266
|
-
- test/test_01_add_worksheet.rb
|
267
|
-
- test/test_02_merge_formats.rb
|
268
281
|
- test/test_04_dimensions.rb
|
269
282
|
- test/test_05_rows.rb
|
270
283
|
- test/test_06_extsst.rb
|
@@ -294,13 +307,10 @@ files:
|
|
294
307
|
- test/test_61_chart_subclasses.rb
|
295
308
|
- test/test_62_chart_formats.rb
|
296
309
|
- test/test_63_chart_area_formats.rb
|
297
|
-
- test/test_biff.rb
|
298
|
-
- test/test_big_workbook.rb
|
299
310
|
- test/test_compatibility.rb
|
300
311
|
- test/test_example_match.rb
|
301
312
|
- test/test_format.rb
|
302
313
|
- test/test_formula.rb
|
303
|
-
- test/test_ole.rb
|
304
314
|
- test/test_properties.rb
|
305
315
|
- test/test_storage_lite.rb
|
306
316
|
- test/test_workbook.rb
|
@@ -313,7 +323,7 @@ homepage: http://github.com/cxn03651/writeexcel#readme
|
|
313
323
|
licenses:
|
314
324
|
- MIT
|
315
325
|
metadata: {}
|
316
|
-
post_install_message:
|
326
|
+
post_install_message:
|
317
327
|
rdoc_options: []
|
318
328
|
require_paths:
|
319
329
|
- lib
|
@@ -321,16 +331,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
321
331
|
requirements:
|
322
332
|
- - ">="
|
323
333
|
- !ruby/object:Gem::Version
|
324
|
-
version:
|
334
|
+
version: 2.4.0
|
325
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
326
336
|
requirements:
|
327
337
|
- - ">="
|
328
338
|
- !ruby/object:Gem::Version
|
329
339
|
version: '0'
|
330
340
|
requirements: []
|
331
|
-
|
332
|
-
|
333
|
-
signing_key:
|
341
|
+
rubygems_version: 3.4.21
|
342
|
+
signing_key:
|
334
343
|
specification_version: 4
|
335
344
|
summary: Write to a cross-platform Excel binary file.
|
336
345
|
test_files:
|
@@ -423,8 +432,6 @@ test_files:
|
|
423
432
|
- test/perl_output/ws_store_window2
|
424
433
|
- test/republic.png
|
425
434
|
- test/test_00_IEEE_double.rb
|
426
|
-
- test/test_01_add_worksheet.rb
|
427
|
-
- test/test_02_merge_formats.rb
|
428
435
|
- test/test_04_dimensions.rb
|
429
436
|
- test/test_05_rows.rb
|
430
437
|
- test/test_06_extsst.rb
|
@@ -454,16 +461,12 @@ test_files:
|
|
454
461
|
- test/test_61_chart_subclasses.rb
|
455
462
|
- test/test_62_chart_formats.rb
|
456
463
|
- test/test_63_chart_area_formats.rb
|
457
|
-
- test/test_biff.rb
|
458
|
-
- test/test_big_workbook.rb
|
459
464
|
- test/test_compatibility.rb
|
460
465
|
- test/test_example_match.rb
|
461
466
|
- test/test_format.rb
|
462
467
|
- test/test_formula.rb
|
463
|
-
- test/test_ole.rb
|
464
468
|
- test/test_properties.rb
|
465
469
|
- test/test_storage_lite.rb
|
466
470
|
- test/test_workbook.rb
|
467
471
|
- test/test_worksheet.rb
|
468
472
|
- test/test_write_formula_does_not_change_formula_string.rb
|
469
|
-
has_rdoc:
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'helper'
|
3
|
-
|
4
|
-
class TC_add_worksheet < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@workbook = WriteExcel.new(StringIO.new)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_ascii_worksheet_name
|
11
|
-
|
12
|
-
name = "Test"
|
13
|
-
|
14
|
-
assert_nothing_raised {
|
15
|
-
sheet = @workbook.add_worksheet(name)
|
16
|
-
assert_equal name, sheet.name
|
17
|
-
}
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_utf_8_worksheet_name
|
22
|
-
|
23
|
-
name = "Décembre"
|
24
|
-
|
25
|
-
assert_nothing_raised {
|
26
|
-
sheet = @workbook.add_worksheet(name)
|
27
|
-
assert_equal utf8_to_16be(name), sheet.name
|
28
|
-
}
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_utf_16be_worksheet_name
|
33
|
-
|
34
|
-
name = utf8_to_16be("Décembre")
|
35
|
-
|
36
|
-
assert_nothing_raised {
|
37
|
-
sheet = @workbook.add_worksheet(name, true)
|
38
|
-
assert_equal name, sheet.name
|
39
|
-
}
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'helper'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
class TC_merge_formats < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@workbook = WriteExcel.new(StringIO.new)
|
9
|
-
@worksheet = @workbook.add_worksheet
|
10
|
-
@merged_format = @workbook.add_format(:bold => 1)
|
11
|
-
@non_merged_format = @workbook.add_format(:bold => 1)
|
12
|
-
|
13
|
-
@worksheet.set_row( 5, nil, @merged_format)
|
14
|
-
@worksheet.set_column('G:G', nil, @merged_format)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_some
|
18
|
-
# Test 1 Normal usage.
|
19
|
-
assert_nothing_raised { @worksheet.write('A1', 'Test', @non_merged_format) }
|
20
|
-
assert_nothing_raised { @worksheet.write('A3:B4', 'Test', @merged_format) }
|
21
|
-
|
22
|
-
# Test 2 Non merge format in merged cells.
|
23
|
-
assert_nothing_raised {
|
24
|
-
@worksheet.merge_range('D3:E4', 'Test', @non_merged_format)
|
25
|
-
}
|
26
|
-
|
27
|
-
# Test 3 Merge format in column.
|
28
|
-
assert_nothing_raised { @worksheet.write('G1', 'Test') }
|
29
|
-
|
30
|
-
# Test 4 Merge format in row.
|
31
|
-
assert_nothing_raised { @worksheet.write('A6', 'Test') }
|
32
|
-
|
33
|
-
# Test 5 Merge format in column and row.
|
34
|
-
assert_nothing_raised { @worksheet.write('G6', 'Test') }
|
35
|
-
|
36
|
-
# Test 6 No merge format in column and row.
|
37
|
-
assert_nothing_raised { @worksheet.write('H7', 'Test') }
|
38
|
-
|
39
|
-
# Test 7 Normal usage again.
|
40
|
-
assert_nothing_raised {
|
41
|
-
@worksheet.write('A1', 'Test', @non_merged_format)
|
42
|
-
}
|
43
|
-
assert_nothing_raised {
|
44
|
-
@worksheet.merge_range('A3:B4', 'Test', @merged_format)
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
end
|
data/test/test_biff.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'helper'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
class TC_BIFFWriter < Test::Unit::TestCase
|
6
|
-
|
7
|
-
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
8
|
-
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@biff = BIFFWriter.new
|
12
|
-
@ruby_file = StringIO.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_append_no_error
|
16
|
-
assert_nothing_raised{ @biff.append("World") }
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_prepend_no_error
|
20
|
-
assert_nothing_raised{ @biff.prepend("Hello") }
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_data_added
|
24
|
-
assert_nothing_raised{ @biff.append("Hello", "World") }
|
25
|
-
data = ''
|
26
|
-
while d = @biff.get_data
|
27
|
-
data += d
|
28
|
-
end
|
29
|
-
assert_equal("HelloWorld", data, "Bad data contents")
|
30
|
-
assert_equal(10, @biff.datasize, "Bad data size")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_data_prepended
|
34
|
-
|
35
|
-
assert_nothing_raised{ @biff.append("Hello") }
|
36
|
-
assert_nothing_raised{ @biff.prepend("World") }
|
37
|
-
data = ''
|
38
|
-
while d = @biff.get_data
|
39
|
-
data += d
|
40
|
-
end
|
41
|
-
assert_equal("WorldHello", data, "Bad data contents")
|
42
|
-
assert_equal(10, @biff.datasize, "Bad data size")
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_store_bof_length
|
46
|
-
assert_nothing_raised{ @biff.store_bof }
|
47
|
-
assert_equal(20, @biff.datasize, "Bad data size after store_bof call")
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_store_eof_length
|
51
|
-
assert_nothing_raised{ @biff.store_eof }
|
52
|
-
assert_equal(4, @biff.datasize, "Bad data size after store_eof call")
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_datasize_mixed
|
56
|
-
assert_nothing_raised{ @biff.append("Hello") }
|
57
|
-
assert_nothing_raised{ @biff.prepend("World") }
|
58
|
-
assert_nothing_raised{ @biff.store_bof }
|
59
|
-
assert_nothing_raised{ @biff.store_eof }
|
60
|
-
assert_equal(34, @biff.datasize, "Bad data size for mixed data")
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_add_continue
|
64
|
-
perl_file = "#{PERL_OUTDIR}/biff_add_continue_testdata"
|
65
|
-
size = File.size(perl_file)
|
66
|
-
@ruby_file.print(@biff.add_continue('testdata'))
|
67
|
-
rsize = @ruby_file.size
|
68
|
-
assert_equal(size, rsize, "File sizes not the same")
|
69
|
-
compare_file(perl_file, @ruby_file)
|
70
|
-
end
|
71
|
-
end
|
data/test/test_big_workbook.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'helper'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
class TC_BigWorkbook < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def test_big_workbook_saves
|
8
|
-
workbook = Workbook.new(StringIO.new)
|
9
|
-
4.times do
|
10
|
-
worksheet = workbook.add_worksheet
|
11
|
-
500.times {|i| worksheet.write_row(i, 0, [rand(10000).to_s])}
|
12
|
-
end
|
13
|
-
|
14
|
-
assert_nothing_raised { workbook.close }
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|