workbook 0.3.1 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardoc/checksums +21 -18
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +4 -4
- data/README.md +8 -5
- data/doc/RubyXL/Cell.html +18 -19
- data/doc/RubyXL/Workbook.html +116 -114
- data/doc/RubyXL.html +3 -3
- data/doc/Workbook/Book.html +513 -145
- data/doc/Workbook/Cell.html +181 -170
- data/doc/Workbook/Format.html +591 -77
- data/doc/Workbook/Modules/RawObjectsStorage.html +39 -45
- data/doc/Workbook/Modules/TableDiffSort.html +225 -87
- data/doc/Workbook/Modules/TypeParser.html +182 -131
- data/doc/Workbook/Modules.html +3 -3
- data/doc/Workbook/Readers/CsvReader.html +101 -39
- data/doc/Workbook/Readers/OdsReader.html +564 -0
- data/doc/Workbook/Readers/TxtReader.html +12 -14
- data/doc/Workbook/Readers/XlsReader.html +154 -138
- data/doc/Workbook/Readers/XlsShared.html +71 -72
- data/doc/Workbook/Readers/XlsxReader.html +89 -82
- data/doc/Workbook/Readers.html +6 -6
- data/doc/Workbook/Row.html +421 -206
- data/doc/Workbook/Sheet.html +379 -32
- data/doc/Workbook/Table.html +328 -90
- data/doc/Workbook/Template.html +55 -60
- data/doc/Workbook/Writers/CsvTableWriter.html +33 -8
- data/doc/Workbook/Writers/HtmlWriter.html +393 -0
- data/doc/Workbook/Writers/XlsWriter.html +132 -92
- data/doc/Workbook/Writers.html +5 -5
- data/doc/Workbook.html +16 -4
- data/doc/_index.html +45 -15
- data/doc/class_list.html +1 -1
- data/doc/css/style.css +10 -0
- data/doc/file.README.html +53 -48
- data/doc/frames.html +1 -1
- data/doc/index.html +53 -48
- data/doc/method_list.html +232 -56
- data/doc/top-level-namespace.html +3 -3
- data/lib/workbook/book.rb +27 -1
- data/lib/workbook/format.rb +46 -7
- data/lib/workbook/modules/type_parser.rb +8 -1
- data/lib/workbook/readers/ods_reader.rb +93 -0
- data/lib/workbook/row.rb +7 -0
- data/lib/workbook/sheet.rb +10 -0
- data/lib/workbook/version.rb +1 -1
- data/lib/workbook/writers/html_writer.rb +56 -0
- data/test/artifacts/book_with_tabs_and_colours.ods +0 -0
- data/test/artifacts/complex_types.ods +0 -0
- data/test/artifacts/excel_different_types.ods +0 -0
- data/test/artifacts/simple_sheet.ods +0 -0
- data/test/test_book.rb +6 -0
- data/test/test_format.rb +39 -0
- data/test/test_modules_type_parser.rb +2 -0
- data/test/test_readers_csv_reader.rb +44 -0
- data/test/test_readers_ods_reader.rb +51 -0
- data/test/test_readers_txt_reader.rb +53 -0
- data/test/test_row.rb +12 -0
- data/test/test_sheet.rb +12 -0
- data/test/test_writers_html_writer.rb +37 -0
- data/workbook.gemspec +2 -2
- metadata +21 -4
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), 'helper')
|
3
|
+
|
4
|
+
module Writers
|
5
|
+
class TestXlsWriter < Test::Unit::TestCase
|
6
|
+
def test_to_html
|
7
|
+
match = Workbook::Book.new.to_html.match(/<table><\/table>/) ? true : false
|
8
|
+
assert_equal(true, match)
|
9
|
+
html = Workbook::Book.new([['a','b'],[1,2],[3,4]]).to_html
|
10
|
+
match = html.match(/<table><\/table>/) ? true : false
|
11
|
+
assert_equal(false, match)
|
12
|
+
match = html.match(/<td>1<\/td>/) ? true : false
|
13
|
+
assert_equal(true, match)
|
14
|
+
match = html.match(/<td>a<\/td>/) ? true : false
|
15
|
+
assert_equal(true, match)
|
16
|
+
end
|
17
|
+
def test_to_html_format_names
|
18
|
+
b = Workbook::Book.new([['a','b'],[1,2],[3,4]])
|
19
|
+
c = b[0][0][0][0]
|
20
|
+
c.format.name="testname"
|
21
|
+
html = b.to_html
|
22
|
+
match = html.match(/<td class=\"testname\">a<\/td>/) ? true : false
|
23
|
+
assert_equal(true, match)
|
24
|
+
end
|
25
|
+
def test_to_html_css
|
26
|
+
b = Workbook::Book.new([['a','b'],[1,2],[3,4]])
|
27
|
+
c = b[0][0][0][0]
|
28
|
+
c.format[:background]="#f00"
|
29
|
+
html = b.to_html
|
30
|
+
match = html.match(/<td>a<\/td>/) ? true : false
|
31
|
+
assert_equal(true, match)
|
32
|
+
html = b.to_html({:style_with_inline_css=>true})
|
33
|
+
match = html.match(/<td style="background: #f00">a<\/td>/) ? true : false
|
34
|
+
assert_equal(true, match)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/workbook.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = 'workbook'
|
9
9
|
s.rubyforge_project = 'workbook'
|
10
10
|
s.version = Workbook::VERSION
|
11
|
-
s.date = '2013-
|
11
|
+
s.date = '2013-04-05'
|
12
12
|
s.summary = "Workbook is a datastructure to contain books of tables (an anlogy used in e.g. Excel)"
|
13
|
-
s.description = "Workbook contains workbooks, as in a table, contains rows, contains cells, reads/writes
|
13
|
+
s.description = "Workbook contains workbooks, as in a table, contains rows, contains cells, reads/writes excel, ods and csv and tab separated files, and offers basic diffing and sorting capabilities."
|
14
14
|
s.authors = ["Maarten Brouwers"]
|
15
15
|
s.add_dependency('spreadsheet', '>= 0.7.5')
|
16
16
|
s.add_dependency('fastercsv') if RUBY_VERSION < "1.9"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spreadsheet
|
@@ -108,8 +108,8 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
description: Workbook contains workbooks, as in a table, contains rows, contains cells,
|
111
|
-
reads/writes
|
112
|
-
capabilities.
|
111
|
+
reads/writes excel, ods and csv and tab separated files, and offers basic diffing
|
112
|
+
and sorting capabilities.
|
113
113
|
email:
|
114
114
|
- gem@murb.nl
|
115
115
|
executables: []
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- doc/Workbook/Modules/TypeParser.html
|
141
141
|
- doc/Workbook/Readers.html
|
142
142
|
- doc/Workbook/Readers/CsvReader.html
|
143
|
+
- doc/Workbook/Readers/OdsReader.html
|
143
144
|
- doc/Workbook/Readers/TxtReader.html
|
144
145
|
- doc/Workbook/Readers/XlsReader.html
|
145
146
|
- doc/Workbook/Readers/XlsShared.html
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- doc/Workbook/Template.html
|
151
152
|
- doc/Workbook/Writers.html
|
152
153
|
- doc/Workbook/Writers/CsvTableWriter.html
|
154
|
+
- doc/Workbook/Writers/HtmlWriter.html
|
153
155
|
- doc/Workbook/Writers/XlsWriter.html
|
154
156
|
- doc/_index.html
|
155
157
|
- doc/class_list.html
|
@@ -173,6 +175,7 @@ files:
|
|
173
175
|
- lib/workbook/modules/table_diff_sort.rb
|
174
176
|
- lib/workbook/modules/type_parser.rb
|
175
177
|
- lib/workbook/readers/csv_reader.rb
|
178
|
+
- lib/workbook/readers/ods_reader.rb
|
176
179
|
- lib/workbook/readers/txt_reader.rb
|
177
180
|
- lib/workbook/readers/xls_reader.rb
|
178
181
|
- lib/workbook/readers/xls_shared.rb
|
@@ -183,11 +186,15 @@ files:
|
|
183
186
|
- lib/workbook/template.rb
|
184
187
|
- lib/workbook/version.rb
|
185
188
|
- lib/workbook/writers/csv_table_writer.rb
|
189
|
+
- lib/workbook/writers/html_writer.rb
|
186
190
|
- lib/workbook/writers/xls_writer.rb
|
191
|
+
- test/artifacts/book_with_tabs_and_colours.ods
|
187
192
|
- test/artifacts/book_with_tabs_and_colours.xls
|
188
193
|
- test/artifacts/book_with_tabs_and_colours.xlsx
|
194
|
+
- test/artifacts/complex_types.ods
|
189
195
|
- test/artifacts/complex_types.xls
|
190
196
|
- test/artifacts/excel_different_types.csv
|
197
|
+
- test/artifacts/excel_different_types.ods
|
191
198
|
- test/artifacts/excel_different_types.txt
|
192
199
|
- test/artifacts/excel_different_types.xls
|
193
200
|
- test/artifacts/excel_different_types.xlsx
|
@@ -196,6 +203,7 @@ files:
|
|
196
203
|
- test/artifacts/sheetduplication.xls
|
197
204
|
- test/artifacts/simple_csv.csv
|
198
205
|
- test/artifacts/simple_excel_csv.csv
|
206
|
+
- test/artifacts/simple_sheet.ods
|
199
207
|
- test/artifacts/simple_sheet.xls
|
200
208
|
- test/artifacts/txt_in_xls.xls
|
201
209
|
- test/artifacts/xls_with_txt_extension.txt
|
@@ -208,6 +216,7 @@ files:
|
|
208
216
|
- test/test_modules_table_diff_sort.rb
|
209
217
|
- test/test_modules_type_parser.rb
|
210
218
|
- test/test_readers_csv_reader.rb
|
219
|
+
- test/test_readers_ods_reader.rb
|
211
220
|
- test/test_readers_txt_reader.rb
|
212
221
|
- test/test_readers_xls_reader.rb
|
213
222
|
- test/test_readers_xlsx_reader.rb
|
@@ -215,6 +224,7 @@ files:
|
|
215
224
|
- test/test_sheet.rb
|
216
225
|
- test/test_table.rb
|
217
226
|
- test/test_template.rb
|
227
|
+
- test/test_writers_html_writer.rb
|
218
228
|
- test/test_writers_xls_writer.rb
|
219
229
|
- workbook.gemspec
|
220
230
|
homepage: http://murb.nl/blog?tags=workbook
|
@@ -243,10 +253,13 @@ specification_version: 3
|
|
243
253
|
summary: Workbook is a datastructure to contain books of tables (an anlogy used in
|
244
254
|
e.g. Excel)
|
245
255
|
test_files:
|
256
|
+
- test/artifacts/book_with_tabs_and_colours.ods
|
246
257
|
- test/artifacts/book_with_tabs_and_colours.xls
|
247
258
|
- test/artifacts/book_with_tabs_and_colours.xlsx
|
259
|
+
- test/artifacts/complex_types.ods
|
248
260
|
- test/artifacts/complex_types.xls
|
249
261
|
- test/artifacts/excel_different_types.csv
|
262
|
+
- test/artifacts/excel_different_types.ods
|
250
263
|
- test/artifacts/excel_different_types.txt
|
251
264
|
- test/artifacts/excel_different_types.xls
|
252
265
|
- test/artifacts/excel_different_types.xlsx
|
@@ -255,6 +268,7 @@ test_files:
|
|
255
268
|
- test/artifacts/sheetduplication.xls
|
256
269
|
- test/artifacts/simple_csv.csv
|
257
270
|
- test/artifacts/simple_excel_csv.csv
|
271
|
+
- test/artifacts/simple_sheet.ods
|
258
272
|
- test/artifacts/simple_sheet.xls
|
259
273
|
- test/artifacts/txt_in_xls.xls
|
260
274
|
- test/artifacts/xls_with_txt_extension.txt
|
@@ -267,6 +281,7 @@ test_files:
|
|
267
281
|
- test/test_modules_table_diff_sort.rb
|
268
282
|
- test/test_modules_type_parser.rb
|
269
283
|
- test/test_readers_csv_reader.rb
|
284
|
+
- test/test_readers_ods_reader.rb
|
270
285
|
- test/test_readers_txt_reader.rb
|
271
286
|
- test/test_readers_xls_reader.rb
|
272
287
|
- test/test_readers_xlsx_reader.rb
|
@@ -274,4 +289,6 @@ test_files:
|
|
274
289
|
- test/test_sheet.rb
|
275
290
|
- test/test_table.rb
|
276
291
|
- test/test_template.rb
|
292
|
+
- test/test_writers_html_writer.rb
|
277
293
|
- test/test_writers_xls_writer.rb
|
294
|
+
has_rdoc:
|