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
data/doc/_index.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>
|
7
|
-
Documentation by YARD 0.8.
|
7
|
+
Documentation by YARD 0.8.5.2
|
8
8
|
|
9
9
|
</title>
|
10
10
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
<iframe id="search_frame"></iframe>
|
58
58
|
|
59
|
-
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.
|
59
|
+
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.5.2</h1>
|
60
60
|
<div id="listing">
|
61
61
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
62
62
|
|
@@ -100,16 +100,16 @@
|
|
100
100
|
<ul>
|
101
101
|
|
102
102
|
<li>
|
103
|
-
<span class='object_link'><a href="
|
103
|
+
<span class='object_link'><a href="RubyXL/Cell.html" title="RubyXL::Cell (class)">Cell</a></span>
|
104
104
|
|
105
|
-
<small>(
|
105
|
+
<small>(RubyXL)</small>
|
106
106
|
|
107
107
|
</li>
|
108
108
|
|
109
109
|
<li>
|
110
|
-
<span class='object_link'><a href="
|
110
|
+
<span class='object_link'><a href="Workbook/Cell.html" title="Workbook::Cell (class)">Cell</a></span>
|
111
111
|
|
112
|
-
<small>(
|
112
|
+
<small>(Workbook)</small>
|
113
113
|
|
114
114
|
</li>
|
115
115
|
|
@@ -146,6 +146,21 @@
|
|
146
146
|
</ul>
|
147
147
|
|
148
148
|
|
149
|
+
<ul id="alpha_H" class="alpha">
|
150
|
+
<li class="letter">H</li>
|
151
|
+
<ul>
|
152
|
+
|
153
|
+
<li>
|
154
|
+
<span class='object_link'><a href="Workbook/Writers/HtmlWriter.html" title="Workbook::Writers::HtmlWriter (module)">HtmlWriter</a></span>
|
155
|
+
|
156
|
+
<small>(Workbook::Writers)</small>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
</ul>
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
149
164
|
<ul id="alpha_M" class="alpha">
|
150
165
|
<li class="letter">M</li>
|
151
166
|
<ul>
|
@@ -161,6 +176,21 @@
|
|
161
176
|
</ul>
|
162
177
|
|
163
178
|
|
179
|
+
<ul id="alpha_O" class="alpha">
|
180
|
+
<li class="letter">O</li>
|
181
|
+
<ul>
|
182
|
+
|
183
|
+
<li>
|
184
|
+
<span class='object_link'><a href="Workbook/Readers/OdsReader.html" title="Workbook::Readers::OdsReader (module)">OdsReader</a></span>
|
185
|
+
|
186
|
+
<small>(Workbook::Readers)</small>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
</ul>
|
191
|
+
</ul>
|
192
|
+
|
193
|
+
|
164
194
|
<ul id="alpha_R" class="alpha">
|
165
195
|
<li class="letter">R</li>
|
166
196
|
<ul>
|
@@ -195,6 +225,9 @@
|
|
195
225
|
</ul>
|
196
226
|
|
197
227
|
|
228
|
+
</td><td valign='top' width="33%">
|
229
|
+
|
230
|
+
|
198
231
|
<ul id="alpha_S" class="alpha">
|
199
232
|
<li class="letter">S</li>
|
200
233
|
<ul>
|
@@ -253,22 +286,19 @@
|
|
253
286
|
</ul>
|
254
287
|
|
255
288
|
|
256
|
-
</td><td valign='top' width="33%">
|
257
|
-
|
258
|
-
|
259
289
|
<ul id="alpha_W" class="alpha">
|
260
290
|
<li class="letter">W</li>
|
261
291
|
<ul>
|
262
292
|
|
263
293
|
<li>
|
264
|
-
<span class='object_link'><a href="Workbook.html" title="Workbook (
|
294
|
+
<span class='object_link'><a href="RubyXL/Workbook.html" title="RubyXL::Workbook (class)">Workbook</a></span>
|
295
|
+
|
296
|
+
<small>(RubyXL)</small>
|
265
297
|
|
266
298
|
</li>
|
267
299
|
|
268
300
|
<li>
|
269
|
-
<span class='object_link'><a href="
|
270
|
-
|
271
|
-
<small>(RubyXL)</small>
|
301
|
+
<span class='object_link'><a href="Workbook.html" title="Workbook (module)">Workbook</a></span>
|
272
302
|
|
273
303
|
</li>
|
274
304
|
|
@@ -327,9 +357,9 @@
|
|
327
357
|
</div>
|
328
358
|
|
329
359
|
<div id="footer">
|
330
|
-
Generated on
|
360
|
+
Generated on Sun May 5 14:58:04 2013 by
|
331
361
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
332
|
-
0.8.
|
362
|
+
0.8.5.2 (ruby-1.9.3).
|
333
363
|
</div>
|
334
364
|
|
335
365
|
</body>
|
data/doc/class_list.html
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
|
46
46
|
<ul id="full_list" class="class">
|
47
47
|
<li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
|
48
|
-
<li><a class='toggle'></a> <span class='object_link'><a href="RubyXL.html" title="RubyXL (module)">RubyXL</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="RubyXL/Cell.html" title="RubyXL::Cell (class)">Cell</a></span> < Object<small class='search_info'>RubyXL</small></li><li><span class='object_link'><a href="RubyXL/Workbook.html" title="RubyXL::Workbook (class)">Workbook</a></span> < Object<small class='search_info'>RubyXL</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Workbook.html" title="Workbook (module)">Workbook</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Workbook/Book.html" title="Workbook::Book (class)">Book</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Cell.html" title="Workbook::Cell (class)">Cell</a></span> < Object<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Format.html" title="Workbook::Format (class)">Format</a></span> < Hash<small class='search_info'>Workbook</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Modules.html" title="Workbook::Modules (module)">Modules</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Modules/RawObjectsStorage.html" title="Workbook::Modules::RawObjectsStorage (module)">RawObjectsStorage</a></span><small class='search_info'>Workbook::Modules</small></li><li><span class='object_link'><a href="Workbook/Modules/TableDiffSort.html" title="Workbook::Modules::TableDiffSort (module)">TableDiffSort</a></span><small class='search_info'>Workbook::Modules</small></li><li><span class='object_link'><a href="Workbook/Modules/TypeParser.html" title="Workbook::Modules::TypeParser (module)">TypeParser</a></span><small class='search_info'>Workbook::Modules</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Readers.html" title="Workbook::Readers (module)">Readers</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Readers/CsvReader.html" title="Workbook::Readers::CsvReader (module)">CsvReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/TxtReader.html" title="Workbook::Readers::TxtReader (module)">TxtReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsReader.html" title="Workbook::Readers::XlsReader (module)">XlsReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsShared.html" title="Workbook::Readers::XlsShared (module)">XlsShared</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsxReader.html" title="Workbook::Readers::XlsxReader (module)">XlsxReader</a></span><small class='search_info'>Workbook::Readers</small></li></ul><li><span class='object_link'><a href="Workbook/Row.html" title="Workbook::Row (class)">Row</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Sheet.html" title="Workbook::Sheet (class)">Sheet</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Table.html" title="Workbook::Table (class)">Table</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Template.html" title="Workbook::Template (class)">Template</a></span> < Object<small class='search_info'>Workbook</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Writers.html" title="Workbook::Writers (module)">Writers</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Writers/CsvTableWriter.html" title="Workbook::Writers::CsvTableWriter (module)">CsvTableWriter</a></span><small class='search_info'>Workbook::Writers</small></li><li><span class='object_link'><a href="Workbook/Writers/XlsWriter.html" title="Workbook::Writers::XlsWriter (module)">XlsWriter</a></span><small class='search_info'>Workbook::Writers</small></li></ul></ul>
|
48
|
+
<li><a class='toggle'></a> <span class='object_link'><a href="RubyXL.html" title="RubyXL (module)">RubyXL</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="RubyXL/Cell.html" title="RubyXL::Cell (class)">Cell</a></span> < Object<small class='search_info'>RubyXL</small></li><li><span class='object_link'><a href="RubyXL/Workbook.html" title="RubyXL::Workbook (class)">Workbook</a></span> < Object<small class='search_info'>RubyXL</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Workbook.html" title="Workbook (module)">Workbook</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Workbook/Book.html" title="Workbook::Book (class)">Book</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Cell.html" title="Workbook::Cell (class)">Cell</a></span> < Object<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Format.html" title="Workbook::Format (class)">Format</a></span> < Hash<small class='search_info'>Workbook</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Modules.html" title="Workbook::Modules (module)">Modules</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Modules/RawObjectsStorage.html" title="Workbook::Modules::RawObjectsStorage (module)">RawObjectsStorage</a></span><small class='search_info'>Workbook::Modules</small></li><li><span class='object_link'><a href="Workbook/Modules/TableDiffSort.html" title="Workbook::Modules::TableDiffSort (module)">TableDiffSort</a></span><small class='search_info'>Workbook::Modules</small></li><li><span class='object_link'><a href="Workbook/Modules/TypeParser.html" title="Workbook::Modules::TypeParser (module)">TypeParser</a></span><small class='search_info'>Workbook::Modules</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Readers.html" title="Workbook::Readers (module)">Readers</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Readers/CsvReader.html" title="Workbook::Readers::CsvReader (module)">CsvReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/OdsReader.html" title="Workbook::Readers::OdsReader (module)">OdsReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/TxtReader.html" title="Workbook::Readers::TxtReader (module)">TxtReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsReader.html" title="Workbook::Readers::XlsReader (module)">XlsReader</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsShared.html" title="Workbook::Readers::XlsShared (module)">XlsShared</a></span><small class='search_info'>Workbook::Readers</small></li><li><span class='object_link'><a href="Workbook/Readers/XlsxReader.html" title="Workbook::Readers::XlsxReader (module)">XlsxReader</a></span><small class='search_info'>Workbook::Readers</small></li></ul><li><span class='object_link'><a href="Workbook/Row.html" title="Workbook::Row (class)">Row</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Sheet.html" title="Workbook::Sheet (class)">Sheet</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Table.html" title="Workbook::Table (class)">Table</a></span> < Array<small class='search_info'>Workbook</small></li><li><span class='object_link'><a href="Workbook/Template.html" title="Workbook::Template (class)">Template</a></span> < Object<small class='search_info'>Workbook</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Workbook/Writers.html" title="Workbook::Writers (module)">Writers</a></span><small class='search_info'>Workbook</small></li><ul><li><span class='object_link'><a href="Workbook/Writers/CsvTableWriter.html" title="Workbook::Writers::CsvTableWriter (module)">CsvTableWriter</a></span><small class='search_info'>Workbook::Writers</small></li><li><span class='object_link'><a href="Workbook/Writers/HtmlWriter.html" title="Workbook::Writers::HtmlWriter (module)">HtmlWriter</a></span><small class='search_info'>Workbook::Writers</small></li><li><span class='object_link'><a href="Workbook/Writers/XlsWriter.html" title="Workbook::Writers::XlsWriter (module)">XlsWriter</a></span><small class='search_info'>Workbook::Writers</small></li></ul></ul>
|
49
49
|
|
50
50
|
</ul>
|
51
51
|
</div>
|
data/doc/css/style.css
CHANGED
@@ -27,6 +27,16 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right;
|
|
27
27
|
.rdoc-term { padding-right: 25px; font-weight: bold; }
|
28
28
|
.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; }
|
29
29
|
|
30
|
+
/* style for <table> */
|
31
|
+
#filecontents table, .docstring table { border-collapse: collapse; }
|
32
|
+
#filecontents table th, #filecontents table td,
|
33
|
+
.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; }
|
34
|
+
#filecontents table tr:nth-child(odd),
|
35
|
+
.docstring table tr:nth-child(odd) { background: #eee; }
|
36
|
+
#filecontents table tr:nth-child(even),
|
37
|
+
.docstring table tr:nth-child(even) { background: #fff; }
|
38
|
+
#filecontents table th, .docstring table th { background: #fff; }
|
39
|
+
|
30
40
|
/* style for <ul> */
|
31
41
|
#filecontents li > p, .docstring li > p { margin: 0px; }
|
32
42
|
#filecontents ul, .docstring ul { padding-left: 20px; }
|
data/doc/file.README.html
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -99,63 +99,63 @@
|
|
99
99
|
|
100
100
|
<p>Simply initialize a simple spreadsheet using:</p>
|
101
101
|
|
102
|
-
<pre class="code ruby"><code><span class='
|
102
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Book</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
103
103
|
</code></pre>
|
104
104
|
|
105
105
|
<p>or</p>
|
106
106
|
|
107
|
-
<pre class="code ruby"><code><span class='
|
107
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Book</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span> <span class='id identifier rubyid_filename'>filename</span>
|
108
108
|
</code></pre>
|
109
109
|
|
110
110
|
<p>Calling</p>
|
111
111
|
|
112
|
-
<pre class="code ruby"><code><span class='
|
113
|
-
<span class='
|
112
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_sheet'>sheet</span>
|
113
|
+
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span>
|
114
114
|
</code></pre>
|
115
115
|
|
116
|
-
<p>will give you an the first Sheet and Table (if one doesn
|
116
|
+
<p>will give you an the first Sheet and Table (if one doesn’t exist it is created on the fly).</p>
|
117
117
|
|
118
118
|
<p>You can initialize with simple 2-d array like this:</p>
|
119
119
|
|
120
|
-
<pre class="code ruby"><code><span class='
|
121
|
-
<span class='
|
120
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Book</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbracket'>[</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>a</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>b</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='lbracket'>[</span><span class='int'>3</span><span class='comma'>,</span><span class='int'>4</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='lbracket'>[</span><span class='int'>5</span><span class='comma'>,</span><span class='int'>6</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
121
|
+
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_sheet'>sheet</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span>
|
122
122
|
</code></pre>
|
123
123
|
|
124
124
|
<p>Subsequently you look up values in the table like this:</p>
|
125
125
|
|
126
|
-
<pre class="code ruby"><code><span class='
|
127
|
-
<span class='comment
|
128
|
-
</code></pre>
|
126
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t'>t</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:b</span><span class='rbracket'>]</span>
|
127
|
+
<span class='comment'># returns <Workbook::Cel @value=2>
|
128
|
+
</span></code></pre>
|
129
129
|
|
130
130
|
<p>which is equivalent to</p>
|
131
131
|
|
132
|
-
<pre class="code ruby"><code><span class='
|
132
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t'>t</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
133
133
|
</code></pre>
|
134
134
|
|
135
|
-
<p>Of course you
|
135
|
+
<p>Of course you’ll be able to write a new value back to it. If you just enter a value, formatting of the original cell will be maintained.</p>
|
136
136
|
|
137
|
-
<pre class="code ruby"><code><span class='
|
137
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t'>t</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:b</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>5</span>
|
138
138
|
</code></pre>
|
139
139
|
|
140
140
|
<p>If you want to use an existing file as a template (which you can create in Excel to create nice looking templates),
|
141
141
|
simply clone the row, and add it back:</p>
|
142
142
|
|
143
|
-
<pre class="code ruby"><code><span class='
|
144
|
-
<span class='
|
145
|
-
<span class='
|
146
|
-
<span class='comment
|
147
|
-
|
148
|
-
|
149
|
-
<span class='
|
150
|
-
<span class='
|
151
|
-
<span class='comment
|
152
|
-
|
153
|
-
<span class='
|
154
|
-
<span class='
|
155
|
-
<span class='
|
156
|
-
<span class='comment
|
157
|
-
|
158
|
-
</code></pre>
|
143
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Book</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>template.xls</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
144
|
+
<span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_sheet'>sheet</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span>
|
145
|
+
<span class='id identifier rubyid_template_row'>template_row</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='comment'># can be any, but I typically have a well
|
146
|
+
</span> <span class='comment'># formatted header row + an example template
|
147
|
+
</span> <span class='comment'># row for the data
|
148
|
+
</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>3</span><span class='comma'>,</span><span class='int'>4</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
149
|
+
<span class='id identifier rubyid_new_row'>new_row</span> <span class='op'>=</span> <span class='id identifier rubyid_template_row'>template_row</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span>
|
150
|
+
<span class='id identifier rubyid_table'>table</span> <span class='op'><<</span> <span class='id identifier rubyid_new_row'>new_row</span> <span class='comment'># to use the symbol style header references,
|
151
|
+
</span> <span class='comment'># the row first needs to be added back to the
|
152
|
+
</span> <span class='comment'># table
|
153
|
+
</span> <span class='id identifier rubyid_new_row'>new_row</span><span class='lbracket'>[</span><span class='symbol'>:a</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
154
|
+
<span class='kw'>end</span>
|
155
|
+
<span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_template_row'>template_row</span><span class='rparen'>)</span> <span class='comment'># you don't want the template to show up
|
156
|
+
</span> <span class='comment'># in the endresult
|
157
|
+
</span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result.xls</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># write it!
|
158
|
+
</span></code></pre>
|
159
159
|
|
160
160
|
<!-- Feature *to implement*:
|
161
161
|
|
@@ -175,23 +175,23 @@ On my wishlist: In the future I hope to return the cell value directly, without
|
|
175
175
|
|
176
176
|
<h3 id="sorting">Sorting</h3>
|
177
177
|
|
178
|
-
<p>Sorting leaves the header alone, if it exists, and doesn
|
178
|
+
<p>Sorting leaves the header alone, if it exists, and doesn’t complain about comparing strings with dates with floats (Ever found OpenOffice Calc or Excel complainging about its inability to compare integers and strings? We’re talking spreadsheet here). When classes are different the following (default) order is used: Numbers, Strings, Dates and Times, Booleans and Nils (empty values).</p>
|
179
179
|
|
180
|
-
<pre class="code ruby"><code><span class='
|
180
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span>
|
181
181
|
</code></pre>
|
182
182
|
|
183
183
|
<p><em>To implement</em>:</p>
|
184
184
|
|
185
|
-
<p>To some extent, sort_by works, it doesn
|
185
|
+
<p>To some extent, sort_by works, it doesn’t, however, adhere to the header settings… </p>
|
186
186
|
|
187
|
-
<pre class="code ruby"><code><span class='
|
187
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span><span class='lbracket'>[</span><span class='symbol'>:b</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
188
188
|
</code></pre>
|
189
189
|
|
190
190
|
<h3 id="comparing-tables">Comparing tables</h3>
|
191
191
|
|
192
192
|
<p>Simply call on a Workbook::Table</p>
|
193
193
|
|
194
|
-
<pre class="code ruby"><code><span class='
|
194
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_t1'>t1</span><span class='period'>.</span><span class='id identifier rubyid_diff'>diff</span> <span class='id identifier rubyid_t2'>t2</span>
|
195
195
|
</code></pre>
|
196
196
|
|
197
197
|
<p>And a new book with a new sheet/table will be returned containing the differences between the two tables.</p>
|
@@ -200,16 +200,20 @@ On my wishlist: In the future I hope to return the cell value directly, without
|
|
200
200
|
|
201
201
|
<p>Currently writing is limited to the following formats. Templating support is still limited.</p>
|
202
202
|
|
203
|
-
<pre class="code ruby"><code><span class='
|
204
|
-
|
205
|
-
|
206
|
-
</code></pre>
|
203
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_to_xls'>to_xls</span> <span class='comment'># returns a spreadsheet workbook
|
204
|
+
</span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_write_to_xls'>write_to_xls</span> <span class='id identifier rubyid_filename'>filename</span> <span class='comment'># writes to filename
|
205
|
+
</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_to_csv'>to_csv</span> <span class='comment'># returns a csv-string (called on tables)
|
206
|
+
</span></code></pre>
|
207
207
|
|
208
208
|
<p>In case you want to display the table in HTML, some conversion is offered to convert text/background properties to css-entities. Internally the hash storing style elements tries to map to CSS where possible.</p>
|
209
209
|
|
210
|
+
<h2 id="compatibility">Compatibility</h2>
|
211
|
+
|
212
|
+
<p>Workbook should be compatible with ruby 1.8.7 and 1.9.3. Check <a href="https://travis-ci.org/murb/workbook">Travis for Workbook’s current build status</a> <a href="https://travis-ci.org/murb/workbook"><img src="https://travis-ci.org/murb/workbook.png?branch=master" alt="Build Status" /></a>. </p>
|
213
|
+
|
210
214
|
<h2 id="alternatives">Alternatives</h2>
|
211
215
|
|
212
|
-
<p>The <a href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=spreadsheet">ruby toolbox lists plenty of alternatives</a>, that just didn
|
216
|
+
<p>The <a href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=spreadsheet">ruby toolbox lists plenty of alternatives</a>, that just didn’t suit my needs.</p>
|
213
217
|
|
214
218
|
<h2 id="license">License</h2>
|
215
219
|
|
@@ -218,18 +222,19 @@ On my wishlist: In the future I hope to return the cell value directly, without
|
|
218
222
|
<p>Workbook uses the following gems:</p>
|
219
223
|
|
220
224
|
<ul>
|
221
|
-
<li><a href="https://github.com/zdavatz/spreadsheet">Spreadsheet</a> Used for reading and writing old style .xls files (Copyright
|
222
|
-
<li><a href="http://code.google.com/p/ruby-ole/">ruby-ole</a> Used in the Spreadsheet Gem (Copyright
|
223
|
-
<li><a href="http://fastercsv.rubyforge.org/">FasterCSV</a> Used for reading CSV (comma separated text) and TXT (tab separated text) files (Copyright
|
224
|
-
<li><a href="http://rubyforge.org/projects/rchardet">rchardet</a> Used for detecting encoding in CSV and TXT importers (Copyright
|
225
|
-
<li><a href="https://github.com/gilt/rubyXL">RubyXL</a> Used for reading the newer .xlsx files (Copyright
|
225
|
+
<li><a href="https://github.com/zdavatz/spreadsheet">Spreadsheet</a> Used for reading and writing old style .xls files (Copyright © 2010 ywesee GmbH (mhatakeyama@ywesee.com, zdavatz@ywesee.com); GPL3 (License required for closed implementations))</li>
|
226
|
+
<li><a href="http://code.google.com/p/ruby-ole/">ruby-ole</a> Used in the Spreadsheet Gem (Copyright © 2007-2010 Charles Lowe; MIT)</li>
|
227
|
+
<li><a href="http://fastercsv.rubyforge.org/">FasterCSV</a> Used for reading CSV (comma separated text) and TXT (tab separated text) files (Copyright © James Edward Gray II; GPL2 & Ruby License)</li>
|
228
|
+
<li><a href="http://rubyforge.org/projects/rchardet">rchardet</a> Used for detecting encoding in CSV and TXT importers (Copyright © JMHodges; LGPL)</li>
|
229
|
+
<li><a href="https://github.com/gilt/rubyXL">RubyXL</a> Used for reading the newer .xlsx files (Copyright © 2011 Vivek Bhagwat; MIT-Licensed)</li>
|
230
|
+
<li><a href="http://nokogiri.org/">Nokogiri</a> Used for reading ODS documents (Copyright © 2008 - 2012 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada; MIT Licensed)</li>
|
226
231
|
</ul>
|
227
232
|
</div></div>
|
228
233
|
|
229
234
|
<div id="footer">
|
230
|
-
Generated on
|
235
|
+
Generated on Sun May 5 14:58:04 2013 by
|
231
236
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
232
|
-
0.8.
|
237
|
+
0.8.5.2 (ruby-1.9.3).
|
233
238
|
</div>
|
234
239
|
|
235
240
|
</body>
|
data/doc/frames.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
5
|
<head>
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
<title>Documentation by YARD 0.8.
|
7
|
+
<title>Documentation by YARD 0.8.5.2</title>
|
8
8
|
</head>
|
9
9
|
<script type="text/javascript" charset="utf-8">
|
10
10
|
window.onload = function() {
|