roo 1.13.1 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +17 -0
- data/.github/issue_template.md +16 -0
- data/.github/pull_request_template.md +14 -0
- data/.github/workflows/pull-request.yml +15 -0
- data/.github/workflows/ruby.yml +34 -0
- data/.gitignore +11 -0
- data/.rubocop.yml +186 -0
- data/.simplecov +4 -0
- data/CHANGELOG.md +702 -0
- data/Gemfile +18 -12
- data/Guardfile +23 -0
- data/LICENSE +5 -1
- data/README.md +328 -0
- data/Rakefile +23 -23
- data/examples/roo_soap_client.rb +28 -31
- data/examples/roo_soap_server.rb +4 -6
- data/examples/write_me.rb +9 -10
- data/lib/roo/base.rb +317 -504
- data/lib/roo/constants.rb +7 -0
- data/lib/roo/csv.rb +141 -113
- data/lib/roo/errors.rb +11 -0
- data/lib/roo/excelx/cell/base.rb +108 -0
- data/lib/roo/excelx/cell/boolean.rb +30 -0
- data/lib/roo/excelx/cell/date.rb +28 -0
- data/lib/roo/excelx/cell/datetime.rb +107 -0
- data/lib/roo/excelx/cell/empty.rb +20 -0
- data/lib/roo/excelx/cell/number.rb +99 -0
- data/lib/roo/excelx/cell/string.rb +19 -0
- data/lib/roo/excelx/cell/time.rb +44 -0
- data/lib/roo/excelx/cell.rb +110 -0
- data/lib/roo/excelx/comments.rb +55 -0
- data/lib/roo/excelx/coordinate.rb +19 -0
- data/lib/roo/excelx/extractor.rb +39 -0
- data/lib/roo/excelx/format.rb +71 -0
- data/lib/roo/excelx/images.rb +26 -0
- data/lib/roo/excelx/relationships.rb +33 -0
- data/lib/roo/excelx/shared.rb +39 -0
- data/lib/roo/excelx/shared_strings.rb +151 -0
- data/lib/roo/excelx/sheet.rb +151 -0
- data/lib/roo/excelx/sheet_doc.rb +257 -0
- data/lib/roo/excelx/styles.rb +64 -0
- data/lib/roo/excelx/workbook.rb +64 -0
- data/lib/roo/excelx.rb +407 -601
- data/lib/roo/font.rb +17 -0
- data/lib/roo/formatters/base.rb +15 -0
- data/lib/roo/formatters/csv.rb +84 -0
- data/lib/roo/formatters/matrix.rb +23 -0
- data/lib/roo/formatters/xml.rb +31 -0
- data/lib/roo/formatters/yaml.rb +40 -0
- data/lib/roo/helpers/default_attr_reader.rb +20 -0
- data/lib/roo/helpers/weak_instance_cache.rb +41 -0
- data/lib/roo/libre_office.rb +4 -0
- data/lib/roo/link.rb +34 -0
- data/lib/roo/open_office.rb +631 -0
- data/lib/roo/spreadsheet.rb +28 -23
- data/lib/roo/tempdir.rb +24 -0
- data/lib/roo/utils.rb +128 -0
- data/lib/roo/version.rb +3 -0
- data/lib/roo.rb +26 -24
- data/roo.gemspec +29 -202
- data/spec/helpers.rb +5 -0
- data/spec/lib/roo/base_spec.rb +291 -3
- data/spec/lib/roo/csv_spec.rb +38 -11
- data/spec/lib/roo/excelx/cell/time_spec.rb +15 -0
- data/spec/lib/roo/excelx/format_spec.rb +7 -6
- data/spec/lib/roo/excelx/relationships_spec.rb +43 -0
- data/spec/lib/roo/excelx/sheet_doc_spec.rb +11 -0
- data/spec/lib/roo/excelx_spec.rb +682 -6
- data/spec/lib/roo/libreoffice_spec.rb +16 -6
- data/spec/lib/roo/openoffice_spec.rb +30 -8
- data/spec/lib/roo/spreadsheet_spec.rb +60 -12
- data/spec/lib/roo/strict_spec.rb +43 -0
- data/spec/lib/roo/utils_spec.rb +119 -0
- data/spec/lib/roo/weak_instance_cache_spec.rb +92 -0
- data/spec/lib/roo_spec.rb +0 -0
- data/spec/spec_helper.rb +7 -6
- data/test/all_ss.rb +12 -11
- data/test/excelx/cell/test_attr_reader_default.rb +72 -0
- data/test/excelx/cell/test_base.rb +68 -0
- data/test/excelx/cell/test_boolean.rb +36 -0
- data/test/excelx/cell/test_date.rb +38 -0
- data/test/excelx/cell/test_datetime.rb +45 -0
- data/test/excelx/cell/test_empty.rb +18 -0
- data/test/excelx/cell/test_number.rb +90 -0
- data/test/excelx/cell/test_string.rb +48 -0
- data/test/excelx/cell/test_time.rb +30 -0
- data/test/excelx/test_coordinate.rb +51 -0
- data/test/formatters/test_csv.rb +136 -0
- data/test/formatters/test_matrix.rb +76 -0
- data/test/formatters/test_xml.rb +78 -0
- data/test/formatters/test_yaml.rb +20 -0
- data/test/helpers/test_accessing_files.rb +81 -0
- data/test/helpers/test_comments.rb +43 -0
- data/test/helpers/test_formulas.rb +9 -0
- data/test/helpers/test_labels.rb +103 -0
- data/test/helpers/test_sheets.rb +55 -0
- data/test/helpers/test_styles.rb +62 -0
- data/test/roo/test_base.rb +182 -0
- data/test/roo/test_csv.rb +88 -0
- data/test/roo/test_excelx.rb +360 -0
- data/test/roo/test_libre_office.rb +9 -0
- data/test/roo/test_open_office.rb +289 -0
- data/test/test_helper.rb +123 -59
- data/test/test_roo.rb +392 -2292
- metadata +153 -296
- data/CHANGELOG +0 -412
- data/Gemfile.lock +0 -78
- data/README.markdown +0 -126
- data/VERSION +0 -1
- data/lib/roo/excel.rb +0 -355
- data/lib/roo/excel2003xml.rb +0 -300
- data/lib/roo/google.rb +0 -292
- data/lib/roo/openoffice.rb +0 -496
- data/lib/roo/roo_rails_helper.rb +0 -83
- data/lib/roo/worksheet.rb +0 -18
- data/scripts/txt2html +0 -67
- data/spec/lib/roo/excel2003xml_spec.rb +0 -15
- data/spec/lib/roo/excel_spec.rb +0 -17
- data/spec/lib/roo/google_spec.rb +0 -64
- data/test/files/1900_base.xls +0 -0
- data/test/files/1900_base.xlsx +0 -0
- data/test/files/1904_base.xls +0 -0
- data/test/files/1904_base.xlsx +0 -0
- data/test/files/Bibelbund.csv +0 -3741
- data/test/files/Bibelbund.ods +0 -0
- data/test/files/Bibelbund.xls +0 -0
- data/test/files/Bibelbund.xlsx +0 -0
- data/test/files/Bibelbund.xml +0 -62518
- data/test/files/Bibelbund1.ods +0 -0
- data/test/files/Pfand_from_windows_phone.xlsx +0 -0
- data/test/files/bad_excel_date.xls +0 -0
- data/test/files/bbu.ods +0 -0
- data/test/files/bbu.xls +0 -0
- data/test/files/bbu.xlsx +0 -0
- data/test/files/bbu.xml +0 -152
- data/test/files/bode-v1.ods.zip +0 -0
- data/test/files/bode-v1.xls.zip +0 -0
- data/test/files/boolean.csv +0 -2
- data/test/files/boolean.ods +0 -0
- data/test/files/boolean.xls +0 -0
- data/test/files/boolean.xlsx +0 -0
- data/test/files/boolean.xml +0 -112
- data/test/files/borders.ods +0 -0
- data/test/files/borders.xls +0 -0
- data/test/files/borders.xlsx +0 -0
- data/test/files/borders.xml +0 -144
- data/test/files/bug-numbered-sheet-names.xlsx +0 -0
- data/test/files/bug-row-column-fixnum-float.xls +0 -0
- data/test/files/bug-row-column-fixnum-float.xml +0 -127
- data/test/files/comments.ods +0 -0
- data/test/files/comments.xls +0 -0
- data/test/files/comments.xlsx +0 -0
- data/test/files/csvtypes.csv +0 -1
- data/test/files/datetime.ods +0 -0
- data/test/files/datetime.xls +0 -0
- data/test/files/datetime.xlsx +0 -0
- data/test/files/datetime.xml +0 -142
- data/test/files/datetime_floatconv.xls +0 -0
- data/test/files/datetime_floatconv.xml +0 -148
- data/test/files/dreimalvier.ods +0 -0
- data/test/files/emptysheets.ods +0 -0
- data/test/files/emptysheets.xls +0 -0
- data/test/files/emptysheets.xlsx +0 -0
- data/test/files/emptysheets.xml +0 -105
- data/test/files/excel2003.xml +0 -21140
- data/test/files/false_encoding.xls +0 -0
- data/test/files/false_encoding.xml +0 -132
- data/test/files/file_item_error.xlsx +0 -0
- data/test/files/formula.ods +0 -0
- data/test/files/formula.xls +0 -0
- data/test/files/formula.xlsx +0 -0
- data/test/files/formula.xml +0 -134
- data/test/files/formula_parse_error.xls +0 -0
- data/test/files/formula_parse_error.xml +0 -1833
- data/test/files/formula_string_error.xlsx +0 -0
- data/test/files/html-escape.ods +0 -0
- data/test/files/link.xls +0 -0
- data/test/files/link.xlsx +0 -0
- data/test/files/matrix.ods +0 -0
- data/test/files/matrix.xls +0 -0
- data/test/files/named_cells.ods +0 -0
- data/test/files/named_cells.xls +0 -0
- data/test/files/named_cells.xlsx +0 -0
- data/test/files/no_spreadsheet_file.txt +0 -1
- data/test/files/numbers1.csv +0 -18
- data/test/files/numbers1.ods +0 -0
- data/test/files/numbers1.xls +0 -0
- data/test/files/numbers1.xlsx +0 -0
- data/test/files/numbers1.xml +0 -312
- data/test/files/only_one_sheet.ods +0 -0
- data/test/files/only_one_sheet.xls +0 -0
- data/test/files/only_one_sheet.xlsx +0 -0
- data/test/files/only_one_sheet.xml +0 -67
- data/test/files/paragraph.ods +0 -0
- data/test/files/paragraph.xls +0 -0
- data/test/files/paragraph.xlsx +0 -0
- data/test/files/paragraph.xml +0 -127
- data/test/files/prova.xls +0 -0
- data/test/files/ric.ods +0 -0
- data/test/files/simple_spreadsheet.ods +0 -0
- data/test/files/simple_spreadsheet.xls +0 -0
- data/test/files/simple_spreadsheet.xlsx +0 -0
- data/test/files/simple_spreadsheet.xml +0 -225
- data/test/files/simple_spreadsheet_from_italo.ods +0 -0
- data/test/files/simple_spreadsheet_from_italo.xls +0 -0
- data/test/files/simple_spreadsheet_from_italo.xml +0 -242
- data/test/files/so_datetime.csv +0 -7
- data/test/files/style.ods +0 -0
- data/test/files/style.xls +0 -0
- data/test/files/style.xlsx +0 -0
- data/test/files/style.xml +0 -154
- data/test/files/time-test.csv +0 -2
- data/test/files/time-test.ods +0 -0
- data/test/files/time-test.xls +0 -0
- data/test/files/time-test.xlsx +0 -0
- data/test/files/time-test.xml +0 -131
- 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_excelx.xls +0 -0
- data/test/files/type_openoffice.xls +0 -0
- data/test/files/type_openoffice.xlsx +0 -0
- data/test/files/whitespace.ods +0 -0
- data/test/files/whitespace.xls +0 -0
- data/test/files/whitespace.xlsx +0 -0
- data/test/files/whitespace.xml +0 -184
- data/test/rm_sub_test.rb +0 -12
- data/test/rm_test.rb +0 -7
- data/test/test_generic_spreadsheet.rb +0 -259
- data/website/index.html +0 -385
- data/website/index.txt +0 -423
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -130
- data/website/template.rhtml +0 -48
data/test/files/time-test.xml
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<?mso-application progid="Excel.Sheet"?>
|
3
|
-
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
4
|
-
xmlns:o="urn:schemas-microsoft-com:office:office"
|
5
|
-
xmlns:x="urn:schemas-microsoft-com:office:excel"
|
6
|
-
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
7
|
-
xmlns:html="http://www.w3.org/TR/REC-html40">
|
8
|
-
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
|
9
|
-
<LastAuthor>Licensed User</LastAuthor>
|
10
|
-
<Created>2009-12-22T17:41:04Z</Created>
|
11
|
-
<Version>12.00</Version>
|
12
|
-
</DocumentProperties>
|
13
|
-
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
|
14
|
-
<WindowHeight>8190</WindowHeight>
|
15
|
-
<WindowWidth>16380</WindowWidth>
|
16
|
-
<WindowTopX>0</WindowTopX>
|
17
|
-
<WindowTopY>0</WindowTopY>
|
18
|
-
<TabRatio>344</TabRatio>
|
19
|
-
<ProtectStructure>False</ProtectStructure>
|
20
|
-
<ProtectWindows>False</ProtectWindows>
|
21
|
-
</ExcelWorkbook>
|
22
|
-
<Styles>
|
23
|
-
<Style ss:ID="Default" ss:Name="Normal">
|
24
|
-
<Alignment ss:Vertical="Bottom"/>
|
25
|
-
<Borders/>
|
26
|
-
<Font ss:FontName="Arial" x:Family="Swiss"/>
|
27
|
-
<Interior/>
|
28
|
-
<NumberFormat/>
|
29
|
-
<Protection/>
|
30
|
-
</Style>
|
31
|
-
<Style ss:ID="s21">
|
32
|
-
<NumberFormat ss:Format="hh:mm:ss"/>
|
33
|
-
</Style>
|
34
|
-
<Style ss:ID="s22">
|
35
|
-
<NumberFormat ss:Format="dd/mm/yy"/>
|
36
|
-
</Style>
|
37
|
-
<Style ss:ID="s23">
|
38
|
-
<NumberFormat ss:Format="Fixed"/>
|
39
|
-
</Style>
|
40
|
-
</Styles>
|
41
|
-
<Worksheet ss:Name="Tabelle1">
|
42
|
-
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="6" x:FullColumns="1"
|
43
|
-
x:FullRows="1" ss:DefaultColumnWidth="60.75">
|
44
|
-
<Row>
|
45
|
-
<Cell><Data ss:Type="String">Mittags:</Data></Cell>
|
46
|
-
<Cell ss:StyleID="s21"><Data ss:Type="DateTime">1899-12-31T12:13:14.000</Data></Cell>
|
47
|
-
<Cell ss:StyleID="s21"><Data ss:Type="DateTime">1899-12-31T15:16:00.000</Data></Cell>
|
48
|
-
<Cell ss:StyleID="s21"><Data ss:Type="DateTime">1899-12-31T23:00:00.000</Data></Cell>
|
49
|
-
</Row>
|
50
|
-
<Row>
|
51
|
-
<Cell ss:StyleID="s22"><Data ss:Type="DateTime">2007-11-21T00:00:00.000</Data></Cell>
|
52
|
-
</Row>
|
53
|
-
<Row ss:Index="6">
|
54
|
-
<Cell ss:Index="2" ss:StyleID="s23"/>
|
55
|
-
</Row>
|
56
|
-
</Table>
|
57
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
58
|
-
<PageSetup>
|
59
|
-
<Layout x:StartPageNumber="1"/>
|
60
|
-
<Header x:Margin="0.78749999999999998"
|
61
|
-
x:Data="&C&"Times New Roman,Standard"&12&A"/>
|
62
|
-
<Footer x:Margin="0.78749999999999998"
|
63
|
-
x:Data="&C&"Times New Roman,Standard"&12Seite &P"/>
|
64
|
-
<PageMargins x:Bottom="1.0527777777777778" x:Left="0.78749999999999998"
|
65
|
-
x:Right="0.78749999999999998" x:Top="1.0527777777777778"/>
|
66
|
-
</PageSetup>
|
67
|
-
<Print>
|
68
|
-
<ValidPrinterInfo/>
|
69
|
-
<PaperSizeIndex>9</PaperSizeIndex>
|
70
|
-
<HorizontalResolution>300</HorizontalResolution>
|
71
|
-
<VerticalResolution>300</VerticalResolution>
|
72
|
-
</Print>
|
73
|
-
<Selected/>
|
74
|
-
<Panes>
|
75
|
-
<Pane>
|
76
|
-
<Number>3</Number>
|
77
|
-
<ActiveRow>5</ActiveRow>
|
78
|
-
<ActiveCol>1</ActiveCol>
|
79
|
-
</Pane>
|
80
|
-
</Panes>
|
81
|
-
<ProtectObjects>False</ProtectObjects>
|
82
|
-
<ProtectScenarios>False</ProtectScenarios>
|
83
|
-
</WorksheetOptions>
|
84
|
-
</Worksheet>
|
85
|
-
<Worksheet ss:Name="Tabelle2">
|
86
|
-
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
|
87
|
-
x:FullRows="1" ss:DefaultColumnWidth="60.75">
|
88
|
-
</Table>
|
89
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
90
|
-
<PageSetup>
|
91
|
-
<Header x:Margin="0.78749999999999998"
|
92
|
-
x:Data="&C&"Times New Roman,Standard"&12&A"/>
|
93
|
-
<Footer x:Margin="0.78749999999999998"
|
94
|
-
x:Data="&C&"Times New Roman,Standard"&12Seite &P"/>
|
95
|
-
<PageMargins x:Bottom="1.0527777777777778" x:Left="0.78749999999999998"
|
96
|
-
x:Right="0.78749999999999998" x:Top="1.0527777777777778"/>
|
97
|
-
</PageSetup>
|
98
|
-
<Print>
|
99
|
-
<ValidPrinterInfo/>
|
100
|
-
<PaperSizeIndex>9</PaperSizeIndex>
|
101
|
-
<HorizontalResolution>300</HorizontalResolution>
|
102
|
-
<VerticalResolution>300</VerticalResolution>
|
103
|
-
</Print>
|
104
|
-
<ProtectObjects>False</ProtectObjects>
|
105
|
-
<ProtectScenarios>False</ProtectScenarios>
|
106
|
-
</WorksheetOptions>
|
107
|
-
</Worksheet>
|
108
|
-
<Worksheet ss:Name="Tabelle3">
|
109
|
-
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
|
110
|
-
x:FullRows="1" ss:DefaultColumnWidth="60.75">
|
111
|
-
</Table>
|
112
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
113
|
-
<PageSetup>
|
114
|
-
<Header x:Margin="0.78749999999999998"
|
115
|
-
x:Data="&C&"Times New Roman,Standard"&12&A"/>
|
116
|
-
<Footer x:Margin="0.78749999999999998"
|
117
|
-
x:Data="&C&"Times New Roman,Standard"&12Seite &P"/>
|
118
|
-
<PageMargins x:Bottom="1.0527777777777778" x:Left="0.78749999999999998"
|
119
|
-
x:Right="0.78749999999999998" x:Top="1.0527777777777778"/>
|
120
|
-
</PageSetup>
|
121
|
-
<Print>
|
122
|
-
<ValidPrinterInfo/>
|
123
|
-
<PaperSizeIndex>9</PaperSizeIndex>
|
124
|
-
<HorizontalResolution>300</HorizontalResolution>
|
125
|
-
<VerticalResolution>300</VerticalResolution>
|
126
|
-
</Print>
|
127
|
-
<ProtectObjects>False</ProtectObjects>
|
128
|
-
<ProtectScenarios>False</ProtectScenarios>
|
129
|
-
</WorksheetOptions>
|
130
|
-
</Worksheet>
|
131
|
-
</Workbook>
|
data/test/files/type_excel.ods
DELETED
Binary file
|
data/test/files/type_excel.xlsx
DELETED
Binary file
|
data/test/files/type_excelx.ods
DELETED
Binary file
|
data/test/files/type_excelx.xls
DELETED
Binary file
|
Binary file
|
Binary file
|
data/test/files/whitespace.ods
DELETED
Binary file
|
data/test/files/whitespace.xls
DELETED
Binary file
|
data/test/files/whitespace.xlsx
DELETED
Binary file
|
data/test/files/whitespace.xml
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<?mso-application progid="Excel.Sheet"?>
|
3
|
-
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
4
|
-
xmlns:o="urn:schemas-microsoft-com:office:office"
|
5
|
-
xmlns:x="urn:schemas-microsoft-com:office:excel"
|
6
|
-
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
7
|
-
xmlns:html="http://www.w3.org/TR/REC-html40">
|
8
|
-
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
|
9
|
-
<LastAuthor>Licensed User</LastAuthor>
|
10
|
-
<Created>2009-12-22T17:41:27Z</Created>
|
11
|
-
<Version>12.00</Version>
|
12
|
-
</DocumentProperties>
|
13
|
-
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
|
14
|
-
<WindowHeight>8190</WindowHeight>
|
15
|
-
<WindowWidth>16380</WindowWidth>
|
16
|
-
<WindowTopX>0</WindowTopX>
|
17
|
-
<WindowTopY>0</WindowTopY>
|
18
|
-
<ProtectStructure>False</ProtectStructure>
|
19
|
-
<ProtectWindows>False</ProtectWindows>
|
20
|
-
</ExcelWorkbook>
|
21
|
-
<Styles>
|
22
|
-
<Style ss:ID="Default" ss:Name="Normal">
|
23
|
-
<Alignment ss:Vertical="Bottom"/>
|
24
|
-
<Borders/>
|
25
|
-
<Font ss:FontName="Arial" x:Family="Swiss"/>
|
26
|
-
<Interior/>
|
27
|
-
<NumberFormat/>
|
28
|
-
<Protection/>
|
29
|
-
</Style>
|
30
|
-
<Style ss:ID="s21">
|
31
|
-
<Font ss:FontName="Arial" x:Family="Swiss" ss:Bold="1" ss:Underline="Single"/>
|
32
|
-
<NumberFormat ss:Format="yyyy\-mm\-dd"/>
|
33
|
-
</Style>
|
34
|
-
<Style ss:ID="s22">
|
35
|
-
<Font ss:FontName="Arial" x:Family="Swiss" ss:Bold="1" ss:Underline="Single"/>
|
36
|
-
<NumberFormat ss:Format="Standard"/>
|
37
|
-
</Style>
|
38
|
-
<Style ss:ID="s23">
|
39
|
-
<Font ss:FontName="Arial" x:Family="Swiss" ss:Bold="1" ss:Underline="Single"/>
|
40
|
-
</Style>
|
41
|
-
<Style ss:ID="s24">
|
42
|
-
<NumberFormat ss:Format="yyyy\-mm\-dd"/>
|
43
|
-
</Style>
|
44
|
-
<Style ss:ID="s25">
|
45
|
-
<NumberFormat ss:Format="Standard"/>
|
46
|
-
</Style>
|
47
|
-
</Styles>
|
48
|
-
<Worksheet ss:Name="Sheet1">
|
49
|
-
<Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="6" x:FullColumns="1"
|
50
|
-
x:FullRows="1">
|
51
|
-
<Column ss:AutoFitWidth="0" ss:Width="53.25"/>
|
52
|
-
<Row>
|
53
|
-
<Cell ss:StyleID="s21"/>
|
54
|
-
<Cell ss:StyleID="s22"/>
|
55
|
-
<Cell ss:StyleID="s22"/>
|
56
|
-
<Cell ss:StyleID="s23"/>
|
57
|
-
<Cell ss:StyleID="s23"/>
|
58
|
-
<Cell ss:StyleID="s23"/>
|
59
|
-
</Row>
|
60
|
-
<Row>
|
61
|
-
<Cell ss:StyleID="s21"/>
|
62
|
-
<Cell ss:StyleID="s22"/>
|
63
|
-
<Cell ss:StyleID="s22"/>
|
64
|
-
<Cell ss:StyleID="s23"/>
|
65
|
-
<Cell ss:StyleID="s23"/>
|
66
|
-
<Cell ss:StyleID="s23"/>
|
67
|
-
</Row>
|
68
|
-
<Row>
|
69
|
-
<Cell ss:StyleID="s21"><Data ss:Type="String">Date</Data></Cell>
|
70
|
-
<Cell ss:StyleID="s22"><Data ss:Type="String">Start time</Data></Cell>
|
71
|
-
<Cell ss:StyleID="s22"><Data ss:Type="String">End time</Data></Cell>
|
72
|
-
<Cell ss:StyleID="s23"><Data ss:Type="String">Pause</Data></Cell>
|
73
|
-
<Cell ss:StyleID="s23"><Data ss:Type="String">Sum</Data></Cell>
|
74
|
-
<Cell ss:StyleID="s23"><Data ss:Type="String">Comment</Data></Cell>
|
75
|
-
</Row>
|
76
|
-
<Row>
|
77
|
-
<Cell ss:StyleID="s24"><Data ss:Type="DateTime">2007-05-07T00:00:00.000</Data></Cell>
|
78
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">9.25</Data></Cell>
|
79
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">10.25</Data></Cell>
|
80
|
-
<Cell><Data ss:Type="Number">0</Data></Cell>
|
81
|
-
<Cell ss:Formula="=RC[-2]-RC[-3]-RC[-1]"><Data ss:Type="Number">1</Data></Cell>
|
82
|
-
<Cell><Data ss:Type="String">Task 1</Data></Cell>
|
83
|
-
</Row>
|
84
|
-
<Row>
|
85
|
-
<Cell ss:StyleID="s24"/>
|
86
|
-
<Cell ss:StyleID="s25"/>
|
87
|
-
<Cell ss:StyleID="s25"/>
|
88
|
-
</Row>
|
89
|
-
<Row>
|
90
|
-
<Cell ss:StyleID="s24"><Data ss:Type="DateTime">2007-05-07T00:00:00.000</Data></Cell>
|
91
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">10.75</Data></Cell>
|
92
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">10.75</Data></Cell>
|
93
|
-
<Cell><Data ss:Type="Number">0</Data></Cell>
|
94
|
-
<Cell ss:Formula="=RC[-2]-RC[-3]-RC[-1]"><Data ss:Type="Number">0</Data></Cell>
|
95
|
-
<Cell><Data ss:Type="String">Task 1</Data></Cell>
|
96
|
-
</Row>
|
97
|
-
</Table>
|
98
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
99
|
-
<PageSetup>
|
100
|
-
<Header x:Margin="0.51180555555555551"/>
|
101
|
-
<Footer x:Margin="0.51180555555555551"/>
|
102
|
-
<PageMargins x:Bottom="0.98402777777777772" x:Left="0.74791666666666667"
|
103
|
-
x:Right="0.74791666666666667" x:Top="0.98402777777777772"/>
|
104
|
-
</PageSetup>
|
105
|
-
<Print>
|
106
|
-
<ValidPrinterInfo/>
|
107
|
-
<HorizontalResolution>300</HorizontalResolution>
|
108
|
-
<VerticalResolution>300</VerticalResolution>
|
109
|
-
</Print>
|
110
|
-
<Selected/>
|
111
|
-
<Panes>
|
112
|
-
<Pane>
|
113
|
-
<Number>3</Number>
|
114
|
-
<ActiveRow>6</ActiveRow>
|
115
|
-
</Pane>
|
116
|
-
</Panes>
|
117
|
-
<ProtectObjects>False</ProtectObjects>
|
118
|
-
<ProtectScenarios>False</ProtectScenarios>
|
119
|
-
</WorksheetOptions>
|
120
|
-
</Worksheet>
|
121
|
-
<Worksheet ss:Name="Sheet2">
|
122
|
-
<Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="3" x:FullColumns="1"
|
123
|
-
x:FullRows="1">
|
124
|
-
<Column ss:Index="3" ss:AutoFitWidth="0" ss:Width="53.25"/>
|
125
|
-
<Row>
|
126
|
-
<Cell ss:Index="3" ss:StyleID="s21"><Data ss:Type="String">Date</Data></Cell>
|
127
|
-
<Cell ss:StyleID="s21"/>
|
128
|
-
<Cell ss:StyleID="s22"><Data ss:Type="String">Start time</Data></Cell>
|
129
|
-
</Row>
|
130
|
-
<Row>
|
131
|
-
<Cell ss:Index="3" ss:StyleID="s24"><Data ss:Type="DateTime">2007-05-07T00:00:00.000</Data></Cell>
|
132
|
-
<Cell ss:StyleID="s24"/>
|
133
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">9.25</Data></Cell>
|
134
|
-
</Row>
|
135
|
-
<Row>
|
136
|
-
<Cell ss:Index="3" ss:StyleID="s24"><Data ss:Type="DateTime">2007-05-07T00:00:00.000</Data></Cell>
|
137
|
-
<Cell ss:StyleID="s24"/>
|
138
|
-
<Cell ss:StyleID="s25"><Data ss:Type="Number">10.75</Data></Cell>
|
139
|
-
</Row>
|
140
|
-
</Table>
|
141
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
142
|
-
<PageSetup>
|
143
|
-
<Header x:Margin="0.51180555555555551"/>
|
144
|
-
<Footer x:Margin="0.51180555555555551"/>
|
145
|
-
<PageMargins x:Bottom="0.98402777777777772" x:Left="0.74791666666666667"
|
146
|
-
x:Right="0.74791666666666667" x:Top="0.98402777777777772"/>
|
147
|
-
</PageSetup>
|
148
|
-
<Print>
|
149
|
-
<ValidPrinterInfo/>
|
150
|
-
<HorizontalResolution>300</HorizontalResolution>
|
151
|
-
<VerticalResolution>300</VerticalResolution>
|
152
|
-
</Print>
|
153
|
-
<Panes>
|
154
|
-
<Pane>
|
155
|
-
<Number>3</Number>
|
156
|
-
<ActiveRow>10</ActiveRow>
|
157
|
-
<ActiveCol>2</ActiveCol>
|
158
|
-
</Pane>
|
159
|
-
</Panes>
|
160
|
-
<ProtectObjects>False</ProtectObjects>
|
161
|
-
<ProtectScenarios>False</ProtectScenarios>
|
162
|
-
</WorksheetOptions>
|
163
|
-
</Worksheet>
|
164
|
-
<Worksheet ss:Name="Sheet3">
|
165
|
-
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
|
166
|
-
x:FullRows="1">
|
167
|
-
</Table>
|
168
|
-
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
169
|
-
<PageSetup>
|
170
|
-
<Header x:Margin="0.51180555555555551"/>
|
171
|
-
<Footer x:Margin="0.51180555555555551"/>
|
172
|
-
<PageMargins x:Bottom="0.98402777777777772" x:Left="0.74791666666666667"
|
173
|
-
x:Right="0.74791666666666667" x:Top="0.98402777777777772"/>
|
174
|
-
</PageSetup>
|
175
|
-
<Print>
|
176
|
-
<ValidPrinterInfo/>
|
177
|
-
<HorizontalResolution>300</HorizontalResolution>
|
178
|
-
<VerticalResolution>300</VerticalResolution>
|
179
|
-
</Print>
|
180
|
-
<ProtectObjects>False</ProtectObjects>
|
181
|
-
<ProtectScenarios>False</ProtectScenarios>
|
182
|
-
</WorksheetOptions>
|
183
|
-
</Worksheet>
|
184
|
-
</Workbook>
|
data/test/rm_sub_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Loeschen von Dateien, wenn mit Excel geoeffnet
|
2
|
-
require 'roo'
|
3
|
-
|
4
|
-
oo = Excel.new("tmp.xls")
|
5
|
-
#oo = OpenOffice.new("tmp.ods")
|
6
|
-
oo.default_sheet = oo.sheets.first
|
7
|
-
oo.first_row.upto(oo.last_row) do |row|
|
8
|
-
oo.first_column.upto(oo.last_column) do |col|
|
9
|
-
p oo.cell(row,col)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
data/test/rm_test.rb
DELETED
@@ -1,259 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.dirname(__FILE__) + '/test_helper'
|
3
|
-
|
4
|
-
class TestBase < Test::Unit::TestCase
|
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 'Roo::Base.letter_to_number(letter)' do
|
36
|
-
should "give us 1 for 'A' and 'a'" do
|
37
|
-
assert_equal 1, Roo::Base.letter_to_number('A')
|
38
|
-
assert_equal 1, Roo::Base.letter_to_number('a')
|
39
|
-
end
|
40
|
-
|
41
|
-
should "give us the correct value for 'Z'" do
|
42
|
-
assert_equal 26, Roo::Base.letter_to_number('Z')
|
43
|
-
end
|
44
|
-
|
45
|
-
should "give us the correct value for 'AA' regardless of case mixing" do
|
46
|
-
assert_equal 27, Roo::Base.letter_to_number('AA')
|
47
|
-
assert_equal 27, Roo::Base.letter_to_number('aA')
|
48
|
-
assert_equal 27, Roo::Base.letter_to_number('Aa')
|
49
|
-
assert_equal 27, Roo::Base.letter_to_number('aa')
|
50
|
-
end
|
51
|
-
|
52
|
-
should "give us the correct value for 'AB'" do
|
53
|
-
assert_equal 28, Roo::Base.letter_to_number('AB')
|
54
|
-
end
|
55
|
-
|
56
|
-
should "give us the correct value for 'AZ'" do
|
57
|
-
assert_equal 26*2, Roo::Base.letter_to_number('AZ')
|
58
|
-
end
|
59
|
-
|
60
|
-
should "give us the correct value for 'BZ'" do
|
61
|
-
assert_equal 26*3, Roo::Base.letter_to_number('BZ')
|
62
|
-
end
|
63
|
-
|
64
|
-
should "give us the correct value for 'ZZ'" do
|
65
|
-
assert_equal 26**2 + 26,Roo::Base.letter_to_number('ZZ')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context "Roo::Base.number_to_letter" do
|
70
|
-
Roo::Base::LETTERS.each_with_index do |l,i|
|
71
|
-
should "return '#{l}' when passed #{i+1}" do
|
72
|
-
assert_equal l,Roo::Base.number_to_letter(i+1)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
should "return 'AA' when passed 27" do
|
77
|
-
assert_equal 'AA',Roo::Base.number_to_letter(27)
|
78
|
-
end
|
79
|
-
|
80
|
-
should "return 'AZ' when passed #{26*2}" do
|
81
|
-
assert_equal 'AZ', Roo::Base.number_to_letter(26*2)
|
82
|
-
end
|
83
|
-
|
84
|
-
should "return 'BZ' when passed #{26*3}" do
|
85
|
-
assert_equal 'BZ', Roo::Base.number_to_letter(26*3)
|
86
|
-
end
|
87
|
-
|
88
|
-
should "return 'ZZ' when passed #{26**2 + 26}" do
|
89
|
-
assert_equal 'ZZ',Roo::Base.number_to_letter(26**2 + 26)
|
90
|
-
end
|
91
|
-
|
92
|
-
should "return 'AAA' when passed #{26**2 + 27}" do
|
93
|
-
assert_equal 'AAA',Roo::Base.number_to_letter(26**2 + 27)
|
94
|
-
end
|
95
|
-
|
96
|
-
should "return 'ZZZ' when passed #{26**3 + 26**2 + 26}" do
|
97
|
-
assert_equal 'ZZZ',Roo::Base.number_to_letter(26**3 + 26**2 + 26)
|
98
|
-
end
|
99
|
-
|
100
|
-
should "return the correct letter when passed a Float" do
|
101
|
-
assert_equal 'A',Roo::Base.number_to_letter(1.0)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_setting_invalid_type_does_not_update_cell
|
106
|
-
@oo.set(1,1,1)
|
107
|
-
assert_raise(ArgumentError){@oo.set(1,1, :invalid_type)}
|
108
|
-
assert_equal 1, @oo.cell(1,1)
|
109
|
-
assert_equal :float, @oo.celltype(1,1)
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_first_row
|
113
|
-
assert_equal 5,@oo.first_row
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_last_row
|
117
|
-
assert_equal 16,@oo.last_row
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_first_column
|
121
|
-
assert_equal 1,@oo.first_column
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_first_column_as_letter
|
125
|
-
assert_equal 'A', @oo.first_column_as_letter
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_last_column
|
129
|
-
assert_equal 7, @oo.last_column
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_last_column_as_letter
|
133
|
-
assert_equal 'G', @oo.last_column_as_letter
|
134
|
-
end
|
135
|
-
|
136
|
-
#TODO: inkonsequente Lieferung Fixnum/Float
|
137
|
-
def test_rows
|
138
|
-
assert_equal [41.0,42.0,43.0,44.0,45.0, nil, nil], @oo.row(12)
|
139
|
-
assert_equal [nil, nil, "dreiundvierzig", "vierundvierzig", "fuenfundvierzig", nil, nil], @oo.row(16)
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_empty_eh
|
143
|
-
assert @oo.empty?(1,1)
|
144
|
-
assert !@oo.empty?(8,3)
|
145
|
-
assert @oo.empty?("A",11)
|
146
|
-
assert !@oo.empty?("A",12)
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_reload
|
150
|
-
@oo.reload
|
151
|
-
assert @oo.instance_variable_get(:@cell).empty?
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_to_yaml
|
155
|
-
assert_equal "--- \n"+yaml_entry(5,1,"date","1961-11-21"), @oo.to_yaml({}, 5,1,5,1)
|
156
|
-
assert_equal "--- \n"+yaml_entry(8,3,"string","thisisc8"), @oo.to_yaml({}, 8,3,8,3)
|
157
|
-
assert_equal "--- \n"+yaml_entry(12,3,"float",43.0), @oo.to_yaml({}, 12,3,12,3)
|
158
|
-
assert_equal \
|
159
|
-
"--- \n"+yaml_entry(12,3,"float",43.0) +
|
160
|
-
yaml_entry(12,4,"float",44.0) +
|
161
|
-
yaml_entry(12,5,"float",45.0), @oo.to_yaml({}, 12,3,12)
|
162
|
-
assert_equal \
|
163
|
-
"--- \n"+yaml_entry(12,3,"float",43.0)+
|
164
|
-
yaml_entry(12,4,"float",44.0)+
|
165
|
-
yaml_entry(12,5,"float",45.0)+
|
166
|
-
yaml_entry(15,3,"float",43.0)+
|
167
|
-
yaml_entry(15,4,"float",44.0)+
|
168
|
-
yaml_entry(15,5,"float",45.0)+
|
169
|
-
yaml_entry(16,3,"string","dreiundvierzig")+
|
170
|
-
yaml_entry(16,4,"string","vierundvierzig")+
|
171
|
-
yaml_entry(16,5,"string","fuenfundvierzig"), @oo.to_yaml({}, 12,3)
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_to_csv
|
175
|
-
assert_equal expected_csv,@oo.to_csv
|
176
|
-
end
|
177
|
-
protected
|
178
|
-
def setup_test_sheet(workbook=nil)
|
179
|
-
workbook ||= @oo
|
180
|
-
set_sheet_values(workbook)
|
181
|
-
set_sheet_types(workbook)
|
182
|
-
set_cells_read(workbook)
|
183
|
-
end
|
184
|
-
|
185
|
-
def set_sheet_values(workbook)
|
186
|
-
workbook.instance_variable_get(:@cell)[workbook.default_sheet] = {
|
187
|
-
[5,1] => Date.civil(1961,11,21).to_s,
|
188
|
-
|
189
|
-
[8,3] => "thisisc8",
|
190
|
-
[8,7] => "thisisg8",
|
191
|
-
|
192
|
-
[12,1] => 41.0,
|
193
|
-
[12,2] => 42.0,
|
194
|
-
[12,3] => 43.0,
|
195
|
-
[12,4] => 44.0,
|
196
|
-
[12,5] => 45.0,
|
197
|
-
|
198
|
-
[15,3] => 43.0,
|
199
|
-
[15,4] => 44.0,
|
200
|
-
[15,5] => 45.0,
|
201
|
-
|
202
|
-
[16,3] => "dreiundvierzig",
|
203
|
-
[16,4] => "vierundvierzig",
|
204
|
-
[16,5] => "fuenfundvierzig"
|
205
|
-
}
|
206
|
-
end
|
207
|
-
|
208
|
-
def set_sheet_types(workbook)
|
209
|
-
workbook.instance_variable_get(:@cell_type)[workbook.default_sheet] = {
|
210
|
-
[5,1] => :date,
|
211
|
-
|
212
|
-
[8,3] => :string,
|
213
|
-
[8,7] => :string,
|
214
|
-
|
215
|
-
[12,1] => :float,
|
216
|
-
[12,2] => :float,
|
217
|
-
[12,3] => :float,
|
218
|
-
[12,4] => :float,
|
219
|
-
[12,5] => :float,
|
220
|
-
|
221
|
-
[15,3] => :float,
|
222
|
-
[15,4] => :float,
|
223
|
-
[15,5] => :float,
|
224
|
-
|
225
|
-
[16,3] => :string,
|
226
|
-
[16,4] => :string,
|
227
|
-
[16,5] => :string,
|
228
|
-
}
|
229
|
-
end
|
230
|
-
|
231
|
-
def set_first_row(workbook)
|
232
|
-
row_hash = workbook.instance_variable_get(:@first_row)
|
233
|
-
row_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[0]}.min
|
234
|
-
end
|
235
|
-
|
236
|
-
def set_last_row(workbook)
|
237
|
-
row_hash = workbook.instance_variable_get(:@last_row)
|
238
|
-
row_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[0]}.max
|
239
|
-
end
|
240
|
-
|
241
|
-
def set_first_col(workbook)
|
242
|
-
col_hash = workbook.instance_variable_get(:@first_column)
|
243
|
-
col_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[1]}.min
|
244
|
-
end
|
245
|
-
|
246
|
-
def set_last_col(workbook)
|
247
|
-
col_hash = workbook.instance_variable_get(:@last_column)
|
248
|
-
col_hash[workbook.default_sheet] = workbook.instance_variable_get(:@cell)[workbook.default_sheet].map{|k,v| k[1]}.max
|
249
|
-
end
|
250
|
-
|
251
|
-
def set_cells_read(workbook)
|
252
|
-
read_hash = workbook.instance_variable_get(:@cells_read)
|
253
|
-
read_hash[workbook.default_sheet] = true
|
254
|
-
end
|
255
|
-
|
256
|
-
def expected_csv
|
257
|
-
",,,,,,\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"
|
258
|
-
end
|
259
|
-
end
|