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,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionImage35 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
@tempfile.close(true)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_image35
|
|
14
|
+
@xlsx = 'image35.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@io)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
|
|
18
|
+
worksheet.insert_image(
|
|
19
|
+
'E9',
|
|
20
|
+
File.join(@test_dir, 'regression', 'images/zero_dpi.jpg')
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
workbook.close
|
|
24
|
+
compare_for_regression
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -31,9 +31,6 @@ def test_properties01
|
|
|
31
31
|
worksheet.write('A1', "Select 'Office Button -> Prepare -> Properties' to see the file properties.")
|
|
32
32
|
|
|
33
33
|
workbook.close
|
|
34
|
-
compare_for_regression
|
|
35
|
-
nil,
|
|
36
|
-
{ 'xl/workbook.xml' => ['<workbookView'] }
|
|
37
|
-
)
|
|
34
|
+
compare_for_regression
|
|
38
35
|
end
|
|
39
36
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionProperties03 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
@tempfile.close(true)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_properties03
|
|
14
|
+
@xlsx = 'properties03.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@io)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
|
|
18
|
+
workbook.set_custom_property('Checked by', 'Adam')
|
|
19
|
+
|
|
20
|
+
worksheet.set_column('A:A', 70)
|
|
21
|
+
worksheet.write('A1', "Select 'Office Button -> Prepare -> Properties' to see the file properties.")
|
|
22
|
+
|
|
23
|
+
workbook.close
|
|
24
|
+
compare_for_regression
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionProperties04 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
@long_string = 'This is a long string. ' * 11 + 'AA'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def teardown
|
|
11
|
+
@tempfile.close(true)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_properties04
|
|
15
|
+
@xlsx = 'properties04.xlsx'
|
|
16
|
+
workbook = WriteXLSX.new(@io)
|
|
17
|
+
worksheet = workbook.add_worksheet
|
|
18
|
+
|
|
19
|
+
workbook.set_custom_property('Checked by', 'Adam', 'text' )
|
|
20
|
+
workbook.set_custom_property('Date completed', '2016-12-12T23:00:00Z', 'date' )
|
|
21
|
+
workbook.set_custom_property('Document number', '12345' , 'number_int')
|
|
22
|
+
workbook.set_custom_property('Reference', '1.2345', 'number' )
|
|
23
|
+
workbook.set_custom_property('Source', true, 'bool' )
|
|
24
|
+
workbook.set_custom_property('Status', false, 'bool' )
|
|
25
|
+
workbook.set_custom_property('Department', @long_string, 'text' )
|
|
26
|
+
workbook.set_custom_property('Group', '1.2345678901234', 'number' )
|
|
27
|
+
|
|
28
|
+
worksheet.set_column('A:A', 70 )
|
|
29
|
+
worksheet.write(
|
|
30
|
+
'A1',
|
|
31
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
workbook.close
|
|
35
|
+
compare_for_regression
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_properties04_2
|
|
39
|
+
@xlsx = 'properties04.xlsx'
|
|
40
|
+
workbook = WriteXLSX.new(@io)
|
|
41
|
+
worksheet = workbook.add_worksheet
|
|
42
|
+
|
|
43
|
+
workbook.set_custom_property('Checked by', 'Adam' )
|
|
44
|
+
workbook.set_custom_property('Date completed', '2016-12-12T23:00:00Z', 'date' )
|
|
45
|
+
workbook.set_custom_property('Document number', '12345' )
|
|
46
|
+
workbook.set_custom_property('Reference', '1.2345' )
|
|
47
|
+
workbook.set_custom_property('Source', 1, 'bool' )
|
|
48
|
+
workbook.set_custom_property('Status', nil, 'bool' )
|
|
49
|
+
workbook.set_custom_property('Department', @long_string )
|
|
50
|
+
workbook.set_custom_property('Group', '1.2345678901234' )
|
|
51
|
+
|
|
52
|
+
worksheet.set_column('A:A', 70 )
|
|
53
|
+
worksheet.write(
|
|
54
|
+
'A1',
|
|
55
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
workbook.close
|
|
59
|
+
compare_for_regression
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionProperties05 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
@long_string = 'This is a long string. ' * 11 + 'AA'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def teardown
|
|
11
|
+
@tempfile.close(true)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_properties05
|
|
15
|
+
@xlsx = 'properties05.xlsx'
|
|
16
|
+
workbook = WriteXLSX.new(@io)
|
|
17
|
+
worksheet = workbook.add_worksheet
|
|
18
|
+
|
|
19
|
+
workbook.set_custom_property('Location', 'Café')
|
|
20
|
+
|
|
21
|
+
worksheet.set_column('A:A', 70 )
|
|
22
|
+
worksheet.write(
|
|
23
|
+
'A1',
|
|
24
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
workbook.close
|
|
28
|
+
compare_for_regression
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -21,6 +21,9 @@ def test_table03
|
|
|
21
21
|
# Add the table.
|
|
22
22
|
worksheet.add_table('C3:F13')
|
|
23
23
|
|
|
24
|
+
# Turn off default URL format for testing.
|
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
|
26
|
+
|
|
24
27
|
# Add a link to check rId handling.
|
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
|
26
29
|
|
|
@@ -21,6 +21,9 @@ def test_table04
|
|
|
21
21
|
# Add the table.
|
|
22
22
|
worksheet.add_table('C3:F13')
|
|
23
23
|
|
|
24
|
+
# Turn off default URL format for testing.
|
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
|
26
|
+
|
|
24
27
|
# Add a link to check rId handling.
|
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
|
26
29
|
|
|
@@ -21,6 +21,9 @@ def test_table05
|
|
|
21
21
|
# Add the table.
|
|
22
22
|
worksheet.add_table('C3:F13')
|
|
23
23
|
|
|
24
|
+
# Turn off default URL format for testing.
|
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
|
26
|
+
|
|
24
27
|
# Add a link to check rId handling.
|
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
|
26
29
|
|
|
@@ -23,6 +23,9 @@ def test_table06
|
|
|
23
23
|
worksheet.add_table('F15:H20')
|
|
24
24
|
worksheet.add_table('C23:D30')
|
|
25
25
|
|
|
26
|
+
# Turn off default URL format for testing.
|
|
27
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
|
28
|
+
|
|
26
29
|
# Add a link to check rId handling.
|
|
27
30
|
worksheet.write('A1', 'http://perl.com/')
|
|
28
31
|
worksheet.write('C1', 'http://perl.com/')
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionTable20 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
@tempfile.close(true) if @tempfile
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_table20
|
|
14
|
+
@xlsx = 'table01.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@io)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
|
|
18
|
+
# Set the column width to match the taget worksheet.
|
|
19
|
+
worksheet.set_column('C:F', 10.288)
|
|
20
|
+
|
|
21
|
+
# Add the table.
|
|
22
|
+
worksheet.add_table('C3:F13')
|
|
23
|
+
|
|
24
|
+
e = assert_raises RuntimeError do
|
|
25
|
+
worksheet.add_table(
|
|
26
|
+
'C3:F7',
|
|
27
|
+
:columns => [ { :header => 'Column1' }, { :header => 'column1' }]
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
assert_match(/add_table\(\) contains duplicate name:/, e.message)
|
|
31
|
+
|
|
32
|
+
workbook.close
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionTable21 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
@tempfile.close(true) if @tempfile
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_table21
|
|
14
|
+
@xlsx = 'table21.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@io)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
|
|
18
|
+
worksheet.write('A1', 'Column')
|
|
19
|
+
|
|
20
|
+
# Set the column width to match the taget worksheet.
|
|
21
|
+
worksheet.set_column('C:D', 10.288)
|
|
22
|
+
|
|
23
|
+
# Add the table.
|
|
24
|
+
worksheet.add_table(
|
|
25
|
+
'C3:D13',
|
|
26
|
+
{
|
|
27
|
+
:columns => [
|
|
28
|
+
{ :header => "Column" }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
workbook.close
|
|
34
|
+
compare_for_regression
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionTable22 < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
@tempfile.close(true) if @tempfile
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_table22
|
|
14
|
+
@xlsx = 'table22.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@io)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
|
|
18
|
+
data = [
|
|
19
|
+
['apple', 'pie' ],
|
|
20
|
+
['pine', 'tree']
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Set the column width to match the taget worksheet.
|
|
24
|
+
worksheet.set_column('B:C', 10.288)
|
|
25
|
+
|
|
26
|
+
# Add the table.
|
|
27
|
+
worksheet.add_table('B2:C3', :data => data, :header_row => 0)
|
|
28
|
+
|
|
29
|
+
workbook.close
|
|
30
|
+
compare_for_regression
|
|
31
|
+
end
|
|
32
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
require 'write_xlsx'
|
|
4
|
+
require 'stringio'
|
|
5
|
+
|
|
6
|
+
class TestGetChartRange < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
@workbook = WriteXLSX.new(StringIO.new)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_write_workbook_view_1
|
|
12
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/>'
|
|
13
|
+
result = @workbook.__send__('write_workbook_view')
|
|
14
|
+
|
|
15
|
+
assert_equal(expected, result)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_write_workbook_view_second_tab_selected
|
|
19
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660" activeTab="1"/>'
|
|
20
|
+
|
|
21
|
+
@workbook.activesheet = 1
|
|
22
|
+
result = @workbook.__send__('write_workbook_view')
|
|
23
|
+
|
|
24
|
+
assert_equal(expected, result)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_write_workbook_view_second_tab_selected_first_sheet_set
|
|
28
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660" firstSheet="2" activeTab="1"/>'
|
|
29
|
+
|
|
30
|
+
@workbook.firstsheet = 1
|
|
31
|
+
@workbook.activesheet = 1
|
|
32
|
+
result = @workbook.__send__('write_workbook_view')
|
|
33
|
+
|
|
34
|
+
assert_equal(expected, result)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_write_workbook_view_with_set_size
|
|
38
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/>'
|
|
39
|
+
|
|
40
|
+
@workbook.set_size
|
|
41
|
+
result = @workbook.__send__('write_workbook_view')
|
|
42
|
+
|
|
43
|
+
assert_equal(expected, result)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_write_workbook_view_with_set_size_0_0
|
|
47
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/>'
|
|
48
|
+
|
|
49
|
+
@workbook.set_size(0, 0)
|
|
50
|
+
result = @workbook.__send__('write_workbook_view')
|
|
51
|
+
|
|
52
|
+
assert_equal(expected, result)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_write_workbook_view_with_set_size_1073_644
|
|
56
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/>'
|
|
57
|
+
|
|
58
|
+
@workbook.set_size(1073, 644)
|
|
59
|
+
result = @workbook.__send__('write_workbook_view')
|
|
60
|
+
|
|
61
|
+
assert_equal(expected, result)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_write_workbook_view_with_set_size_123_70
|
|
65
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="1845" windowHeight="1050"/>'
|
|
66
|
+
|
|
67
|
+
@workbook.set_size(123, 70)
|
|
68
|
+
result = @workbook.__send__('write_workbook_view')
|
|
69
|
+
|
|
70
|
+
assert_equal(expected, result)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_write_workbook_view_with_set_size_719_490
|
|
74
|
+
expected = '<workbookView xWindow="240" yWindow="15" windowWidth="10785" windowHeight="7350"/>'
|
|
75
|
+
|
|
76
|
+
@workbook.set_size(719, 490)
|
|
77
|
+
result = @workbook.__send__('write_workbook_view')
|
|
78
|
+
|
|
79
|
+
assert_equal(expected, result)
|
|
80
|
+
end
|
|
81
|
+
end
|