culturecode-roo 2.0.1
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.
- data/.gitignore +7 -0
- data/.simplecov +4 -0
- data/.travis.yml +13 -0
- data/CHANGELOG +438 -0
- data/Gemfile +24 -0
- data/Guardfile +24 -0
- data/LICENSE +22 -0
- data/README.md +121 -0
- data/Rakefile +23 -0
- data/examples/roo_soap_client.rb +50 -0
- data/examples/roo_soap_server.rb +26 -0
- data/examples/write_me.rb +31 -0
- data/lib/roo.rb +28 -0
- data/lib/roo/base.rb +717 -0
- data/lib/roo/csv.rb +110 -0
- data/lib/roo/excelx.rb +542 -0
- data/lib/roo/excelx/comments.rb +23 -0
- data/lib/roo/excelx/extractor.rb +20 -0
- data/lib/roo/excelx/relationships.rb +26 -0
- data/lib/roo/excelx/shared_strings.rb +40 -0
- data/lib/roo/excelx/sheet_doc.rb +175 -0
- data/lib/roo/excelx/styles.rb +62 -0
- data/lib/roo/excelx/workbook.rb +59 -0
- data/lib/roo/font.rb +17 -0
- data/lib/roo/libre_office.rb +5 -0
- data/lib/roo/link.rb +15 -0
- data/lib/roo/open_office.rb +652 -0
- data/lib/roo/spreadsheet.rb +31 -0
- data/lib/roo/utils.rb +81 -0
- data/lib/roo/version.rb +3 -0
- data/roo.gemspec +27 -0
- data/scripts/txt2html +67 -0
- data/spec/fixtures/vcr_cassettes/google_drive.yml +165 -0
- data/spec/fixtures/vcr_cassettes/google_drive_access_token.yml +73 -0
- data/spec/fixtures/vcr_cassettes/google_drive_set.yml +857 -0
- data/spec/lib/roo/base_spec.rb +4 -0
- data/spec/lib/roo/csv_spec.rb +48 -0
- data/spec/lib/roo/excelx/format_spec.rb +51 -0
- data/spec/lib/roo/excelx_spec.rb +363 -0
- data/spec/lib/roo/libreoffice_spec.rb +13 -0
- data/spec/lib/roo/openoffice_spec.rb +15 -0
- data/spec/lib/roo/spreadsheet_spec.rb +88 -0
- data/spec/lib/roo/utils_spec.rb +105 -0
- data/spec/spec_helper.rb +9 -0
- data/test/all_ss.rb +11 -0
- data/test/files/1900_base.xlsx +0 -0
- data/test/files/1904_base.xlsx +0 -0
- data/test/files/Bibelbund.csv +3741 -0
- data/test/files/Bibelbund.ods +0 -0
- data/test/files/Bibelbund.xlsx +0 -0
- data/test/files/Bibelbund1.ods +0 -0
- data/test/files/Pfand_from_windows_phone.xlsx +0 -0
- data/test/files/advanced_header.ods +0 -0
- data/test/files/bbu.ods +0 -0
- data/test/files/bbu.xlsx +0 -0
- data/test/files/bode-v1.ods.zip +0 -0
- data/test/files/bode-v1.xls.zip +0 -0
- data/test/files/boolean.csv +2 -0
- data/test/files/boolean.ods +0 -0
- data/test/files/boolean.xlsx +0 -0
- data/test/files/borders.ods +0 -0
- data/test/files/borders.xlsx +0 -0
- data/test/files/bug-numbered-sheet-names.xlsx +0 -0
- data/test/files/comments.ods +0 -0
- data/test/files/comments.xlsx +0 -0
- data/test/files/csvtypes.csv +1 -0
- data/test/files/datetime.ods +0 -0
- data/test/files/datetime.xlsx +0 -0
- data/test/files/dreimalvier.ods +0 -0
- data/test/files/emptysheets.ods +0 -0
- data/test/files/emptysheets.xlsx +0 -0
- data/test/files/encrypted-letmein.ods +0 -0
- data/test/files/file_item_error.xlsx +0 -0
- data/test/files/formula.ods +0 -0
- data/test/files/formula.xlsx +0 -0
- data/test/files/formula_string_error.xlsx +0 -0
- data/test/files/html-escape.ods +0 -0
- data/test/files/link.csv +1 -0
- data/test/files/link.xlsx +0 -0
- data/test/files/matrix.ods +0 -0
- data/test/files/named_cells.ods +0 -0
- data/test/files/named_cells.xlsx +0 -0
- data/test/files/no_spreadsheet_file.txt +1 -0
- data/test/files/numbers-export.xlsx +0 -0
- data/test/files/numbers1.csv +18 -0
- data/test/files/numbers1.ods +0 -0
- data/test/files/numbers1.xlsx +0 -0
- data/test/files/numbers1withnull.xlsx +0 -0
- data/test/files/numeric-link.xlsx +0 -0
- data/test/files/only_one_sheet.ods +0 -0
- data/test/files/only_one_sheet.xlsx +0 -0
- data/test/files/paragraph.ods +0 -0
- data/test/files/paragraph.xlsx +0 -0
- data/test/files/ric.ods +0 -0
- data/test/files/sheet1.xml +109 -0
- data/test/files/simple_spreadsheet.ods +0 -0
- data/test/files/simple_spreadsheet.xlsx +0 -0
- data/test/files/simple_spreadsheet_from_italo.ods +0 -0
- data/test/files/so_datetime.csv +8 -0
- data/test/files/style.ods +0 -0
- data/test/files/style.xlsx +0 -0
- data/test/files/time-test.csv +2 -0
- data/test/files/time-test.ods +0 -0
- data/test/files/time-test.xlsx +0 -0
- data/test/files/type_excel.ods +0 -0
- data/test/files/type_excel.xlsx +0 -0
- data/test/files/type_excelx.ods +0 -0
- data/test/files/type_openoffice.xlsx +0 -0
- data/test/files/whitespace.ods +0 -0
- data/test/files/whitespace.xlsx +0 -0
- data/test/test_generic_spreadsheet.rb +211 -0
- data/test/test_helper.rb +58 -0
- data/test/test_roo.rb +1977 -0
- metadata +329 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/test/files/bbu.ods
ADDED
|
Binary file
|
data/test/files/bbu.xlsx
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1,2,Mayer
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/test/files/link.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"http://www.google.com"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
this is intentionally not a spreadsheet file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
1,2,3,4,10,,
|
|
2
|
+
5,6,7,8,9,"test",11
|
|
3
|
+
,,,,,,
|
|
4
|
+
10,11,12,13,14,,
|
|
5
|
+
11/21/61,,,,,,
|
|
6
|
+
"tata",,,,,,
|
|
7
|
+
,,,,,,
|
|
8
|
+
,,"thisisc8",,,,
|
|
9
|
+
,,,"thisisd9",,,
|
|
10
|
+
,,,,,,
|
|
11
|
+
"thisisa11",,,,,,
|
|
12
|
+
41,42,43,44,45,,
|
|
13
|
+
,,,,,,
|
|
14
|
+
,,,,,,
|
|
15
|
+
41,42,43,44,45,,
|
|
16
|
+
"einundvierzig","zweiundvierzig","dreiundvierzig","vierundvierzig","fuenfundvierzig",,
|
|
17
|
+
,,,,,,
|
|
18
|
+
05/31/07,"dies hier als Date-Objekt",,,,,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/test/files/ric.ods
ADDED
|
Binary file
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" mc:Ignorable="x14ac">
|
|
2
|
+
<dimension ref="A1:B11"/>
|
|
3
|
+
<sheetViews>
|
|
4
|
+
<sheetView tabSelected="1" workbookViewId="0">
|
|
5
|
+
<selection activeCell="B6" sqref="B6"/>
|
|
6
|
+
</sheetView>
|
|
7
|
+
</sheetViews>
|
|
8
|
+
<sheetFormatPr baseColWidth="10" defaultRowHeight="15" x14ac:dyDescent="0"/>
|
|
9
|
+
<cols>
|
|
10
|
+
<col min="1" max="1" width="69.1640625" customWidth="1"/>
|
|
11
|
+
<col min="2" max="2" width="20.33203125" customWidth="1"/>
|
|
12
|
+
</cols>
|
|
13
|
+
<sheetData>
|
|
14
|
+
<row r="1" spans="1:2">
|
|
15
|
+
<c r="A1" t="s">
|
|
16
|
+
<v>0</v>
|
|
17
|
+
</c>
|
|
18
|
+
<c r="B1" t="s">
|
|
19
|
+
<v>2</v>
|
|
20
|
+
</c>
|
|
21
|
+
</row>
|
|
22
|
+
<row r="2" spans="1:2">
|
|
23
|
+
<c r="A2" t="s">
|
|
24
|
+
|
|
25
|
+
<v>4</v></c>
|
|
26
|
+
<c r="B2" t="s">
|
|
27
|
+
|
|
28
|
+
<v>5</v></c>
|
|
29
|
+
</row>
|
|
30
|
+
<row r="3" spans="1:2">
|
|
31
|
+
<c r="A3" t="s">
|
|
32
|
+
|
|
33
|
+
<v>4</v></c>
|
|
34
|
+
<c r="B3" t="s">
|
|
35
|
+
|
|
36
|
+
<v>6</v></c>
|
|
37
|
+
</row>
|
|
38
|
+
<row r="4" spans="1:2">
|
|
39
|
+
<c r="A4" t="s">
|
|
40
|
+
|
|
41
|
+
<v>7</v></c>
|
|
42
|
+
<c r="B4" t="s">
|
|
43
|
+
|
|
44
|
+
<v>8</v></c>
|
|
45
|
+
</row>
|
|
46
|
+
<row r="5" spans="1:2">
|
|
47
|
+
<c r="A5" t="s">
|
|
48
|
+
|
|
49
|
+
<v>7</v></c>
|
|
50
|
+
<c r="B5" t="s">
|
|
51
|
+
|
|
52
|
+
<v>9</v></c>
|
|
53
|
+
</row>
|
|
54
|
+
<row r="6" spans="1:2">
|
|
55
|
+
<c r="A6" t="s">
|
|
56
|
+
|
|
57
|
+
<v>10</v></c>
|
|
58
|
+
<c r="B6" t="s">
|
|
59
|
+
|
|
60
|
+
<v>11</v></c>
|
|
61
|
+
</row>
|
|
62
|
+
<row r="7" spans="1:2">
|
|
63
|
+
<c r="A7" t="s">
|
|
64
|
+
|
|
65
|
+
<v>10</v></c>
|
|
66
|
+
<c r="B7" t="s">
|
|
67
|
+
|
|
68
|
+
<v>12</v></c>
|
|
69
|
+
</row>
|
|
70
|
+
<row r="8" spans="1:2">
|
|
71
|
+
<c r="A8" t="s">
|
|
72
|
+
|
|
73
|
+
<v>13</v></c>
|
|
74
|
+
<c r="B8" t="s">
|
|
75
|
+
|
|
76
|
+
<v>14</v></c>
|
|
77
|
+
</row>
|
|
78
|
+
<row r="9" spans="1:2">
|
|
79
|
+
<c r="A9" t="s">
|
|
80
|
+
|
|
81
|
+
<v>13</v></c>
|
|
82
|
+
<c r="B9" t="s">
|
|
83
|
+
|
|
84
|
+
<v>15</v></c>
|
|
85
|
+
</row>
|
|
86
|
+
<row r="10" spans="1:2">
|
|
87
|
+
<c r="A10" t="s">
|
|
88
|
+
|
|
89
|
+
<v>16</v></c>
|
|
90
|
+
<c r="B10" t="s">
|
|
91
|
+
|
|
92
|
+
<v>17</v></c>
|
|
93
|
+
</row>
|
|
94
|
+
<row r="11" spans="1:2">
|
|
95
|
+
<c r="A11" t="s">
|
|
96
|
+
|
|
97
|
+
<v>16</v></c>
|
|
98
|
+
<c r="B11" t="s">
|
|
99
|
+
|
|
100
|
+
<v>18</v></c>
|
|
101
|
+
</row>
|
|
102
|
+
</sheetData>
|
|
103
|
+
<pageMargins left="0.75" right="0.75" top="1" bottom="1" header="0.5" footer="0.5"/>
|
|
104
|
+
<extLst>
|
|
105
|
+
<ext xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" uri="{64002731-A6B0-56B0-2670-7721B7C09600}">
|
|
106
|
+
<mx:PLV Mode="0" OnePage="0" WScale="0"/>
|
|
107
|
+
</ext>
|
|
108
|
+
</extLst>
|
|
109
|
+
</worksheet>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
1961-11-21,,
|
|
2
|
+
,,
|
|
3
|
+
1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00
|
|
4
|
+
1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00
|
|
5
|
+
1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00,1961-11-21T12:17:18+00:00
|
|
6
|
+
1961-11-21,1961-11-21,1961-11-21
|
|
7
|
+
1961-11-21,1961-11-21,1961-11-21
|
|
8
|
+
2013-11-05T11:45:00+00:00,2013-11-05T11:45:00+00:00,2013-11-05T11:45:00+00:00
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.dirname(__FILE__) + '/test_helper'
|
|
3
|
+
|
|
4
|
+
class TestBase < Minitest::Test
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@klass = Class.new(Roo::Base) do
|
|
8
|
+
def initialize(filename='some_file')
|
|
9
|
+
super
|
|
10
|
+
@filename = filename
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def read_cells(sheet=nil)
|
|
14
|
+
@cells_read[sheet] = true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def cell(row, col, sheet=nil)
|
|
18
|
+
sheet ||= default_sheet
|
|
19
|
+
@cell[sheet][[row,col]]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def celltype(row, col, sheet=nil)
|
|
23
|
+
sheet ||= default_sheet
|
|
24
|
+
@cell_type[sheet][[row,col]]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def sheets
|
|
28
|
+
['my_sheet','blank sheet']
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
@oo = @klass.new
|
|
32
|
+
setup_test_sheet(@oo)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'private method Roo::Base.uri?(filename)' do
|
|
36
|
+
should "return true when passed a filename starts with http(s)://" do
|
|
37
|
+
assert_equal true, @oo.send(:uri?, 'http://example.com/')
|
|
38
|
+
assert_equal true, @oo.send(:uri?, 'https://example.com/')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
should "return false when passed a filename which does not start with http(s)://" do
|
|
42
|
+
assert_equal false, @oo.send(:uri?, 'example.com')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
should "return false when passed non-String object such as Tempfile" do
|
|
46
|
+
assert_equal false, @oo.send(:uri?, Tempfile.new('test'))
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_setting_invalid_type_does_not_update_cell
|
|
51
|
+
@oo.set(1,1,1)
|
|
52
|
+
assert_raises(ArgumentError){@oo.set(1,1, :invalid_type)}
|
|
53
|
+
assert_equal 1, @oo.cell(1,1)
|
|
54
|
+
assert_equal :float, @oo.celltype(1,1)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_first_row
|
|
58
|
+
assert_equal 5,@oo.first_row
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_last_row
|
|
62
|
+
assert_equal 16,@oo.last_row
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_first_column
|
|
66
|
+
assert_equal 1,@oo.first_column
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_first_column_as_letter
|
|
70
|
+
assert_equal 'A', @oo.first_column_as_letter
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_last_column
|
|
74
|
+
assert_equal 7, @oo.last_column
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_last_column_as_letter
|
|
78
|
+
assert_equal 'G', @oo.last_column_as_letter
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
#TODO: inkonsequente Lieferung Fixnum/Float
|
|
82
|
+
def test_rows
|
|
83
|
+
assert_equal [41.0,42.0,43.0,44.0,45.0, nil, nil], @oo.row(12)
|
|
84
|
+
assert_equal [nil, nil, "dreiundvierzig", "vierundvierzig", "fuenfundvierzig", nil, nil], @oo.row(16)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_empty_eh
|
|
88
|
+
assert @oo.empty?(1,1)
|
|
89
|
+
assert !@oo.empty?(8,3)
|
|
90
|
+
assert @oo.empty?("A",11)
|
|
91
|
+
assert !@oo.empty?("A",12)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_reload
|
|
95
|
+
@oo.reload
|
|
96
|
+
assert @oo.instance_variable_get(:@cell).empty?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_to_yaml
|
|
100
|
+
assert_equal "--- \n"+yaml_entry(5,1,"date","1961-11-21"), @oo.to_yaml({}, 5,1,5,1)
|
|
101
|
+
assert_equal "--- \n"+yaml_entry(8,3,"string","thisisc8"), @oo.to_yaml({}, 8,3,8,3)
|
|
102
|
+
assert_equal "--- \n"+yaml_entry(12,3,"float",43.0), @oo.to_yaml({}, 12,3,12,3)
|
|
103
|
+
assert_equal \
|
|
104
|
+
"--- \n"+yaml_entry(12,3,"float",43.0) +
|
|
105
|
+
yaml_entry(12,4,"float",44.0) +
|
|
106
|
+
yaml_entry(12,5,"float",45.0), @oo.to_yaml({}, 12,3,12)
|
|
107
|
+
assert_equal \
|
|
108
|
+
"--- \n"+yaml_entry(12,3,"float",43.0)+
|
|
109
|
+
yaml_entry(12,4,"float",44.0)+
|
|
110
|
+
yaml_entry(12,5,"float",45.0)+
|
|
111
|
+
yaml_entry(15,3,"float",43.0)+
|
|
112
|
+
yaml_entry(15,4,"float",44.0)+
|
|
113
|
+
yaml_entry(15,5,"float",45.0)+
|
|
114
|
+
yaml_entry(16,3,"string","dreiundvierzig")+
|
|
115
|
+
yaml_entry(16,4,"string","vierundvierzig")+
|
|
116
|
+
yaml_entry(16,5,"string","fuenfundvierzig"), @oo.to_yaml({}, 12,3)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_to_csv
|
|
120
|
+
assert_equal expected_csv,@oo.to_csv
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_to_csv_with_separator
|
|
124
|
+
assert_equal expected_csv_with_semicolons,@oo.to_csv(nil, ';')
|
|
125
|
+
end
|
|
126
|
+
protected
|
|
127
|
+
def setup_test_sheet(workbook=nil)
|
|
128
|
+
workbook ||= @oo
|
|
129
|
+
set_sheet_values(workbook)
|
|
130
|
+
set_sheet_types(workbook)
|
|
131
|
+
set_cells_read(workbook)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def set_sheet_values(workbook)
|
|
135
|
+
workbook.instance_variable_get(:@cell)[workbook.default_sheet] = {
|
|
136
|
+
[5,1] => Date.civil(1961,11,21).to_s,
|
|
137
|
+
|
|
138
|
+
[8,3] => "thisisc8",
|
|
139
|
+
[8,7] => "thisisg8",
|
|
140
|
+
|
|
141
|
+
[12,1] => 41.0,
|
|
142
|
+
[12,2] => 42.0,
|
|
143
|
+
[12,3] => 43.0,
|
|
144
|
+
[12,4] => 44.0,
|
|
145
|
+
[12,5] => 45.0,
|
|
146
|
+
|
|
147
|
+
[15,3] => 43.0,
|
|
148
|
+
[15,4] => 44.0,
|
|
149
|
+
[15,5] => 45.0,
|
|
150
|
+
|
|
151
|
+
[16,3] => "dreiundvierzig",
|
|
152
|
+
[16,4] => "vierundvierzig",
|
|
153
|
+
[16,5] => "fuenfundvierzig"
|
|
154
|
+
}
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def set_sheet_types(workbook)
|
|
158
|
+
workbook.instance_variable_get(:@cell_type)[workbook.default_sheet] = {
|
|
159
|
+
[5,1] => :date,
|
|
160
|
+
|
|
161
|
+
[8,3] => :string,
|
|
162
|
+
[8,7] => :string,
|
|
163
|
+
|
|
164
|
+
[12,1] => :float,
|
|
165
|
+
[12,2] => :float,
|
|
166
|
+
[12,3] => :float,
|
|
167
|
+
[12,4] => :float,
|
|
168
|
+
[12,5] => :float,
|
|
169
|
+
|
|
170
|
+
[15,3] => :float,
|
|
171
|
+
[15,4] => :float,
|
|
172
|
+
[15,5] => :float,
|
|
173
|
+
|
|
174
|
+
[16,3] => :string,
|
|
175
|
+
[16,4] => :string,
|
|
176
|
+
[16,5] => :string,
|
|
177
|
+
}
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def set_first_row(workbook)
|
|
181
|
+
row_hash = workbook.instance_variable_get(:@first_row)
|
|
182
|
+
row_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[0]}.min
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def set_last_row(workbook)
|
|
186
|
+
row_hash = workbook.instance_variable_get(:@last_row)
|
|
187
|
+
row_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[0]}.max
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def set_first_col(workbook)
|
|
191
|
+
col_hash = workbook.instance_variable_get(:@first_column)
|
|
192
|
+
col_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[1]}.min
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def set_last_col(workbook)
|
|
196
|
+
col_hash = workbook.instance_variable_get(:@last_column)
|
|
197
|
+
col_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[1]}.max
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def set_cells_read(workbook)
|
|
201
|
+
read_hash = workbook.instance_variable_get(:@cells_read)
|
|
202
|
+
read_hash[workbook.default_sheet] = true
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def expected_csv
|
|
206
|
+
",,,,,,\n,,,,,,\n,,,,,,\n,,,,,,\n1961-11-21,,,,,,\n,,,,,,\n,,,,,,\n,,\"thisisc8\",,,,\"thisisg8\"\n,,,,,,\n,,,,,,\n,,,,,,\n41,42,43,44,45,,\n,,,,,,\n,,,,,,\n,,43,44,45,,\n,,\"dreiundvierzig\",\"vierundvierzig\",\"fuenfundvierzig\",,\n"
|
|
207
|
+
end
|
|
208
|
+
def expected_csv_with_semicolons
|
|
209
|
+
expected_csv.gsub /\,/, ';'
|
|
210
|
+
end
|
|
211
|
+
end
|