workbook 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/lib/workbook/modules/cell.rb +14 -0
  4. data/lib/workbook/version.rb +1 -1
  5. data/test/test_modules_cache.rb +14 -14
  6. data/test/test_modules_cell.rb +9 -2
  7. data/test/test_readers_xls_reader.rb +1 -1
  8. metadata +4 -46
  9. data/doc/RubyXL/Cell.html +0 -201
  10. data/doc/RubyXL/Workbook.html +0 -449
  11. data/doc/RubyXL.html +0 -128
  12. data/doc/Workbook/Book.html +0 -1852
  13. data/doc/Workbook/Cell.html +0 -1553
  14. data/doc/Workbook/Format.html +0 -1168
  15. data/doc/Workbook/Modules/RawObjectsStorage.html +0 -502
  16. data/doc/Workbook/Modules/TableDiffSort.html +0 -758
  17. data/doc/Workbook/Modules/TypeParser.html +0 -1063
  18. data/doc/Workbook/Modules.html +0 -117
  19. data/doc/Workbook/NilValue.html +0 -434
  20. data/doc/Workbook/Readers/CsvReader.html +0 -324
  21. data/doc/Workbook/Readers/OdsReader.html +0 -1066
  22. data/doc/Workbook/Readers/TxtReader.html +0 -236
  23. data/doc/Workbook/Readers/XlsReader.html +0 -378
  24. data/doc/Workbook/Readers/XlsShared.html +0 -188
  25. data/doc/Workbook/Readers/XlsxReader.html +0 -302
  26. data/doc/Workbook/Readers.html +0 -117
  27. data/doc/Workbook/Row.html +0 -2392
  28. data/doc/Workbook/Sheet.html +0 -875
  29. data/doc/Workbook/Table.html +0 -1732
  30. data/doc/Workbook/Template.html +0 -634
  31. data/doc/Workbook/Writers/CsvTableWriter.html +0 -200
  32. data/doc/Workbook/Writers/HtmlWriter.html +0 -407
  33. data/doc/Workbook/Writers/XlsWriter.html +0 -905
  34. data/doc/Workbook/Writers.html +0 -117
  35. data/doc/Workbook.html +0 -142
  36. data/doc/_index.html +0 -381
  37. data/doc/class_list.html +0 -53
  38. data/doc/css/common.css +0 -1
  39. data/doc/css/full_list.css +0 -57
  40. data/doc/css/style.css +0 -338
  41. data/doc/file.README.html +0 -245
  42. data/doc/file_list.html +0 -55
  43. data/doc/frames.html +0 -28
  44. data/doc/index.html +0 -245
  45. data/doc/js/app.js +0 -214
  46. data/doc/js/full_list.js +0 -173
  47. data/doc/js/jquery.js +0 -4
  48. data/doc/method_list.html +0 -1308
  49. data/doc/top-level-namespace.html +0 -112
  50. data/test/artifacts/floats_problem.xls +0 -0
@@ -1,905 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Module: Workbook::Writers::XlsWriter
8
-
9
- &mdash; Documentation by YARD 0.8.5.2
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '../../';
20
- framesUrl = "../../frames.html#!" + escape(window.location.href);
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="../../_index.html">Index (X)</a> &raquo;
35
- <span class='title'><span class='object_link'><a href="../../Workbook.html" title="Workbook (module)">Workbook</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Writers.html" title="Workbook::Writers (module)">Writers</a></span></span>
36
- &raquo;
37
- <span class="title">XlsWriter</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="../../class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="../../method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="../../file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Module: Workbook::Writers::XlsWriter
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
- <dt class="r1">Included in:</dt>
81
- <dd class="r1"><span class='object_link'><a href="../Book.html" title="Workbook::Book (class)">Book</a></span></dd>
82
-
83
-
84
-
85
- <dt class="r2 last">Defined in:</dt>
86
- <dd class="r2 last">lib/workbook/writers/xls_writer.rb</dd>
87
-
88
- </dl>
89
- <div class="clear"></div>
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
- <h2>
100
- Instance Method Summary
101
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
102
- </h2>
103
-
104
- <ul class="summary">
105
-
106
- <li class="public ">
107
- <span class="summary_signature">
108
-
109
- <a href="#format_to_xls_format-instance_method" title="#format_to_xls_format (instance method)">- (Spreadsheet::Format) <strong>format_to_xls_format</strong>(f) </a>
110
-
111
-
112
-
113
- </span>
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <span class="summary_desc"><div class='inline'>
124
- <p>Generates an Spreadsheet (from the spreadsheet gem) in order to build an
125
- XlS.</p>
126
- </div></span>
127
-
128
- </li>
129
-
130
-
131
- <li class="public ">
132
- <span class="summary_signature">
133
-
134
- <a href="#html_color_to_xls_color-instance_method" title="#html_color_to_xls_color (instance method)">- (String) <strong>html_color_to_xls_color</strong>(hex) </a>
135
-
136
-
137
-
138
- </span>
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
- <span class="summary_desc"><div class='inline'>
149
- <p>Attempt to convert html-hex color value to xls color number.</p>
150
- </div></span>
151
-
152
- </li>
153
-
154
-
155
- <li class="public ">
156
- <span class="summary_signature">
157
-
158
- <a href="#init_spreadsheet_template-instance_method" title="#init_spreadsheet_template (instance method)">- (Object) <strong>init_spreadsheet_template</strong> </a>
159
-
160
-
161
-
162
- </span>
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
- <span class="summary_desc"><div class='inline'></div></span>
173
-
174
- </li>
175
-
176
-
177
- <li class="public ">
178
- <span class="summary_signature">
179
-
180
- <a href="#strftime_to_ms_format-instance_method" title="#strftime_to_ms_format (instance method)">- (String<sup>?</sup>) <strong>strftime_to_ms_format</strong>(numberformat) </a>
181
-
182
-
183
-
184
- </span>
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
- <span class="summary_desc"><div class='inline'>
195
- <p>Converts standard (ruby/C++/unix/...) strftime formatting to MS's
196
- formatting.</p>
197
- </div></span>
198
-
199
- </li>
200
-
201
-
202
- <li class="public ">
203
- <span class="summary_signature">
204
-
205
- <a href="#to_xls-instance_method" title="#to_xls (instance method)">- (Spreadsheet) <strong>to_xls</strong>(options = {}) </a>
206
-
207
-
208
-
209
- </span>
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
- <span class="summary_desc"><div class='inline'>
220
- <p>Generates an Spreadsheet (from the spreadsheet gem) in order to build an
221
- XlS.</p>
222
- </div></span>
223
-
224
- </li>
225
-
226
-
227
- <li class="public ">
228
- <span class="summary_signature">
229
-
230
- <a href="#write_to_xls-instance_method" title="#write_to_xls (instance method)">- (Object) <strong>write_to_xls</strong>(filename = &quot;#{title}.xls&quot;, options = {}) </a>
231
-
232
-
233
-
234
- </span>
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
- <span class="summary_desc"><div class='inline'>
245
- <p>Write the current workbook to Microsoft Excel format (using the spreadsheet
246
- gem).</p>
247
- </div></span>
248
-
249
- </li>
250
-
251
-
252
- <li class="public ">
253
- <span class="summary_signature">
254
-
255
- <a href="#xls_sheet-instance_method" title="#xls_sheet (instance method)">- (Object) <strong>xls_sheet</strong>(a) </a>
256
-
257
-
258
-
259
- </span>
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
- <span class="summary_desc"><div class='inline'></div></span>
270
-
271
- </li>
272
-
273
-
274
- <li class="public ">
275
- <span class="summary_signature">
276
-
277
- <a href="#xls_template-instance_method" title="#xls_template (instance method)">- (Object) <strong>xls_template</strong> </a>
278
-
279
-
280
-
281
- </span>
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
- <span class="summary_desc"><div class='inline'></div></span>
292
-
293
- </li>
294
-
295
-
296
- </ul>
297
-
298
-
299
-
300
-
301
- <div id="instance_method_details" class="method_details_list">
302
- <h2>Instance Method Details</h2>
303
-
304
-
305
- <div class="method_details first">
306
- <h3 class="signature first" id="format_to_xls_format-instance_method">
307
-
308
- - (<tt>Spreadsheet::Format</tt>) <strong>format_to_xls_format</strong>(f)
309
-
310
-
311
-
312
-
313
-
314
- </h3><div class="docstring">
315
- <div class="discussion">
316
-
317
- <p>Generates an Spreadsheet (from the spreadsheet gem) in order to build an
318
- XlS</p>
319
-
320
-
321
- </div>
322
- </div>
323
- <div class="tags">
324
- <p class="tag_title">Parameters:</p>
325
- <ul class="param">
326
-
327
- <li>
328
-
329
- <span class='name'>f</span>
330
-
331
-
332
- <span class='type'>(<tt><span class='object_link'><a href="../Format.html" title="Workbook::Format (class)">Workbook::Format</a></span></tt>, <tt>Hash</tt>)</span>
333
-
334
-
335
-
336
- &mdash;
337
- <div class='inline'>
338
- <p>A Workbook::Format or hash with format-options (:font_weight, :rotation,
339
- :background_color, :number_format, :text_direction, :color, :font_family)</p>
340
- </div>
341
-
342
- </li>
343
-
344
- </ul>
345
-
346
- <p class="tag_title">Returns:</p>
347
- <ul class="return">
348
-
349
- <li>
350
-
351
-
352
- <span class='type'>(<tt>Spreadsheet::Format</tt>)</span>
353
-
354
-
355
-
356
- &mdash;
357
- <div class='inline'>
358
- <p>A Spreadsheet format-object, ready for writing or more lower level
359
- operations</p>
360
- </div>
361
-
362
- </li>
363
-
364
- </ul>
365
-
366
- </div><table class="source_code">
367
- <tr>
368
- <td>
369
- <pre class="lines">
370
-
371
-
372
- 38
373
- 39
374
- 40
375
- 41
376
- 42
377
- 43
378
- 44
379
- 45
380
- 46
381
- 47
382
- 48
383
- 49
384
- 50
385
- 51
386
- 52
387
- 53
388
- 54
389
- 55
390
- 56
391
- 57</pre>
392
- </td>
393
- <td>
394
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 38</span>
395
-
396
- <span class='kw'>def</span> <span class='id identifier rubyid_format_to_xls_format'>format_to_xls_format</span> <span class='id identifier rubyid_f'>f</span>
397
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span> <span class='op'>=</span> <span class='kw'>nil</span>
398
- <span class='kw'>unless</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Format</span>
399
- <span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Format</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_f'>f</span>
400
- <span class='kw'>end</span>
401
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_return_raw_for'>return_raw_for</span> <span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Format</span>
402
- <span class='kw'>unless</span> <span class='id identifier rubyid_xlsfmt'>xlsfmt</span>
403
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='op'>=</span><span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Format</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='symbol'>:weight</span><span class='op'>=&gt;</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:font_weight</span><span class='rbracket'>]</span>
404
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_rotation'>rotation</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:rotation</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:rotation</span><span class='rbracket'>]</span>
405
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_pattern_fg_color'>pattern_fg_color</span> <span class='op'>=</span> <span class='id identifier rubyid_html_color_to_xls_color'>html_color_to_xls_color</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:background_color</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_html_color_to_xls_color'>html_color_to_xls_color</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:background_color</span><span class='rbracket'>]</span><span class='rparen'>)</span>
406
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_pattern'>pattern</span> <span class='op'>=</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_html_color_to_xls_color'>html_color_to_xls_color</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:background_color</span><span class='rbracket'>]</span><span class='rparen'>)</span>
407
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_number_format'>number_format</span> <span class='op'>=</span> <span class='id identifier rubyid_strftime_to_ms_format'>strftime_to_ms_format</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:number_format</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:number_format</span><span class='rbracket'>]</span>
408
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_text_direction'>text_direction</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:text_direction</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:text_direction</span><span class='rbracket'>]</span>
409
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_font'>font</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:font_family</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:font_family</span><span class='rbracket'>]</span>
410
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_font'>font</span><span class='period'>.</span><span class='id identifier rubyid_family'>family</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:font_family</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:font_family</span><span class='rbracket'>]</span>
411
- <span class='id identifier rubyid_xlsfmt'>xlsfmt</span><span class='period'>.</span><span class='id identifier rubyid_font'>font</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='id identifier rubyid_html_color_to_xls_color'>html_color_to_xls_color</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:color</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_f'>f</span><span class='lbracket'>[</span><span class='symbol'>:color</span><span class='rbracket'>]</span>
412
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_add_raw'>add_raw</span> <span class='id identifier rubyid_xlsfmt'>xlsfmt</span>
413
- <span class='kw'>end</span>
414
- <span class='kw'>return</span> <span class='id identifier rubyid_xlsfmt'>xlsfmt</span>
415
- <span class='kw'>end</span></pre>
416
- </td>
417
- </tr>
418
- </table>
419
- </div>
420
-
421
- <div class="method_details ">
422
- <h3 class="signature " id="html_color_to_xls_color-instance_method">
423
-
424
- - (<tt>String</tt>) <strong>html_color_to_xls_color</strong>(hex)
425
-
426
-
427
-
428
-
429
-
430
- </h3><div class="docstring">
431
- <div class="discussion">
432
-
433
- <p>Attempt to convert html-hex color value to xls color number</p>
434
-
435
-
436
- </div>
437
- </div>
438
- <div class="tags">
439
- <p class="tag_title">Parameters:</p>
440
- <ul class="param">
441
-
442
- <li>
443
-
444
- <span class='name'>hex</span>
445
-
446
-
447
- <span class='type'>(<tt>String</tt>)</span>
448
-
449
-
450
-
451
- &mdash;
452
- <div class='inline'>
453
- <p>color</p>
454
- </div>
455
-
456
- </li>
457
-
458
- </ul>
459
-
460
- <p class="tag_title">Returns:</p>
461
- <ul class="return">
462
-
463
- <li>
464
-
465
-
466
- <span class='type'>(<tt>String</tt>)</span>
467
-
468
-
469
-
470
- &mdash;
471
- <div class='inline'>
472
- <p>xls color</p>
473
- </div>
474
-
475
- </li>
476
-
477
- </ul>
478
-
479
- </div><table class="source_code">
480
- <tr>
481
- <td>
482
- <pre class="lines">
483
-
484
-
485
- 63
486
- 64
487
- 65
488
- 66
489
- 67
490
- 68</pre>
491
- </td>
492
- <td>
493
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 63</span>
494
-
495
- <span class='kw'>def</span> <span class='id identifier rubyid_html_color_to_xls_color'>html_color_to_xls_color</span> <span class='id identifier rubyid_hex'>hex</span>
496
- <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Readers</span><span class='op'>::</span><span class='const'>XlsShared</span><span class='op'>::</span><span class='const'>XLS_COLORS</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_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
497
- <span class='kw'>return</span> <span class='id identifier rubyid_k'>k</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span> <span class='op'>==</span> <span class='id identifier rubyid_hex'>hex</span> <span class='kw'>or</span> <span class='lparen'>(</span><span class='id identifier rubyid_hex'>hex</span> <span class='kw'>and</span> <span class='id identifier rubyid_hex'>hex</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_k'>k</span> <span class='op'>==</span> <span class='id identifier rubyid_hex'>hex</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span><span class='rparen'>)</span>
498
- <span class='kw'>end</span>
499
- <span class='kw'>return</span> <span class='kw'>nil</span>
500
- <span class='kw'>end</span></pre>
501
- </td>
502
- </tr>
503
- </table>
504
- </div>
505
-
506
- <div class="method_details ">
507
- <h3 class="signature " id="init_spreadsheet_template-instance_method">
508
-
509
- - (<tt>Object</tt>) <strong>init_spreadsheet_template</strong>
510
-
511
-
512
-
513
-
514
-
515
- </h3><table class="source_code">
516
- <tr>
517
- <td>
518
- <pre class="lines">
519
-
520
-
521
- 102
522
- 103
523
- 104
524
- 105
525
- 106
526
- 107
527
- 108
528
- 109
529
- 110</pre>
530
- </td>
531
- <td>
532
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 102</span>
533
-
534
- <span class='kw'>def</span> <span class='id identifier rubyid_init_spreadsheet_template'>init_spreadsheet_template</span>
535
- <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_xls_template'>xls_template</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Workbook</span>
536
- <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_xls_template'>xls_template</span>
537
- <span class='kw'>else</span>
538
- <span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Workbook</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
539
- <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_add_raw'>add_raw</span> <span class='id identifier rubyid_t'>t</span>
540
- <span class='kw'>return</span> <span class='id identifier rubyid_t'>t</span>
541
- <span class='kw'>end</span>
542
- <span class='kw'>end</span></pre>
543
- </td>
544
- </tr>
545
- </table>
546
- </div>
547
-
548
- <div class="method_details ">
549
- <h3 class="signature " id="strftime_to_ms_format-instance_method">
550
-
551
- - (<tt>String</tt><sup>?</sup>) <strong>strftime_to_ms_format</strong>(numberformat)
552
-
553
-
554
-
555
-
556
-
557
- </h3><div class="docstring">
558
- <div class="discussion">
559
-
560
- <p>Converts standard (ruby/C++/unix/...) strftime formatting to MS's
561
- formatting</p>
562
-
563
-
564
- </div>
565
- </div>
566
- <div class="tags">
567
- <p class="tag_title">Parameters:</p>
568
- <ul class="param">
569
-
570
- <li>
571
-
572
- <span class='name'>numberformat</span>
573
-
574
-
575
- <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
576
-
577
-
578
-
579
- &mdash;
580
- <div class='inline'>
581
- <p>(nil returns nil)</p>
582
- </div>
583
-
584
- </li>
585
-
586
- </ul>
587
-
588
- <p class="tag_title">Returns:</p>
589
- <ul class="return">
590
-
591
- <li>
592
-
593
-
594
- <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
595
-
596
-
597
-
598
- </li>
599
-
600
- </ul>
601
-
602
- </div><table class="source_code">
603
- <tr>
604
- <td>
605
- <pre class="lines">
606
-
607
-
608
- 74
609
- 75
610
- 76
611
- 77</pre>
612
- </td>
613
- <td>
614
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 74</span>
615
-
616
- <span class='kw'>def</span> <span class='id identifier rubyid_strftime_to_ms_format'>strftime_to_ms_format</span> <span class='id identifier rubyid_numberformat'>numberformat</span>
617
- <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_numberformat'>numberformat</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
618
- <span class='kw'>return</span> <span class='id identifier rubyid_numberformat'>numberformat</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%Y</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yyyy</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</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'>dddd</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%B</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mmmm</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</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'>ddd</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%b</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mmm</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%y</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yy</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%d</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dd</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%m</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mm</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%y</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>y</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%y</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%%y</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%e</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>d</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
619
- <span class='kw'>end</span></pre>
620
- </td>
621
- </tr>
622
- </table>
623
- </div>
624
-
625
- <div class="method_details ">
626
- <h3 class="signature " id="to_xls-instance_method">
627
-
628
- - (<tt>Spreadsheet</tt>) <strong>to_xls</strong>(options = {})
629
-
630
-
631
-
632
-
633
-
634
- </h3><div class="docstring">
635
- <div class="discussion">
636
-
637
- <p>Generates an Spreadsheet (from the spreadsheet gem) in order to build an
638
- XlS</p>
639
-
640
-
641
- </div>
642
- </div>
643
- <div class="tags">
644
- <p class="tag_title">Parameters:</p>
645
- <ul class="param">
646
-
647
- <li>
648
-
649
- <span class='name'>options</span>
650
-
651
-
652
- <span class='type'>(<tt>Hash</tt>)</span>
653
-
654
-
655
- <em class="default">(defaults to: <tt>{}</tt>)</em>
656
-
657
-
658
- &mdash;
659
- <div class='inline'>
660
- <p>A hash with options (unused so far)</p>
661
- </div>
662
-
663
- </li>
664
-
665
- </ul>
666
-
667
- <p class="tag_title">Returns:</p>
668
- <ul class="return">
669
-
670
- <li>
671
-
672
-
673
- <span class='type'>(<tt>Spreadsheet</tt>)</span>
674
-
675
-
676
-
677
- &mdash;
678
- <div class='inline'>
679
- <p>A Spreadsheet object, ready for writing or more lower level operations</p>
680
- </div>
681
-
682
- </li>
683
-
684
- </ul>
685
-
686
- </div><table class="source_code">
687
- <tr>
688
- <td>
689
- <pre class="lines">
690
-
691
-
692
- 12
693
- 13
694
- 14
695
- 15
696
- 16
697
- 17
698
- 18
699
- 19
700
- 20
701
- 21
702
- 22
703
- 23
704
- 24
705
- 25
706
- 26
707
- 27
708
- 28
709
- 29
710
- 30
711
- 31
712
- 32</pre>
713
- </td>
714
- <td>
715
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 12</span>
716
-
717
- <span class='kw'>def</span> <span class='id identifier rubyid_to_xls'>to_xls</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
718
- <span class='id identifier rubyid_book'>book</span> <span class='op'>=</span> <span class='id identifier rubyid_init_spreadsheet_template'>init_spreadsheet_template</span>
719
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='comma'>,</span><span class='id identifier rubyid_si'>si</span><span class='op'>|</span>
720
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span> <span class='op'>=</span> <span class='id identifier rubyid_book'>book</span><span class='period'>.</span><span class='id identifier rubyid_worksheet'>worksheet</span> <span class='id identifier rubyid_si'>si</span>
721
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span> <span class='op'>=</span> <span class='id identifier rubyid_book'>book</span><span class='period'>.</span><span class='id identifier rubyid_create_worksheet'>create_worksheet</span> <span class='kw'>if</span> <span class='id identifier rubyid_xls_sheet'>xls_sheet</span> <span class='op'>==</span> <span class='kw'>nil</span>
722
- <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='comma'>,</span> <span class='id identifier rubyid_ri'>ri</span><span class='op'>|</span>
723
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span><span class='period'>.</span><span class='id identifier rubyid_row'>row</span><span class='lparen'>(</span><span class='id identifier rubyid_ri'>ri</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='op'>=</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span><span class='lbracket'>[</span><span class='symbol'>:height</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span>
724
- <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='comma'>,</span> <span class='id identifier rubyid_ci'>ci</span><span class='op'>|</span>
725
- <span class='kw'>if</span> <span class='id identifier rubyid_c'>c</span>
726
- <span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_first?'>first?</span>
727
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='lbracket'>[</span><span class='id identifier rubyid_ci'>ci</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Column</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ci'>ci</span><span class='comma'>,</span><span class='kw'>nil</span><span class='rparen'>)</span>
728
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='lbracket'>[</span><span class='id identifier rubyid_ci'>ci</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span><span class='lbracket'>[</span><span class='symbol'>:width</span><span class='rbracket'>]</span>
729
- <span class='kw'>end</span>
730
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span><span class='period'>.</span><span class='id identifier rubyid_row'>row</span><span class='lparen'>(</span><span class='id identifier rubyid_ri'>ri</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='id identifier rubyid_ci'>ci</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
731
- <span class='id identifier rubyid_xls_sheet'>xls_sheet</span><span class='period'>.</span><span class='id identifier rubyid_row'>row</span><span class='lparen'>(</span><span class='id identifier rubyid_ri'>ri</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_set_format'>set_format</span><span class='lparen'>(</span><span class='id identifier rubyid_ci'>ci</span><span class='comma'>,</span> <span class='id identifier rubyid_format_to_xls_format'>format_to_xls_format</span><span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='rparen'>)</span>
732
- <span class='kw'>end</span>
733
- <span class='kw'>end</span>
734
- <span class='kw'>end</span>
735
- <span class='kw'>end</span>
736
- <span class='id identifier rubyid_book'>book</span>
737
- <span class='kw'>end</span></pre>
738
- </td>
739
- </tr>
740
- </table>
741
- </div>
742
-
743
- <div class="method_details ">
744
- <h3 class="signature " id="write_to_xls-instance_method">
745
-
746
- - (<tt>Object</tt>) <strong>write_to_xls</strong>(filename = &quot;#{title}.xls&quot;, options = {})
747
-
748
-
749
-
750
-
751
-
752
- </h3><div class="docstring">
753
- <div class="discussion">
754
-
755
- <p>Write the current workbook to Microsoft Excel format (using the spreadsheet
756
- gem)</p>
757
-
758
-
759
- </div>
760
- </div>
761
- <div class="tags">
762
- <p class="tag_title">Parameters:</p>
763
- <ul class="param">
764
-
765
- <li>
766
-
767
- <span class='name'>filename</span>
768
-
769
-
770
- <span class='type'>(<tt>String</tt>)</span>
771
-
772
-
773
- <em class="default">(defaults to: <tt>&quot;#{title}.xls&quot;</tt>)</em>
774
-
775
-
776
- </li>
777
-
778
- <li>
779
-
780
- <span class='name'>options</span>
781
-
782
-
783
- <span class='type'>(<tt>Hash</tt>)</span>
784
-
785
-
786
- <em class="default">(defaults to: <tt>{}</tt>)</em>
787
-
788
-
789
- &mdash;
790
- <div class='inline'>
791
- <p>see #to_xls</p>
792
- </div>
793
-
794
- </li>
795
-
796
- </ul>
797
-
798
-
799
- </div><table class="source_code">
800
- <tr>
801
- <td>
802
- <pre class="lines">
803
-
804
-
805
- 83
806
- 84
807
- 85
808
- 86
809
- 87</pre>
810
- </td>
811
- <td>
812
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 83</span>
813
-
814
- <span class='kw'>def</span> <span class='id identifier rubyid_write_to_xls'>write_to_xls</span> <span class='id identifier rubyid_filename'>filename</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_title'>title</span><span class='rbrace'>}</span><span class='tstring_content'>.xls</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
815
- <span class='kw'>if</span> <span class='id identifier rubyid_to_xls'>to_xls</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
816
- <span class='kw'>return</span> <span class='id identifier rubyid_filename'>filename</span>
817
- <span class='kw'>end</span>
818
- <span class='kw'>end</span></pre>
819
- </td>
820
- </tr>
821
- </table>
822
- </div>
823
-
824
- <div class="method_details ">
825
- <h3 class="signature " id="xls_sheet-instance_method">
826
-
827
- - (<tt>Object</tt>) <strong>xls_sheet</strong>(a)
828
-
829
-
830
-
831
-
832
-
833
- </h3><table class="source_code">
834
- <tr>
835
- <td>
836
- <pre class="lines">
837
-
838
-
839
- 89
840
- 90
841
- 91
842
- 92
843
- 93
844
- 94
845
- 95
846
- 96</pre>
847
- </td>
848
- <td>
849
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 89</span>
850
-
851
- <span class='kw'>def</span> <span class='id identifier rubyid_xls_sheet'>xls_sheet</span> <span class='id identifier rubyid_a'>a</span>
852
- <span class='kw'>if</span> <span class='id identifier rubyid_xls_template'>xls_template</span><span class='period'>.</span><span class='id identifier rubyid_worksheet'>worksheet</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
853
- <span class='kw'>return</span> <span class='id identifier rubyid_xls_template'>xls_template</span><span class='period'>.</span><span class='id identifier rubyid_worksheet'>worksheet</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
854
- <span class='kw'>else</span>
855
- <span class='id identifier rubyid_xls_template'>xls_template</span><span class='period'>.</span><span class='id identifier rubyid_create_worksheet'>create_worksheet</span>
856
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_xls_sheet'>xls_sheet</span> <span class='id identifier rubyid_a'>a</span>
857
- <span class='kw'>end</span>
858
- <span class='kw'>end</span></pre>
859
- </td>
860
- </tr>
861
- </table>
862
- </div>
863
-
864
- <div class="method_details ">
865
- <h3 class="signature " id="xls_template-instance_method">
866
-
867
- - (<tt>Object</tt>) <strong>xls_template</strong>
868
-
869
-
870
-
871
-
872
-
873
- </h3><table class="source_code">
874
- <tr>
875
- <td>
876
- <pre class="lines">
877
-
878
-
879
- 98
880
- 99
881
- 100</pre>
882
- </td>
883
- <td>
884
- <pre class="code"><span class="info file"># File 'lib/workbook/writers/xls_writer.rb', line 98</span>
885
-
886
- <span class='kw'>def</span> <span class='id identifier rubyid_xls_template'>xls_template</span>
887
- <span class='kw'>return</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_raws'>raws</span><span class='lbracket'>[</span><span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Excel</span><span class='op'>::</span><span class='const'>Workbook</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_raws'>raws</span><span class='lbracket'>[</span><span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Excel</span><span class='op'>::</span><span class='const'>Workbook</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_raws'>raws</span><span class='lbracket'>[</span><span class='const'>Spreadsheet</span><span class='op'>::</span><span class='const'>Workbook</span><span class='rbracket'>]</span>
888
- <span class='kw'>end</span></pre>
889
- </td>
890
- </tr>
891
- </table>
892
- </div>
893
-
894
- </div>
895
-
896
- </div>
897
-
898
- <div id="footer">
899
- Generated on Sun May 19 23:16:29 2013 by
900
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
901
- 0.8.5.2 (ruby-1.9.3).
902
- </div>
903
-
904
- </body>
905
- </html>