axlsx 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +14 -0
- data/README.md +22 -21
- data/Rakefile +1 -1
- data/axlsx.gemspec +36 -0
- data/doc/Axlsx.html +373 -559
- data/doc/Axlsx/App.html +257 -360
- data/doc/Axlsx/Axis.html +113 -144
- data/doc/Axlsx/Bar3DChart.html +122 -152
- data/doc/Axlsx/BarSeries.html +67 -81
- data/doc/Axlsx/Border.html +96 -119
- data/doc/Axlsx/BorderPr.html +89 -114
- data/doc/Axlsx/CatAxis.html +79 -104
- data/doc/Axlsx/CatAxisData.html +40 -54
- data/doc/Axlsx/Cell.html +193 -679
- data/doc/Axlsx/CellAlignment.html +116 -157
- data/doc/Axlsx/CellProtection.html +50 -68
- data/doc/Axlsx/CellStyle.html +78 -106
- data/doc/Axlsx/Chart.html +361 -432
- data/doc/Axlsx/Color.html +56 -78
- data/doc/Axlsx/ContentType.html +28 -41
- data/doc/Axlsx/Core.html +43 -55
- data/doc/Axlsx/DataTypeValidator.html +34 -43
- data/doc/Axlsx/Default.html +55 -81
- data/doc/Axlsx/Drawing.html +322 -412
- data/doc/Axlsx/Fill.html +34 -47
- data/doc/Axlsx/Font.html +157 -207
- data/doc/Axlsx/GradientFill.html +90 -122
- data/doc/Axlsx/GradientStop.html +36 -50
- data/doc/Axlsx/GraphicFrame.html +106 -130
- data/doc/Axlsx/Line3DChart.html +108 -134
- data/doc/Axlsx/LineSeries.html +58 -67
- data/doc/Axlsx/Marker.html +84 -111
- data/doc/Axlsx/NumFmt.html +83 -102
- data/doc/Axlsx/OneCellAnchor.html +158 -196
- data/doc/Axlsx/Override.html +60 -92
- data/doc/Axlsx/Package.html +190 -759
- data/doc/Axlsx/PatternFill.html +78 -99
- data/doc/Axlsx/Pic.html +451 -405
- data/doc/Axlsx/Pie3DChart.html +33 -42
- data/doc/Axlsx/PieSeries.html +68 -80
- data/doc/Axlsx/RegexValidator.html +15 -20
- data/doc/Axlsx/Relationship.html +49 -66
- data/doc/Axlsx/Relationships.html +28 -41
- data/doc/Axlsx/RestrictionValidator.html +23 -32
- data/doc/Axlsx/Row.html +132 -161
- data/doc/Axlsx/Scaling.html +71 -90
- data/doc/Axlsx/SerAxis.html +61 -79
- data/doc/Axlsx/Series.html +125 -201
- data/doc/Axlsx/SeriesTitle.html +26 -31
- data/doc/Axlsx/Styles.html +286 -355
- data/doc/Axlsx/TableStyle.html +62 -87
- data/doc/Axlsx/TableStyleElement.html +84 -104
- data/doc/Axlsx/TableStyles.html +59 -82
- data/doc/Axlsx/Title.html +58 -155
- data/doc/Axlsx/TwoCellAnchor.html +165 -204
- data/doc/Axlsx/ValAxis.html +39 -53
- data/doc/Axlsx/ValAxisData.html +29 -39
- data/doc/Axlsx/View3D.html +93 -122
- data/doc/Axlsx/Workbook.html +359 -362
- data/doc/Axlsx/Worksheet.html +471 -816
- data/doc/Axlsx/Xf.html +341 -296
- data/doc/_index.html +7 -11
- data/doc/class_list.html +1 -1
- data/doc/file.LICENSE.html +86 -0
- data/doc/file.README.html +105 -107
- data/doc/file_list.html +3 -0
- data/doc/frames.html +1 -1
- data/doc/index.html +105 -107
- data/doc/method_list.html +426 -602
- data/doc/top-level-namespace.html +3 -3
- data/examples/example.rb +20 -1
- data/lib/axlsx.rb +20 -15
- data/lib/axlsx/content_type/default.rb +8 -3
- data/lib/axlsx/content_type/override.rb +11 -4
- data/lib/axlsx/doc_props/app.rb +53 -23
- data/lib/axlsx/drawing/axis.rb +16 -5
- data/lib/axlsx/drawing/bar_3D_chart.rb +15 -7
- data/lib/axlsx/drawing/bar_series.rb +7 -5
- data/lib/axlsx/drawing/cat_axis.rb +10 -3
- data/lib/axlsx/drawing/chart.rb +21 -15
- data/lib/axlsx/drawing/drawing.rb +16 -30
- data/lib/axlsx/drawing/graphic_frame.rb +2 -4
- data/lib/axlsx/drawing/line_3D_chart.rb +5 -2
- data/lib/axlsx/drawing/line_series.rb +6 -5
- data/lib/axlsx/drawing/marker.rb +9 -5
- data/lib/axlsx/drawing/one_cell_anchor.rb +7 -7
- data/lib/axlsx/drawing/pic.rb +29 -37
- data/lib/axlsx/drawing/pie_series.rb +7 -5
- data/lib/axlsx/drawing/scaling.rb +11 -5
- data/lib/axlsx/drawing/ser_axis.rb +6 -2
- data/lib/axlsx/drawing/series.rb +11 -11
- data/lib/axlsx/drawing/series_title.rb +1 -1
- data/lib/axlsx/drawing/title.rb +5 -12
- data/lib/axlsx/drawing/two_cell_anchor.rb +2 -3
- data/lib/axlsx/drawing/val_axis.rb +2 -2
- data/lib/axlsx/drawing/view_3D.rb +16 -9
- data/lib/axlsx/package.rb +25 -27
- data/lib/axlsx/rels/relationship.rb +4 -2
- data/lib/axlsx/stylesheet/border.rb +9 -4
- data/lib/axlsx/stylesheet/border_pr.rb +7 -4
- data/lib/axlsx/stylesheet/cell_alignment.rb +18 -9
- data/lib/axlsx/stylesheet/cell_protection.rb +5 -2
- data/lib/axlsx/stylesheet/cell_style.rb +12 -7
- data/lib/axlsx/stylesheet/color.rb +8 -6
- data/lib/axlsx/stylesheet/fill.rb +2 -1
- data/lib/axlsx/stylesheet/font.rb +24 -13
- data/lib/axlsx/stylesheet/gradient_fill.rb +16 -10
- data/lib/axlsx/stylesheet/gradient_stop.rb +5 -3
- data/lib/axlsx/stylesheet/num_fmt.rb +4 -2
- data/lib/axlsx/stylesheet/pattern_fill.rb +6 -4
- data/lib/axlsx/stylesheet/styles.rb +12 -12
- data/lib/axlsx/stylesheet/table_style.rb +6 -3
- data/lib/axlsx/stylesheet/table_style_element.rb +9 -4
- data/lib/axlsx/stylesheet/table_styles.rb +4 -4
- data/lib/axlsx/stylesheet/xf.rb +52 -31
- data/lib/axlsx/util/validators.rb +3 -3
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +8 -9
- data/lib/axlsx/workbook/worksheet/cell.rb +25 -16
- data/lib/axlsx/workbook/worksheet/row.rb +2 -4
- data/lib/axlsx/workbook/worksheet/worksheet.rb +23 -32
- data/test/drawing/tc_one_cell_anchor.rb +1 -1
- metadata +135 -165
- data/doc/Axlsx/SimpleTypedList.html +0 -1686
- data/lib/schema/dc.xsd~ +0 -118
- data/lib/schema/dcterms.xsd~ +0 -331
- data/lib/schema/opc-coreProperties.xsd~ +0 -50
- data/test/drawing/tc_line_series.tc~ +0 -34
data/doc/Axlsx/CatAxisData.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Axlsx::CatAxisData
|
|
8
8
|
|
|
9
|
-
—
|
|
9
|
+
— AXLSX
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -96,9 +96,8 @@
|
|
|
96
96
|
|
|
97
97
|
<h2>Overview</h2><div class="docstring">
|
|
98
98
|
<div class="discussion">
|
|
99
|
-
|
|
100
|
-
The CatAxisData class serializes the category axis data for a chart
|
|
101
|
-
</p>
|
|
99
|
+
|
|
100
|
+
<p>The CatAxisData class serializes the category axis data for a chart</p>
|
|
102
101
|
|
|
103
102
|
|
|
104
103
|
</div>
|
|
@@ -153,9 +152,8 @@ The CatAxisData class serializes the category axis data for a chart
|
|
|
153
152
|
|
|
154
153
|
|
|
155
154
|
|
|
156
|
-
<span class="summary_desc"><div class='inline'
|
|
157
|
-
Create a new CatAxisData object
|
|
158
|
-
</p>
|
|
155
|
+
<span class="summary_desc"><div class='inline'>
|
|
156
|
+
<p>Create a new CatAxisData object.</p>
|
|
159
157
|
</div></span>
|
|
160
158
|
|
|
161
159
|
</li>
|
|
@@ -177,9 +175,8 @@ Create a new CatAxisData object.
|
|
|
177
175
|
|
|
178
176
|
|
|
179
177
|
|
|
180
|
-
<span class="summary_desc"><div class='inline'
|
|
181
|
-
Serializes the category axis data
|
|
182
|
-
</p>
|
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
|
179
|
+
<p>Serializes the category axis data.</p>
|
|
183
180
|
</div></span>
|
|
184
181
|
|
|
185
182
|
</li>
|
|
@@ -193,12 +190,7 @@ Serializes the category axis data.
|
|
|
193
190
|
|
|
194
191
|
|
|
195
192
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="SimpleTypedList.html" title="Axlsx::SimpleTypedList (class)">SimpleTypedList</a></span></h3>
|
|
200
|
-
<p class="inherited"><span class='object_link'><a href="SimpleTypedList.html#%3C%3C-instance_method" title="Axlsx::SimpleTypedList#<< (method)">#<<</a></span>, <span class='object_link'><a href="SimpleTypedList.html#%3D%3D-instance_method" title="Axlsx::SimpleTypedList#== (method)">#==</a></span>, <span class='object_link'><a href="SimpleTypedList.html#%5B%5D%3D-instance_method" title="Axlsx::SimpleTypedList#[]= (method)">#[]=</a></span>, <span class='object_link'><a href="SimpleTypedList.html#delete-instance_method" title="Axlsx::SimpleTypedList#delete (method)">#delete</a></span>, <span class='object_link'><a href="SimpleTypedList.html#delete_at-instance_method" title="Axlsx::SimpleTypedList#delete_at (method)">#delete_at</a></span>, <span class='object_link'><a href="SimpleTypedList.html#lock-instance_method" title="Axlsx::SimpleTypedList#lock (method)">#lock</a></span>, <span class='object_link'><a href="SimpleTypedList.html#method_missing-instance_method" title="Axlsx::SimpleTypedList#method_missing (method)">#method_missing</a></span>, <span class='object_link'><a href="SimpleTypedList.html#protected%3F-instance_method" title="Axlsx::SimpleTypedList#protected? (method)">#protected?</a></span>, <span class='object_link'><a href="SimpleTypedList.html#push-instance_method" title="Axlsx::SimpleTypedList#push (method)">#push</a></span>, <span class='object_link'><a href="SimpleTypedList.html#unlock-instance_method" title="Axlsx::SimpleTypedList#unlock (method)">#unlock</a></span></p>
|
|
201
|
-
<div id="constructor_details" class="method_details_list">
|
|
193
|
+
<div id="constructor_details" class="method_details_list">
|
|
202
194
|
<h2>Constructor Details</h2>
|
|
203
195
|
|
|
204
196
|
<div class="method_details first">
|
|
@@ -210,9 +202,8 @@ Serializes the category axis data.
|
|
|
210
202
|
|
|
211
203
|
</p><div class="docstring">
|
|
212
204
|
<div class="discussion">
|
|
213
|
-
|
|
214
|
-
Create a new CatAxisData object
|
|
215
|
-
</p>
|
|
205
|
+
|
|
206
|
+
<p>Create a new CatAxisData object</p>
|
|
216
207
|
|
|
217
208
|
|
|
218
209
|
</div>
|
|
@@ -233,10 +224,9 @@ Create a new CatAxisData object
|
|
|
233
224
|
|
|
234
225
|
|
|
235
226
|
—
|
|
236
|
-
<div class='inline'
|
|
237
|
-
the data for this category axis. This can be a simple array or a simple
|
|
238
|
-
typed list of cells
|
|
239
|
-
</p>
|
|
227
|
+
<div class='inline'>
|
|
228
|
+
<p>the data for this category axis. This can be a simple array or a simple
|
|
229
|
+
typed list of cells.</p>
|
|
240
230
|
</div>
|
|
241
231
|
|
|
242
232
|
</li>
|
|
@@ -259,12 +249,11 @@ typed list of cells.
|
|
|
259
249
|
<td>
|
|
260
250
|
<pre class="code"><span class="info file"># File 'lib/axlsx/drawing/cat_axis_data.rb', line 7</span>
|
|
261
251
|
|
|
262
|
-
<span class='
|
|
263
|
-
<span class='
|
|
264
|
-
<span class='
|
|
265
|
-
<span class='data
|
|
266
|
-
<span class='
|
|
267
|
-
</pre>
|
|
252
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id data'>data</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
253
|
+
<span class='kw'>super</span> <span class='const'>Object</span>
|
|
254
|
+
<span class='ivar'>@list</span><span class='period'>.</span><span class='id concat'>concat</span> <span class='id data'>data</span> <span class='kw'>if</span> <span class='id data'>data</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
|
|
255
|
+
<span class='id data'>data</span><span class='period'>.</span><span class='id each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id i'>i</span><span class='op'>|</span> <span class='ivar'>@list</span> <span class='op'><<</span> <span class='id i'>i</span> <span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id data'>data</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>SimpleTypedList</span><span class='rparen'>)</span>
|
|
256
|
+
<span class='kw'>end</span></pre>
|
|
268
257
|
</td>
|
|
269
258
|
</tr>
|
|
270
259
|
</table>
|
|
@@ -296,9 +285,8 @@ typed list of cells.
|
|
|
296
285
|
|
|
297
286
|
</p><div class="docstring">
|
|
298
287
|
<div class="discussion">
|
|
299
|
-
|
|
300
|
-
Serializes the category axis data
|
|
301
|
-
</p>
|
|
288
|
+
|
|
289
|
+
<p>Serializes the category axis data</p>
|
|
302
290
|
|
|
303
291
|
|
|
304
292
|
</div>
|
|
@@ -317,9 +305,8 @@ Serializes the category axis data
|
|
|
317
305
|
|
|
318
306
|
|
|
319
307
|
—
|
|
320
|
-
<div class='inline'
|
|
321
|
-
The document builder instance this objects xml will be added to
|
|
322
|
-
</p>
|
|
308
|
+
<div class='inline'>
|
|
309
|
+
<p>The document builder instance this objects xml will be added to.</p>
|
|
323
310
|
</div>
|
|
324
311
|
|
|
325
312
|
</li>
|
|
@@ -366,23 +353,22 @@ The document builder instance this objects xml will be added to.
|
|
|
366
353
|
<td>
|
|
367
354
|
<pre class="code"><span class="info file"># File 'lib/axlsx/drawing/cat_axis_data.rb', line 16</span>
|
|
368
355
|
|
|
369
|
-
<span class='
|
|
370
|
-
<span class='xml
|
|
371
|
-
<span class='xml
|
|
372
|
-
<span class='xml
|
|
373
|
-
<span class='xml
|
|
374
|
-
<span class='xml
|
|
375
|
-
<span class='each_with_index
|
|
376
|
-
<span class='v
|
|
377
|
-
<span class='xml
|
|
378
|
-
<span class='xml
|
|
379
|
-
<span class='rbrace
|
|
380
|
-
<span class='
|
|
381
|
-
<span class='rbrace
|
|
382
|
-
<span class='rbrace
|
|
383
|
-
<span class='rbrace
|
|
384
|
-
<span class='
|
|
385
|
-
</pre>
|
|
356
|
+
<span class='kw'>def</span> <span class='id to_xml'>to_xml</span><span class='lparen'>(</span><span class='id xml'>xml</span><span class='rparen'>)</span>
|
|
357
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:cat</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
358
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:strRef</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
359
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:f</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>Axlsx</span><span class='op'>::</span><span class='id cell_range'>cell_range</span><span class='lparen'>(</span><span class='ivar'>@list</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
360
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:strCache</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
361
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:ptCount</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:val</span><span class='op'>=></span><span class='id size'>size</span><span class='rparen'>)</span>
|
|
362
|
+
<span class='id each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id item'>item</span><span class='comma'>,</span> <span class='id index'>index</span><span class='op'>|</span>
|
|
363
|
+
<span class='id v'>v</span> <span class='op'>=</span> <span class='id item'>item</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Cell</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id item'>item</span><span class='period'>.</span><span class='id value'>value</span> <span class='op'>:</span> <span class='id item'>item</span>
|
|
364
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:pt</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:idx</span><span class='op'>=></span><span class='id index'>index</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
365
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>c:v</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id v'>v</span><span class='rparen'>)</span>
|
|
366
|
+
<span class='rbrace'>}</span>
|
|
367
|
+
<span class='kw'>end</span>
|
|
368
|
+
<span class='rbrace'>}</span>
|
|
369
|
+
<span class='rbrace'>}</span>
|
|
370
|
+
<span class='rbrace'>}</span>
|
|
371
|
+
<span class='kw'>end</span></pre>
|
|
386
372
|
</td>
|
|
387
373
|
</tr>
|
|
388
374
|
</table>
|
|
@@ -393,9 +379,9 @@ The document builder instance this objects xml will be added to.
|
|
|
393
379
|
</div>
|
|
394
380
|
|
|
395
381
|
<div id="footer">
|
|
396
|
-
Generated on
|
|
382
|
+
Generated on Sat Nov 26 13:16:39 2011 by
|
|
397
383
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
398
|
-
0.7.3 (ruby-1.
|
|
384
|
+
0.7.3 (ruby-1.9.3).
|
|
399
385
|
</div>
|
|
400
386
|
|
|
401
387
|
</body>
|
data/doc/Axlsx/Cell.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Axlsx::Cell
|
|
8
8
|
|
|
9
|
-
—
|
|
9
|
+
— AXLSX
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -97,22 +97,20 @@
|
|
|
97
97
|
|
|
98
98
|
<div class="note notetag">
|
|
99
99
|
<strong>Note:</strong>
|
|
100
|
-
<div class='inline'
|
|
101
|
-
The recommended way to generate cells is via Worksheet#add_row
|
|
102
|
-
</p>
|
|
100
|
+
<div class='inline'>
|
|
101
|
+
<p>The recommended way to generate cells is via Worksheet#add_row</p>
|
|
103
102
|
</div>
|
|
104
103
|
</div>
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
A cell in a worksheet.
|
|
105
|
+
|
|
106
|
+
<p>A cell in a worksheet. Cell stores inforamation requried to serialize a
|
|
108
107
|
single worksheet cell to xml. You must provde the Row that the cell belongs
|
|
109
108
|
to and the cells value. The data type will automatically be determed if you
|
|
110
109
|
do not specify the :type option. The default style will be applied if you
|
|
111
|
-
do not supply the :style option. Changing the cell
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</p>
|
|
110
|
+
do not supply the :style option. Changing the cell's type will recast the
|
|
111
|
+
value to the type specified. Altering the cell's value via the property
|
|
112
|
+
accessor will also automatically cast the provided value to the cell's
|
|
113
|
+
type.</p>
|
|
116
114
|
|
|
117
115
|
|
|
118
116
|
</div>
|
|
@@ -122,25 +120,23 @@ cell’s type.
|
|
|
122
120
|
<div class="examples">
|
|
123
121
|
<h3>Examples:</h3>
|
|
124
122
|
|
|
125
|
-
<h4><div class='inline'
|
|
126
|
-
Manually creating and manipulating Cell objects
|
|
127
|
-
</p>
|
|
123
|
+
<h4><div class='inline'>
|
|
124
|
+
<p>Manually creating and manipulating Cell objects</p>
|
|
128
125
|
</div></h4>
|
|
129
|
-
<pre class="example code"><span class='ws
|
|
130
|
-
<span class='comment
|
|
131
|
-
|
|
126
|
+
<pre class="example code"><span class='id ws'>ws</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='period'>.</span><span class='id new'>new</span><span class='period'>.</span><span class='id add_worksheet'>add_worksheet</span>
|
|
127
|
+
<span class='comment'># This is the simple, and recommended way to create cells. Data types will automatically be determined for you.
|
|
128
|
+
</span><span class='id ws'>ws</span><span class='period'>.</span><span class='id add_row'>add_row</span> <span class='symbol'>:values</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>fish</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span><span class='rbracket'>]</span>
|
|
132
129
|
|
|
133
|
-
<span class='comment
|
|
134
|
-
|
|
135
|
-
<span class='r
|
|
130
|
+
<span class='comment'># but you can also do this
|
|
131
|
+
</span><span class='id r'>r</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id add_row'>add_row</span>
|
|
132
|
+
<span class='id r'>r</span><span class='period'>.</span><span class='id add_cell'>add_cell</span> <span class='int'>1</span>
|
|
136
133
|
|
|
137
|
-
<span class='comment
|
|
138
|
-
|
|
139
|
-
<span class='c
|
|
134
|
+
<span class='comment'># or even this
|
|
135
|
+
</span><span class='id r'>r</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id add_row'>add_row</span>
|
|
136
|
+
<span class='id c'>c</span> <span class='op'>=</span> <span class='const'>Cell</span><span class='period'>.</span><span class='id new'>new</span> <span class='id row'>row</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:value</span><span class='op'>=></span><span class='id integer'>integer</span>
|
|
140
137
|
|
|
141
|
-
<span class='comment
|
|
142
|
-
|
|
143
|
-
</pre>
|
|
138
|
+
<span class='comment'># cells can also be accessed via Row#cells. The example here changes the cells type, which will automatically updated the value from 1 to 1.0
|
|
139
|
+
</span><span class='id r'>r</span><span class='period'>.</span><span class='id cells'>cells</span><span class='period'>.</span><span class='id last'>last</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>=</span> <span class='symbol'>:float</span></pre>
|
|
144
140
|
|
|
145
141
|
</div>
|
|
146
142
|
|
|
@@ -176,9 +172,8 @@ Manually creating and manipulating Cell objects
|
|
|
176
172
|
|
|
177
173
|
|
|
178
174
|
|
|
179
|
-
<span class="summary_desc"><div class='inline'
|
|
180
|
-
The row this cell belongs to
|
|
181
|
-
</p>
|
|
175
|
+
<span class="summary_desc"><div class='inline'>
|
|
176
|
+
<p>The row this cell belongs to.</p>
|
|
182
177
|
</div></span>
|
|
183
178
|
|
|
184
179
|
</li>
|
|
@@ -203,9 +198,8 @@ The row this cell belongs to.
|
|
|
203
198
|
|
|
204
199
|
|
|
205
200
|
|
|
206
|
-
<span class="summary_desc"><div class='inline'
|
|
207
|
-
The index of the cellXfs item to be applied to this cell
|
|
208
|
-
</p>
|
|
201
|
+
<span class="summary_desc"><div class='inline'>
|
|
202
|
+
<p>The index of the cellXfs item to be applied to this cell.</p>
|
|
209
203
|
</div></span>
|
|
210
204
|
|
|
211
205
|
</li>
|
|
@@ -230,9 +224,8 @@ The index of the cellXfs item to be applied to this cell.
|
|
|
230
224
|
|
|
231
225
|
|
|
232
226
|
|
|
233
|
-
<span class="summary_desc"><div class='inline'
|
|
234
|
-
The cell
|
|
235
|
-
</p>
|
|
227
|
+
<span class="summary_desc"><div class='inline'>
|
|
228
|
+
<p>The cell's data type.</p>
|
|
236
229
|
</div></span>
|
|
237
230
|
|
|
238
231
|
</li>
|
|
@@ -257,9 +250,8 @@ The cell’s data type.
|
|
|
257
250
|
|
|
258
251
|
|
|
259
252
|
|
|
260
|
-
<span class="summary_desc"><div class='inline'
|
|
261
|
-
The value of this cell
|
|
262
|
-
</p>
|
|
253
|
+
<span class="summary_desc"><div class='inline'>
|
|
254
|
+
<p>The value of this cell.</p>
|
|
263
255
|
</div></span>
|
|
264
256
|
|
|
265
257
|
</li>
|
|
@@ -281,78 +273,6 @@ The value of this cell.
|
|
|
281
273
|
<li class="public ">
|
|
282
274
|
<span class="summary_signature">
|
|
283
275
|
|
|
284
|
-
<a href="#cast_value-instance_method" title="#cast_value (instance method)">- (Object) <strong>cast_value</strong>(v) </a>
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
</span>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<span class="summary_desc"><div class='inline'><p>
|
|
298
|
-
Cast the value into this cells data type.
|
|
299
|
-
</p>
|
|
300
|
-
</div></span>
|
|
301
|
-
|
|
302
|
-
</li>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<li class="public ">
|
|
306
|
-
<span class="summary_signature">
|
|
307
|
-
|
|
308
|
-
<a href="#cell_type_from_value-instance_method" title="#cell_type_from_value (instance method)">- (Symbol) <strong>cell_type_from_value</strong>(v) </a>
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
</span>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
<span class="summary_desc"><div class='inline'><p>
|
|
322
|
-
Determines the cell type based on the cell value.
|
|
323
|
-
</p>
|
|
324
|
-
</div></span>
|
|
325
|
-
|
|
326
|
-
</li>
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
<li class="public ">
|
|
330
|
-
<span class="summary_signature">
|
|
331
|
-
|
|
332
|
-
<a href="#col_ref-instance_method" title="#col_ref (instance method)">- (String) <strong>col_ref</strong> </a>
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
</span>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
<span class="summary_desc"><div class='inline'><p>
|
|
346
|
-
converts the column index into alphabetical values.
|
|
347
|
-
</p>
|
|
348
|
-
</div></span>
|
|
349
|
-
|
|
350
|
-
</li>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<li class="public ">
|
|
354
|
-
<span class="summary_signature">
|
|
355
|
-
|
|
356
276
|
<a href="#index-instance_method" title="#index (instance method)">- (Integer) <strong>index</strong> </a>
|
|
357
277
|
|
|
358
278
|
|
|
@@ -366,9 +286,8 @@ converts the column index into alphabetical values.
|
|
|
366
286
|
|
|
367
287
|
|
|
368
288
|
|
|
369
|
-
<span class="summary_desc"><div class='inline'
|
|
370
|
-
The index of the cell in the containing row
|
|
371
|
-
</p>
|
|
289
|
+
<span class="summary_desc"><div class='inline'>
|
|
290
|
+
<p>The index of the cell in the containing row.</p>
|
|
372
291
|
</div></span>
|
|
373
292
|
|
|
374
293
|
</li>
|
|
@@ -392,9 +311,8 @@ The index of the cell in the containing row.
|
|
|
392
311
|
|
|
393
312
|
|
|
394
313
|
|
|
395
|
-
<span class="summary_desc"><div class='inline'
|
|
396
|
-
A new instance of Cell
|
|
397
|
-
</p>
|
|
314
|
+
<span class="summary_desc"><div class='inline'>
|
|
315
|
+
<p>A new instance of Cell.</p>
|
|
398
316
|
</div></span>
|
|
399
317
|
|
|
400
318
|
</li>
|
|
@@ -416,9 +334,8 @@ A new instance of Cell.
|
|
|
416
334
|
|
|
417
335
|
|
|
418
336
|
|
|
419
|
-
<span class="summary_desc"><div class='inline'
|
|
420
|
-
The alpha(column)numeric(row) reference for this sell
|
|
421
|
-
</p>
|
|
337
|
+
<span class="summary_desc"><div class='inline'>
|
|
338
|
+
<p>The alpha(column)numeric(row) reference for this sell.</p>
|
|
422
339
|
</div></span>
|
|
423
340
|
|
|
424
341
|
</li>
|
|
@@ -440,9 +357,8 @@ The alpha(column)numeric(row) reference for this sell.
|
|
|
440
357
|
|
|
441
358
|
|
|
442
359
|
|
|
443
|
-
<span class="summary_desc"><div class='inline'
|
|
444
|
-
The absolute alpha(column)numeric(row) reference for this sell
|
|
445
|
-
</p>
|
|
360
|
+
<span class="summary_desc"><div class='inline'>
|
|
361
|
+
<p>The absolute alpha(column)numeric(row) reference for this sell.</p>
|
|
446
362
|
</div></span>
|
|
447
363
|
|
|
448
364
|
</li>
|
|
@@ -464,9 +380,8 @@ The absolute alpha(column)numeric(row) reference for this sell.
|
|
|
464
380
|
|
|
465
381
|
|
|
466
382
|
|
|
467
|
-
<span class="summary_desc"><div class='inline'
|
|
468
|
-
Serializes the cell
|
|
469
|
-
</p>
|
|
383
|
+
<span class="summary_desc"><div class='inline'>
|
|
384
|
+
<p>Serializes the cell.</p>
|
|
470
385
|
</div></span>
|
|
471
386
|
|
|
472
387
|
</li>
|
|
@@ -487,9 +402,8 @@ Serializes the cell.
|
|
|
487
402
|
|
|
488
403
|
</p><div class="docstring">
|
|
489
404
|
<div class="discussion">
|
|
490
|
-
|
|
491
|
-
A new instance of Cell
|
|
492
|
-
</p>
|
|
405
|
+
|
|
406
|
+
<p>A new instance of Cell</p>
|
|
493
407
|
|
|
494
408
|
|
|
495
409
|
</div>
|
|
@@ -508,9 +422,8 @@ A new instance of Cell
|
|
|
508
422
|
|
|
509
423
|
|
|
510
424
|
—
|
|
511
|
-
<div class='inline'
|
|
512
|
-
The row this cell belongs to
|
|
513
|
-
</p>
|
|
425
|
+
<div class='inline'>
|
|
426
|
+
<p>The row this cell belongs to.</p>
|
|
514
427
|
</div>
|
|
515
428
|
|
|
516
429
|
</li>
|
|
@@ -527,9 +440,8 @@ The row this cell belongs to.
|
|
|
527
440
|
|
|
528
441
|
|
|
529
442
|
—
|
|
530
|
-
<div class='inline'
|
|
531
|
-
The value associated with this cell
|
|
532
|
-
</p>
|
|
443
|
+
<div class='inline'>
|
|
444
|
+
<p>The value associated with this cell.</p>
|
|
533
445
|
</div>
|
|
534
446
|
|
|
535
447
|
</li>
|
|
@@ -546,9 +458,8 @@ The value associated with this cell.
|
|
|
546
458
|
|
|
547
459
|
|
|
548
460
|
—
|
|
549
|
-
<div class='inline'
|
|
550
|
-
a customizable set of options
|
|
551
|
-
</p>
|
|
461
|
+
<div class='inline'>
|
|
462
|
+
<p>a customizable set of options</p>
|
|
552
463
|
</div>
|
|
553
464
|
|
|
554
465
|
</li>
|
|
@@ -571,10 +482,9 @@ a customizable set of options
|
|
|
571
482
|
<span class="default">
|
|
572
483
|
|
|
573
484
|
</span>
|
|
574
|
-
— <div class='inline'
|
|
575
|
-
The intended data type for this cell. If not specified the data type will
|
|
576
|
-
be determined internally based on the vlue provided
|
|
577
|
-
</p>
|
|
485
|
+
— <div class='inline'>
|
|
486
|
+
<p>The intended data type for this cell. If not specified the data type will
|
|
487
|
+
be determined internally based on the vlue provided.</p>
|
|
578
488
|
</div>
|
|
579
489
|
</li>
|
|
580
490
|
|
|
@@ -584,10 +494,9 @@ be determined internally based on the vlue provided.
|
|
|
584
494
|
<span class="default">
|
|
585
495
|
|
|
586
496
|
</span>
|
|
587
|
-
— <div class='inline'
|
|
588
|
-
The index of the cellXfs item to be applied to this cell. If not specified,
|
|
589
|
-
the default style (0) will be applied
|
|
590
|
-
</p>
|
|
497
|
+
— <div class='inline'>
|
|
498
|
+
<p>The index of the cellXfs item to be applied to this cell. If not specified,
|
|
499
|
+
the default style (0) will be applied.</p>
|
|
591
500
|
</div>
|
|
592
501
|
</li>
|
|
593
502
|
|
|
@@ -601,29 +510,28 @@ the default style (0) will be applied.
|
|
|
601
510
|
<pre class="lines">
|
|
602
511
|
|
|
603
512
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
513
|
+
69
|
|
514
|
+
70
|
|
515
|
+
71
|
|
516
|
+
72
|
|
517
|
+
73
|
|
518
|
+
74
|
|
519
|
+
75
|
|
520
|
+
76
|
|
521
|
+
77</pre>
|
|
613
522
|
</td>
|
|
614
523
|
<td>
|
|
615
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
616
|
-
|
|
617
|
-
<span class='
|
|
618
|
-
<span class='
|
|
619
|
-
<span class='comment
|
|
620
|
-
<span class='
|
|
621
|
-
<span class='
|
|
622
|
-
<span class='
|
|
623
|
-
<span class='
|
|
624
|
-
<span class='
|
|
625
|
-
<span class='
|
|
626
|
-
</pre>
|
|
524
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 69</span>
|
|
525
|
+
|
|
526
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id row'>row</span><span class='comma'>,</span> <span class='id value'>value</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
527
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id row'>row</span><span class='op'>=</span><span class='id row'>row</span>
|
|
528
|
+
<span class='comment'>#reference for validation
|
|
529
|
+
</span> <span class='ivar'>@styles</span> <span class='op'>=</span> <span class='id row'>row</span><span class='period'>.</span><span class='id worksheet'>worksheet</span><span class='period'>.</span><span class='id workbook'>workbook</span><span class='period'>.</span><span class='id styles'>styles</span>
|
|
530
|
+
<span class='ivar'>@type</span><span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id cell_type_from_value'>cell_type_from_value</span><span class='lparen'>(</span><span class='id value'>value</span><span class='rparen'>)</span>
|
|
531
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id style'>style</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:style</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>0</span>
|
|
532
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id cast_value'>cast_value</span><span class='lparen'>(</span><span class='id value'>value</span><span class='rparen'>)</span>
|
|
533
|
+
<span class='ivar'>@row</span><span class='period'>.</span><span class='id cells'>cells</span> <span class='op'><<</span> <span class='kw'>self</span>
|
|
534
|
+
<span class='kw'>end</span></pre>
|
|
627
535
|
</td>
|
|
628
536
|
</tr>
|
|
629
537
|
</table>
|
|
@@ -646,9 +554,8 @@ the default style (0) will be applied.
|
|
|
646
554
|
|
|
647
555
|
</p><div class="docstring">
|
|
648
556
|
<div class="discussion">
|
|
649
|
-
|
|
650
|
-
The row this cell belongs to
|
|
651
|
-
</p>
|
|
557
|
+
|
|
558
|
+
<p>The row this cell belongs to.</p>
|
|
652
559
|
|
|
653
560
|
|
|
654
561
|
</div>
|
|
@@ -675,17 +582,16 @@ The row this cell belongs to.
|
|
|
675
582
|
<pre class="lines">
|
|
676
583
|
|
|
677
584
|
|
|
678
|
-
32
|
|
679
585
|
33
|
|
680
|
-
34
|
|
586
|
+
34
|
|
587
|
+
35</pre>
|
|
681
588
|
</td>
|
|
682
589
|
<td>
|
|
683
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
590
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 33</span>
|
|
684
591
|
|
|
685
|
-
<span class='
|
|
686
|
-
<span class='
|
|
687
|
-
<span class='
|
|
688
|
-
</pre>
|
|
592
|
+
<span class='kw'>def</span> <span class='id row'>row</span>
|
|
593
|
+
<span class='ivar'>@row</span>
|
|
594
|
+
<span class='kw'>end</span></pre>
|
|
689
595
|
</td>
|
|
690
596
|
</tr>
|
|
691
597
|
</table>
|
|
@@ -703,9 +609,8 @@ The row this cell belongs to.
|
|
|
703
609
|
|
|
704
610
|
</p><div class="docstring">
|
|
705
611
|
<div class="discussion">
|
|
706
|
-
|
|
707
|
-
The index of the cellXfs item to be applied to this cell
|
|
708
|
-
</p>
|
|
612
|
+
|
|
613
|
+
<p>The index of the cellXfs item to be applied to this cell.</p>
|
|
709
614
|
|
|
710
615
|
|
|
711
616
|
</div>
|
|
@@ -739,17 +644,16 @@ The index of the cellXfs item to be applied to this cell.
|
|
|
739
644
|
<pre class="lines">
|
|
740
645
|
|
|
741
646
|
|
|
742
|
-
28
|
|
743
647
|
29
|
|
744
|
-
30
|
|
648
|
+
30
|
|
649
|
+
31</pre>
|
|
745
650
|
</td>
|
|
746
651
|
<td>
|
|
747
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
652
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 29</span>
|
|
748
653
|
|
|
749
|
-
<span class='
|
|
750
|
-
<span class='
|
|
751
|
-
<span class='
|
|
752
|
-
</pre>
|
|
654
|
+
<span class='kw'>def</span> <span class='id style'>style</span>
|
|
655
|
+
<span class='ivar'>@style</span>
|
|
656
|
+
<span class='kw'>end</span></pre>
|
|
753
657
|
</td>
|
|
754
658
|
</tr>
|
|
755
659
|
</table>
|
|
@@ -770,26 +674,22 @@ The index of the cellXfs item to be applied to this cell.
|
|
|
770
674
|
|
|
771
675
|
<div class="note notetag">
|
|
772
676
|
<strong>Note:</strong>
|
|
773
|
-
<div class='inline'
|
|
774
|
-
If the value provided cannot be cast into the type specified, type is
|
|
775
|
-
changed to :string and the following logic is applied
|
|
776
|
-
|
|
777
|
-
<pre class="code"
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
<p>
|
|
782
|
-
No support is currently implemented for parsing time strings.
|
|
783
|
-
</p>
|
|
677
|
+
<div class='inline'>
|
|
678
|
+
<p>If the value provided cannot be cast into the type specified, type is
|
|
679
|
+
changed to :string and the following logic is applied.</p>
|
|
680
|
+
|
|
681
|
+
<pre class="code">:string to :integer or :float, type coversions always return 0 or 0.0
|
|
682
|
+
:string, :integer, or :float to :time conversions always return the original value as a string and set the cells type to :string.</pre>
|
|
683
|
+
|
|
684
|
+
<p>No support is currently implemented for parsing time strings.</p>
|
|
784
685
|
</div>
|
|
785
686
|
</div>
|
|
786
687
|
|
|
787
|
-
|
|
788
|
-
The cell
|
|
688
|
+
|
|
689
|
+
<p>The cell's data type. Currently only four types are supported, :time,
|
|
789
690
|
:float, :integer and :string. Changing the type for a cell will recast the
|
|
790
691
|
value into that type. If no type option is specified in the constructor,
|
|
791
|
-
the type is
|
|
792
|
-
</p>
|
|
692
|
+
the type is automatically determed.</p>
|
|
793
693
|
|
|
794
694
|
|
|
795
695
|
</div>
|
|
@@ -807,9 +707,8 @@ the type is automatically determed.
|
|
|
807
707
|
|
|
808
708
|
|
|
809
709
|
—
|
|
810
|
-
<div class='inline'
|
|
811
|
-
The type of data this cell
|
|
812
|
-
</p>
|
|
710
|
+
<div class='inline'>
|
|
711
|
+
<p>The type of data this cell’s value is cast to.</p>
|
|
813
712
|
</div>
|
|
814
713
|
|
|
815
714
|
</li>
|
|
@@ -826,9 +725,8 @@ The type of data this cell’s value is cast to.
|
|
|
826
725
|
|
|
827
726
|
|
|
828
727
|
—
|
|
829
|
-
<div class='inline'
|
|
830
|
-
Cell.type must be one of [:time, :float, :integer, :string]
|
|
831
|
-
</p>
|
|
728
|
+
<div class='inline'>
|
|
729
|
+
<p>Cell.type must be one of [:time, :float, :integer, :string]</p>
|
|
832
730
|
</div>
|
|
833
731
|
|
|
834
732
|
</li>
|
|
@@ -855,10 +753,9 @@ Cell.type must be one of [:time, :float, :integer, :string]
|
|
|
855
753
|
<td>
|
|
856
754
|
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 46</span>
|
|
857
755
|
|
|
858
|
-
<span class='
|
|
859
|
-
<span class='
|
|
860
|
-
<span class='
|
|
861
|
-
</pre>
|
|
756
|
+
<span class='kw'>def</span> <span class='id type'>type</span>
|
|
757
|
+
<span class='ivar'>@type</span>
|
|
758
|
+
<span class='kw'>end</span></pre>
|
|
862
759
|
</td>
|
|
863
760
|
</tr>
|
|
864
761
|
</table>
|
|
@@ -876,9 +773,8 @@ Cell.type must be one of [:time, :float, :integer, :string]
|
|
|
876
773
|
|
|
877
774
|
</p><div class="docstring">
|
|
878
775
|
<div class="discussion">
|
|
879
|
-
|
|
880
|
-
The value of this cell
|
|
881
|
-
</p>
|
|
776
|
+
|
|
777
|
+
<p>The value of this cell.</p>
|
|
882
778
|
|
|
883
779
|
|
|
884
780
|
</div>
|
|
@@ -896,9 +792,8 @@ The value of this cell.
|
|
|
896
792
|
|
|
897
793
|
|
|
898
794
|
|
|
899
|
-
<div class='inline'
|
|
900
|
-
casted value based on cell
|
|
901
|
-
</p>
|
|
795
|
+
<div class='inline'>
|
|
796
|
+
<p>casted value based on cell’s type attribute.</p>
|
|
902
797
|
</div>
|
|
903
798
|
|
|
904
799
|
</li>
|
|
@@ -911,17 +806,16 @@ casted value based on cell’s type attribute.
|
|
|
911
806
|
<pre class="lines">
|
|
912
807
|
|
|
913
808
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
809
|
+
57
|
|
810
|
+
58
|
|
811
|
+
59</pre>
|
|
917
812
|
</td>
|
|
918
813
|
<td>
|
|
919
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
814
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 57</span>
|
|
920
815
|
|
|
921
|
-
<span class='
|
|
922
|
-
<span class='
|
|
923
|
-
<span class='
|
|
924
|
-
</pre>
|
|
816
|
+
<span class='kw'>def</span> <span class='id value'>value</span>
|
|
817
|
+
<span class='ivar'>@value</span>
|
|
818
|
+
<span class='kw'>end</span></pre>
|
|
925
819
|
</td>
|
|
926
820
|
</tr>
|
|
927
821
|
</table>
|
|
@@ -935,377 +829,7 @@ casted value based on cell’s type attribute.
|
|
|
935
829
|
|
|
936
830
|
|
|
937
831
|
<div class="method_details first">
|
|
938
|
-
<p class="signature first" id="
|
|
939
|
-
|
|
940
|
-
- (<tt>Object</tt>) <strong>cast_value</strong>(v)
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
</p><div class="docstring">
|
|
945
|
-
<div class="discussion">
|
|
946
|
-
|
|
947
|
-
<div class="note notetag">
|
|
948
|
-
<strong>Note:</strong>
|
|
949
|
-
<div class='inline'><p>
|
|
950
|
-
About Time - Time in OOXML is <b>different</b> from what you might expect.
|
|
951
|
-
The history as to why is interesting, but you can safely assume that if you
|
|
952
|
-
are generating docs on a mac, you will want to specify Workbook.1904 as
|
|
953
|
-
true when using time typed values.
|
|
954
|
-
</p>
|
|
955
|
-
</div>
|
|
956
|
-
</div>
|
|
957
|
-
|
|
958
|
-
<p>
|
|
959
|
-
Cast the value into this cells data type.
|
|
960
|
-
</p>
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
</div>
|
|
964
|
-
</div>
|
|
965
|
-
<div class="tags">
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
<h3>See Also:</h3>
|
|
969
|
-
<ul class="see">
|
|
970
|
-
|
|
971
|
-
<li>Axlsx#date1904</li>
|
|
972
|
-
|
|
973
|
-
</ul>
|
|
974
|
-
|
|
975
|
-
</div><table class="source_code">
|
|
976
|
-
<tr>
|
|
977
|
-
<td>
|
|
978
|
-
<pre class="lines">
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
160
|
|
982
|
-
161
|
|
983
|
-
162
|
|
984
|
-
163
|
|
985
|
-
164
|
|
986
|
-
165
|
|
987
|
-
166
|
|
988
|
-
167
|
|
989
|
-
168
|
|
990
|
-
169
|
|
991
|
-
170
|
|
992
|
-
171
|
|
993
|
-
172
|
|
994
|
-
173
|
|
995
|
-
174
|
|
996
|
-
175
|
|
997
|
-
176
|
|
998
|
-
177
|
|
999
|
-
178
|
|
1000
|
-
179
|
|
1001
|
-
180
|
|
1002
|
-
181
|
|
1003
|
-
182</pre>
|
|
1004
|
-
</td>
|
|
1005
|
-
<td>
|
|
1006
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 160</span>
|
|
1007
|
-
|
|
1008
|
-
<span class='def def kw'>def</span> <span class='cast_value identifier id'>cast_value</span><span class='lparen token'>(</span><span class='v identifier id'>v</span><span class='rparen token'>)</span>
|
|
1009
|
-
<span class='if if kw'>if</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:time</span> <span class='andop op'>&&</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='Time constant id'>Time</span><span class='rparen token'>)</span>
|
|
1010
|
-
<span class='comment val'>#todo consider a time parsing method to convert strings to time</span>
|
|
1011
|
-
<span class='epoc identifier id'>epoc</span> <span class='assign token'>=</span> <span class='Workbook constant id'>Workbook</span><span class='dot token'>.</span><span class='date1904 identifier id'>date1904</span> <span class='integer val'>? </span><span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='local identifier id'>local</span><span class='lparen token'>(</span><span class='integer val'>1904</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='dot token'>.</span><span class='zone identifier id'>zone</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='local identifier id'>local</span><span class='lparen token'>(</span><span class='integer val'>1900</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='dot token'>.</span><span class='zone identifier id'>zone</span><span class='rparen token'>)</span>
|
|
1012
|
-
<span class='lparen token'>(</span><span class='lparen token'>(</span><span class='v identifier id'>v</span> <span class='minus op'>-</span> <span class='epoc identifier id'>epoc</span><span class='rparen token'>)</span> <span class='div op'>/</span><span class='float val'>60.0</span><span class='div op'>/</span><span class='float val'>60.0</span><span class='div op'>/</span><span class='float val'>24.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='to_f identifier id'>to_f</span>
|
|
1013
|
-
<span class='elsif elsif kw'>elsif</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:float</span>
|
|
1014
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_f identifier id'>to_f</span>
|
|
1015
|
-
<span class='elsif elsif kw'>elsif</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:integer</span>
|
|
1016
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span>
|
|
1017
|
-
<span class='else else kw'>else</span>
|
|
1018
|
-
<span class='@type ivar id'>@type</span> <span class='assign token'>=</span> <span class='symbol val'>:string</span>
|
|
1019
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span>
|
|
1020
|
-
<span class='comment val'># curious as to why this would be the cells responsibility</span>
|
|
1021
|
-
<span class='comment val'># convert your values before passing them in wankers! CGI.unescapeHTML(v.to_s).to_xs</span>
|
|
1022
|
-
<span class='comment val'># to revert, load this once when the gem is loaded.</span>
|
|
1023
|
-
<span class='comment val'># unless String.method_defined? :to_xs</span>
|
|
1024
|
-
<span class='comment val'># require 'fast_xs' #dep</span>
|
|
1025
|
-
<span class='comment val'># class String</span>
|
|
1026
|
-
<span class='comment val'># alias_method :to_xs, :fast_xs</span>
|
|
1027
|
-
<span class='comment val'># end</span>
|
|
1028
|
-
<span class='comment val'># end</span>
|
|
1029
|
-
<span class='end end kw'>end</span>
|
|
1030
|
-
<span class='end end kw'>end</span>
|
|
1031
|
-
</pre>
|
|
1032
|
-
</td>
|
|
1033
|
-
</tr>
|
|
1034
|
-
</table>
|
|
1035
|
-
</div>
|
|
1036
|
-
|
|
1037
|
-
<div class="method_details ">
|
|
1038
|
-
<p class="signature " id="cell_type_from_value-instance_method">
|
|
1039
|
-
|
|
1040
|
-
- (<tt>Symbol</tt>) <strong>cell_type_from_value</strong>(v)
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
</p><div class="docstring">
|
|
1045
|
-
<div class="discussion">
|
|
1046
|
-
|
|
1047
|
-
<div class="note notetag">
|
|
1048
|
-
<strong>Note:</strong>
|
|
1049
|
-
<div class='inline'><p>
|
|
1050
|
-
This is only used when a cell is created but no :type option is specified,
|
|
1051
|
-
the following rules apply:
|
|
1052
|
-
</p>
|
|
1053
|
-
<ol>
|
|
1054
|
-
<li>If the value is an instance of Time, the type is set to :time
|
|
1055
|
-
|
|
1056
|
-
</li>
|
|
1057
|
-
<li>:float and :integer types are determined by regular expression matching.
|
|
1058
|
-
|
|
1059
|
-
</li>
|
|
1060
|
-
<li>Anything that does not meet either of the above is determined to be
|
|
1061
|
-
:string.
|
|
1062
|
-
|
|
1063
|
-
</li>
|
|
1064
|
-
</ol>
|
|
1065
|
-
</div>
|
|
1066
|
-
</div>
|
|
1067
|
-
|
|
1068
|
-
<p>
|
|
1069
|
-
Determines the cell type based on the cell value.
|
|
1070
|
-
</p>
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
</div>
|
|
1074
|
-
</div>
|
|
1075
|
-
<div class="tags">
|
|
1076
|
-
|
|
1077
|
-
<h3>Returns:</h3>
|
|
1078
|
-
<ul class="return">
|
|
1079
|
-
|
|
1080
|
-
<li>
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
—
|
|
1088
|
-
<div class='inline'><p>
|
|
1089
|
-
The determined type
|
|
1090
|
-
</p>
|
|
1091
|
-
</div>
|
|
1092
|
-
|
|
1093
|
-
</li>
|
|
1094
|
-
|
|
1095
|
-
</ul>
|
|
1096
|
-
|
|
1097
|
-
</div><table class="source_code">
|
|
1098
|
-
<tr>
|
|
1099
|
-
<td>
|
|
1100
|
-
<pre class="lines">
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
144
|
|
1104
|
-
145
|
|
1105
|
-
146
|
|
1106
|
-
147
|
|
1107
|
-
148
|
|
1108
|
-
149
|
|
1109
|
-
150
|
|
1110
|
-
151
|
|
1111
|
-
152
|
|
1112
|
-
153
|
|
1113
|
-
154</pre>
|
|
1114
|
-
</td>
|
|
1115
|
-
<td>
|
|
1116
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 144</span>
|
|
1117
|
-
|
|
1118
|
-
<span class='def def kw'>def</span> <span class='cell_type_from_value identifier id'>cell_type_from_value</span><span class='lparen token'>(</span><span class='v identifier id'>v</span><span class='rparen token'>)</span>
|
|
1119
|
-
<span class='if if kw'>if</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Time constant id'>Time</span>
|
|
1120
|
-
<span class='symbol val'>:time</span>
|
|
1121
|
-
<span class='elsif elsif kw'>elsif</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/\A[+-]?\d+?\Z/</span><span class='rparen token'>)</span> <span class='comment val'>#numeric</span>
|
|
1122
|
-
<span class='symbol val'>:integer</span>
|
|
1123
|
-
<span class='elsif elsif kw'>elsif</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/\A[+-]?\d+\.\d+?\Z/</span><span class='rparen token'>)</span> <span class='comment val'>#float</span>
|
|
1124
|
-
<span class='symbol val'>:float</span>
|
|
1125
|
-
<span class='else else kw'>else</span>
|
|
1126
|
-
<span class='symbol val'>:string</span>
|
|
1127
|
-
<span class='end end kw'>end</span>
|
|
1128
|
-
<span class='end end kw'>end</span>
|
|
1129
|
-
</pre>
|
|
1130
|
-
</td>
|
|
1131
|
-
</tr>
|
|
1132
|
-
</table>
|
|
1133
|
-
</div>
|
|
1134
|
-
|
|
1135
|
-
<div class="method_details ">
|
|
1136
|
-
<p class="signature " id="col_ref-instance_method">
|
|
1137
|
-
|
|
1138
|
-
- (<tt>String</tt>) <strong>col_ref</strong>
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
</p><div class="docstring">
|
|
1143
|
-
<div class="discussion">
|
|
1144
|
-
|
|
1145
|
-
<div class="note notetag">
|
|
1146
|
-
<strong>Note:</strong>
|
|
1147
|
-
<div class='inline'><p>
|
|
1148
|
-
This follows the standard spreadsheet convention of naming columns A to Z,
|
|
1149
|
-
followed by AA to AZ etc.
|
|
1150
|
-
</p>
|
|
1151
|
-
</div>
|
|
1152
|
-
</div>
|
|
1153
|
-
|
|
1154
|
-
<p>
|
|
1155
|
-
converts the column index into alphabetical values.
|
|
1156
|
-
</p>
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
</div>
|
|
1160
|
-
</div>
|
|
1161
|
-
<div class="tags">
|
|
1162
|
-
|
|
1163
|
-
<h3>Returns:</h3>
|
|
1164
|
-
<ul class="return">
|
|
1165
|
-
|
|
1166
|
-
<li>
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
</li>
|
|
1174
|
-
|
|
1175
|
-
</ul>
|
|
1176
|
-
|
|
1177
|
-
</div><table class="source_code">
|
|
1178
|
-
<tr>
|
|
1179
|
-
<td>
|
|
1180
|
-
<pre class="lines">
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
127
|
|
1184
|
-
128
|
|
1185
|
-
129
|
|
1186
|
-
130
|
|
1187
|
-
131
|
|
1188
|
-
132
|
|
1189
|
-
133
|
|
1190
|
-
134
|
|
1191
|
-
135
|
|
1192
|
-
136
|
|
1193
|
-
137
|
|
1194
|
-
138
|
|
1195
|
-
139
|
|
1196
|
-
140
|
|
1197
|
-
141
|
|
1198
|
-
142
|
|
1199
|
-
143
|
|
1200
|
-
144
|
|
1201
|
-
145
|
|
1202
|
-
146
|
|
1203
|
-
147
|
|
1204
|
-
148
|
|
1205
|
-
149
|
|
1206
|
-
150
|
|
1207
|
-
151
|
|
1208
|
-
152
|
|
1209
|
-
153
|
|
1210
|
-
154
|
|
1211
|
-
155
|
|
1212
|
-
156
|
|
1213
|
-
157
|
|
1214
|
-
158
|
|
1215
|
-
159
|
|
1216
|
-
160
|
|
1217
|
-
161
|
|
1218
|
-
162
|
|
1219
|
-
163
|
|
1220
|
-
164
|
|
1221
|
-
165
|
|
1222
|
-
166
|
|
1223
|
-
167
|
|
1224
|
-
168
|
|
1225
|
-
169
|
|
1226
|
-
170
|
|
1227
|
-
171
|
|
1228
|
-
172
|
|
1229
|
-
173
|
|
1230
|
-
174
|
|
1231
|
-
175
|
|
1232
|
-
176
|
|
1233
|
-
177
|
|
1234
|
-
178
|
|
1235
|
-
179
|
|
1236
|
-
180
|
|
1237
|
-
181
|
|
1238
|
-
182
|
|
1239
|
-
183</pre>
|
|
1240
|
-
</td>
|
|
1241
|
-
<td>
|
|
1242
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 127</span>
|
|
1243
|
-
|
|
1244
|
-
<span class='def def kw'>def</span> <span class='col_ref identifier id'>col_ref</span>
|
|
1245
|
-
<span class='chars identifier id'>chars</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
|
1246
|
-
<span class='index identifier id'>index</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='index identifier id'>index</span>
|
|
1247
|
-
<span class='while while kw'>while</span> <span class='index identifier id'>index</span> <span class='geq op'>>=</span> <span class='integer val'>26</span> <span class='do do kw'>do</span>
|
|
1248
|
-
<span class='chars identifier id'>chars</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='index identifier id'>index</span> <span class='mod op'>%</span> <span class='integer val'>26</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>65</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span>
|
|
1249
|
-
<span class='index identifier id'>index</span> <span class='opasgn op'>/=</span> <span class='integer val'>26</span>
|
|
1250
|
-
<span class='end end kw'>end</span>
|
|
1251
|
-
<span class='chars identifier id'>chars</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='chars identifier id'>chars</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span> <span class='integer val'>? </span><span class='index identifier id'>index</span> <span class='colon op'>:</span> <span class='index identifier id'>index</span><span class='minus op'>-</span><span class='integer val'>1</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>65</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span>
|
|
1252
|
-
<span class='chars identifier id'>chars</span><span class='dot token'>.</span><span class='reverse identifier id'>reverse</span><span class='dot token'>.</span><span class='join identifier id'>join</span>
|
|
1253
|
-
<span class='end end kw'>end</span>
|
|
1254
|
-
|
|
1255
|
-
<span class='comment val'># Determines the cell type based on the cell value. </span>
|
|
1256
|
-
<span class='comment val'># @note This is only used when a cell is created but no :type option is specified, the following rules apply:</span>
|
|
1257
|
-
<span class='comment val'># 1. If the value is an instance of Time, the type is set to :time</span>
|
|
1258
|
-
<span class='comment val'># 2. :float and :integer types are determined by regular expression matching.</span>
|
|
1259
|
-
<span class='comment val'># 3. Anything that does not meet either of the above is determined to be :string.</span>
|
|
1260
|
-
<span class='comment val'># @return [Symbol] The determined type</span>
|
|
1261
|
-
<span class='def def kw'>def</span> <span class='cell_type_from_value identifier id'>cell_type_from_value</span><span class='lparen token'>(</span><span class='v identifier id'>v</span><span class='rparen token'>)</span>
|
|
1262
|
-
<span class='if if kw'>if</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Time constant id'>Time</span>
|
|
1263
|
-
<span class='symbol val'>:time</span>
|
|
1264
|
-
<span class='elsif elsif kw'>elsif</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/\A[+-]?\d+?\Z/</span><span class='rparen token'>)</span> <span class='comment val'>#numeric</span>
|
|
1265
|
-
<span class='symbol val'>:integer</span>
|
|
1266
|
-
<span class='elsif elsif kw'>elsif</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/\A[+-]?\d+\.\d+?\Z/</span><span class='rparen token'>)</span> <span class='comment val'>#float</span>
|
|
1267
|
-
<span class='symbol val'>:float</span>
|
|
1268
|
-
<span class='else else kw'>else</span>
|
|
1269
|
-
<span class='symbol val'>:string</span>
|
|
1270
|
-
<span class='end end kw'>end</span>
|
|
1271
|
-
<span class='end end kw'>end</span>
|
|
1272
|
-
|
|
1273
|
-
<span class='comment val'># Cast the value into this cells data type. </span>
|
|
1274
|
-
<span class='comment val'># @note </span>
|
|
1275
|
-
<span class='comment val'># About Time - Time in OOXML is *different* from what you might expect. The history as to why is interesting, but you can safely assume that if you are generating docs on a mac, you will want to specify Workbook.1904 as true when using time typed values.</span>
|
|
1276
|
-
<span class='comment val'># @see Axlsx#date1904</span>
|
|
1277
|
-
<span class='def def kw'>def</span> <span class='cast_value identifier id'>cast_value</span><span class='lparen token'>(</span><span class='v identifier id'>v</span><span class='rparen token'>)</span>
|
|
1278
|
-
<span class='if if kw'>if</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:time</span> <span class='andop op'>&&</span> <span class='v identifier id'>v</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='Time constant id'>Time</span><span class='rparen token'>)</span>
|
|
1279
|
-
<span class='comment val'>#todo consider a time parsing method to convert strings to time</span>
|
|
1280
|
-
<span class='epoc identifier id'>epoc</span> <span class='assign token'>=</span> <span class='Workbook constant id'>Workbook</span><span class='dot token'>.</span><span class='date1904 identifier id'>date1904</span> <span class='integer val'>? </span><span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='local identifier id'>local</span><span class='lparen token'>(</span><span class='integer val'>1904</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='dot token'>.</span><span class='zone identifier id'>zone</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='local identifier id'>local</span><span class='lparen token'>(</span><span class='integer val'>1900</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='dot token'>.</span><span class='zone identifier id'>zone</span><span class='rparen token'>)</span>
|
|
1281
|
-
<span class='lparen token'>(</span><span class='lparen token'>(</span><span class='v identifier id'>v</span> <span class='minus op'>-</span> <span class='epoc identifier id'>epoc</span><span class='rparen token'>)</span> <span class='div op'>/</span><span class='float val'>60.0</span><span class='div op'>/</span><span class='float val'>60.0</span><span class='div op'>/</span><span class='float val'>24.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='to_f identifier id'>to_f</span>
|
|
1282
|
-
<span class='elsif elsif kw'>elsif</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:float</span>
|
|
1283
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_f identifier id'>to_f</span>
|
|
1284
|
-
<span class='elsif elsif kw'>elsif</span> <span class='@type ivar id'>@type</span> <span class='eq op'>==</span> <span class='symbol val'>:integer</span>
|
|
1285
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span>
|
|
1286
|
-
<span class='else else kw'>else</span>
|
|
1287
|
-
<span class='@type ivar id'>@type</span> <span class='assign token'>=</span> <span class='symbol val'>:string</span>
|
|
1288
|
-
<span class='v identifier id'>v</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span>
|
|
1289
|
-
<span class='comment val'># curious as to why this would be the cells responsibility</span>
|
|
1290
|
-
<span class='comment val'># convert your values before passing them in wankers! CGI.unescapeHTML(v.to_s).to_xs</span>
|
|
1291
|
-
<span class='comment val'># to revert, load this once when the gem is loaded.</span>
|
|
1292
|
-
<span class='comment val'># unless String.method_defined? :to_xs</span>
|
|
1293
|
-
<span class='comment val'># require 'fast_xs' #dep</span>
|
|
1294
|
-
<span class='comment val'># class String</span>
|
|
1295
|
-
<span class='comment val'># alias_method :to_xs, :fast_xs</span>
|
|
1296
|
-
<span class='comment val'># end</span>
|
|
1297
|
-
<span class='comment val'># end</span>
|
|
1298
|
-
<span class='end end kw'>end</span>
|
|
1299
|
-
<span class='end end kw'>end</span>
|
|
1300
|
-
<span class='end end kw'>end</span>
|
|
1301
|
-
</pre>
|
|
1302
|
-
</td>
|
|
1303
|
-
</tr>
|
|
1304
|
-
</table>
|
|
1305
|
-
</div>
|
|
1306
|
-
|
|
1307
|
-
<div class="method_details ">
|
|
1308
|
-
<p class="signature " id="index-instance_method">
|
|
832
|
+
<p class="signature first" id="index-instance_method">
|
|
1309
833
|
|
|
1310
834
|
- (<tt>Integer</tt>) <strong>index</strong>
|
|
1311
835
|
|
|
@@ -1313,9 +837,8 @@ converts the column index into alphabetical values.
|
|
|
1313
837
|
|
|
1314
838
|
</p><div class="docstring">
|
|
1315
839
|
<div class="discussion">
|
|
1316
|
-
|
|
1317
|
-
The index of the cell in the containing row
|
|
1318
|
-
</p>
|
|
840
|
+
|
|
841
|
+
<p>The index of the cell in the containing row.</p>
|
|
1319
842
|
|
|
1320
843
|
|
|
1321
844
|
</div>
|
|
@@ -1333,9 +856,8 @@ The index of the cell in the containing row.
|
|
|
1333
856
|
|
|
1334
857
|
|
|
1335
858
|
—
|
|
1336
|
-
<div class='inline'
|
|
1337
|
-
The index of the cell in the containing row
|
|
1338
|
-
</p>
|
|
859
|
+
<div class='inline'>
|
|
860
|
+
<p>The index of the cell in the containing row.</p>
|
|
1339
861
|
</div>
|
|
1340
862
|
|
|
1341
863
|
</li>
|
|
@@ -1348,17 +870,16 @@ The index of the cell in the containing row.
|
|
|
1348
870
|
<pre class="lines">
|
|
1349
871
|
|
|
1350
872
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
873
|
+
80
|
|
874
|
+
81
|
|
875
|
+
82</pre>
|
|
1354
876
|
</td>
|
|
1355
877
|
<td>
|
|
1356
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
878
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 80</span>
|
|
1357
879
|
|
|
1358
|
-
<span class='
|
|
1359
|
-
<span class='
|
|
1360
|
-
<span class='
|
|
1361
|
-
</pre>
|
|
880
|
+
<span class='kw'>def</span> <span class='id index'>index</span>
|
|
881
|
+
<span class='ivar'>@row</span><span class='period'>.</span><span class='id cells'>cells</span><span class='period'>.</span><span class='id index'>index</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
|
882
|
+
<span class='kw'>end</span></pre>
|
|
1362
883
|
</td>
|
|
1363
884
|
</tr>
|
|
1364
885
|
</table>
|
|
@@ -1373,9 +894,8 @@ The index of the cell in the containing row.
|
|
|
1373
894
|
|
|
1374
895
|
</p><div class="docstring">
|
|
1375
896
|
<div class="discussion">
|
|
1376
|
-
|
|
1377
|
-
The alpha(column)numeric(row) reference for this sell
|
|
1378
|
-
</p>
|
|
897
|
+
|
|
898
|
+
<p>The alpha(column)numeric(row) reference for this sell.</p>
|
|
1379
899
|
|
|
1380
900
|
|
|
1381
901
|
</div>
|
|
@@ -1385,12 +905,10 @@ The alpha(column)numeric(row) reference for this sell.
|
|
|
1385
905
|
<div class="examples">
|
|
1386
906
|
<h3>Examples:</h3>
|
|
1387
907
|
|
|
1388
|
-
<h4><div class='inline'
|
|
1389
|
-
Relative Cell Reference
|
|
1390
|
-
</p>
|
|
908
|
+
<h4><div class='inline'>
|
|
909
|
+
<p>Relative Cell Reference</p>
|
|
1391
910
|
</div></h4>
|
|
1392
|
-
<pre class="example code"><span class='ws
|
|
1393
|
-
</pre>
|
|
911
|
+
<pre class="example code"><span class='id ws'>ws</span><span class='period'>.</span><span class='id rows'>rows</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id cells'>cells</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id r'>r</span> <span class='comment'>#=> "A1" </span></pre>
|
|
1394
912
|
|
|
1395
913
|
</div>
|
|
1396
914
|
|
|
@@ -1405,9 +923,8 @@ Relative Cell Reference
|
|
|
1405
923
|
|
|
1406
924
|
|
|
1407
925
|
—
|
|
1408
|
-
<div class='inline'
|
|
1409
|
-
The alpha(column)numeric(row) reference for this sell
|
|
1410
|
-
</p>
|
|
926
|
+
<div class='inline'>
|
|
927
|
+
<p>The alpha(column)numeric(row) reference for this sell.</p>
|
|
1411
928
|
</div>
|
|
1412
929
|
|
|
1413
930
|
</li>
|
|
@@ -1420,17 +937,16 @@ The alpha(column)numeric(row) reference for this sell.
|
|
|
1420
937
|
<pre class="lines">
|
|
1421
938
|
|
|
1422
939
|
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
940
|
+
87
|
|
941
|
+
88
|
|
942
|
+
89</pre>
|
|
1426
943
|
</td>
|
|
1427
944
|
<td>
|
|
1428
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
945
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 87</span>
|
|
1429
946
|
|
|
1430
|
-
<span class='
|
|
1431
|
-
<span class='
|
|
1432
|
-
<span class='
|
|
1433
|
-
</pre>
|
|
947
|
+
<span class='kw'>def</span> <span class='id r'>r</span>
|
|
948
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id col_ref'>col_ref</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='ivar'>@row</span><span class='period'>.</span><span class='id index'>index</span><span class='op'>+</span><span class='int'>1</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
|
949
|
+
<span class='kw'>end</span></pre>
|
|
1434
950
|
</td>
|
|
1435
951
|
</tr>
|
|
1436
952
|
</table>
|
|
@@ -1445,9 +961,8 @@ The alpha(column)numeric(row) reference for this sell.
|
|
|
1445
961
|
|
|
1446
962
|
</p><div class="docstring">
|
|
1447
963
|
<div class="discussion">
|
|
1448
|
-
|
|
1449
|
-
The absolute alpha(column)numeric(row) reference for this sell
|
|
1450
|
-
</p>
|
|
964
|
+
|
|
965
|
+
<p>The absolute alpha(column)numeric(row) reference for this sell.</p>
|
|
1451
966
|
|
|
1452
967
|
|
|
1453
968
|
</div>
|
|
@@ -1457,12 +972,10 @@ The absolute alpha(column)numeric(row) reference for this sell.
|
|
|
1457
972
|
<div class="examples">
|
|
1458
973
|
<h3>Examples:</h3>
|
|
1459
974
|
|
|
1460
|
-
<h4><div class='inline'
|
|
1461
|
-
Absolute Cell Reference
|
|
1462
|
-
</p>
|
|
975
|
+
<h4><div class='inline'>
|
|
976
|
+
<p>Absolute Cell Reference</p>
|
|
1463
977
|
</div></h4>
|
|
1464
|
-
<pre class="example code"><span class='ws
|
|
1465
|
-
</pre>
|
|
978
|
+
<pre class="example code"><span class='id ws'>ws</span><span class='period'>.</span><span class='id rows'>rows</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id cells'>cells</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id r'>r</span> <span class='comment'>#=> "$A$1" </span></pre>
|
|
1466
979
|
|
|
1467
980
|
</div>
|
|
1468
981
|
|
|
@@ -1477,9 +990,8 @@ Absolute Cell Reference
|
|
|
1477
990
|
|
|
1478
991
|
|
|
1479
992
|
—
|
|
1480
|
-
<div class='inline'
|
|
1481
|
-
The absolute alpha(column)numeric(row) reference for this sell
|
|
1482
|
-
</p>
|
|
993
|
+
<div class='inline'>
|
|
994
|
+
<p>The absolute alpha(column)numeric(row) reference for this sell.</p>
|
|
1483
995
|
</div>
|
|
1484
996
|
|
|
1485
997
|
</li>
|
|
@@ -1492,17 +1004,16 @@ The absolute alpha(column)numeric(row) reference for this sell.
|
|
|
1492
1004
|
<pre class="lines">
|
|
1493
1005
|
|
|
1494
1006
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1007
|
+
94
|
|
1008
|
+
95
|
|
1009
|
+
96</pre>
|
|
1498
1010
|
</td>
|
|
1499
1011
|
<td>
|
|
1500
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
1012
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 94</span>
|
|
1501
1013
|
|
|
1502
|
-
<span class='
|
|
1503
|
-
<span class='
|
|
1504
|
-
<span class='
|
|
1505
|
-
</pre>
|
|
1014
|
+
<span class='kw'>def</span> <span class='id r_abs'>r_abs</span>
|
|
1015
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$</span><span class='embexpr_beg'>#{</span><span class='id r'>r</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>$</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
|
1016
|
+
<span class='kw'>end</span></pre>
|
|
1506
1017
|
</td>
|
|
1507
1018
|
</tr>
|
|
1508
1019
|
</table>
|
|
@@ -1520,16 +1031,14 @@ The absolute alpha(column)numeric(row) reference for this sell.
|
|
|
1520
1031
|
|
|
1521
1032
|
<div class="note notetag">
|
|
1522
1033
|
<strong>Note:</strong>
|
|
1523
|
-
<div class='inline'
|
|
1524
|
-
Shared Strings are not used in this library. All values are set directly in
|
|
1525
|
-
the each sheet
|
|
1526
|
-
</p>
|
|
1034
|
+
<div class='inline'>
|
|
1035
|
+
<p>Shared Strings are not used in this library. All values are set directly in
|
|
1036
|
+
the each sheet.</p>
|
|
1527
1037
|
</div>
|
|
1528
1038
|
</div>
|
|
1529
1039
|
|
|
1530
|
-
|
|
1531
|
-
Serializes the cell
|
|
1532
|
-
</p>
|
|
1040
|
+
|
|
1041
|
+
<p>Serializes the cell</p>
|
|
1533
1042
|
|
|
1534
1043
|
|
|
1535
1044
|
</div>
|
|
@@ -1548,9 +1057,8 @@ Serializes the cell
|
|
|
1548
1057
|
|
|
1549
1058
|
|
|
1550
1059
|
—
|
|
1551
|
-
<div class='inline'
|
|
1552
|
-
The document builder instance this objects xml will be added to
|
|
1553
|
-
</p>
|
|
1060
|
+
<div class='inline'>
|
|
1061
|
+
<p>The document builder instance this objects xml will be added to.</p>
|
|
1554
1062
|
</div>
|
|
1555
1063
|
|
|
1556
1064
|
</li>
|
|
@@ -1568,9 +1076,8 @@ The document builder instance this objects xml will be added to.
|
|
|
1568
1076
|
|
|
1569
1077
|
|
|
1570
1078
|
—
|
|
1571
|
-
<div class='inline'
|
|
1572
|
-
xml text for the cell
|
|
1573
|
-
</p>
|
|
1079
|
+
<div class='inline'>
|
|
1080
|
+
<p>xml text for the cell</p>
|
|
1574
1081
|
</div>
|
|
1575
1082
|
|
|
1576
1083
|
</li>
|
|
@@ -1583,27 +1090,34 @@ xml text for the cell
|
|
|
1583
1090
|
<pre class="lines">
|
|
1584
1091
|
|
|
1585
1092
|
|
|
1586
|
-
110
|
|
1587
|
-
111
|
|
1588
|
-
112
|
|
1589
|
-
113
|
|
1590
1093
|
114
|
|
1591
1094
|
115
|
|
1592
1095
|
116
|
|
1593
|
-
117
|
|
1096
|
+
117
|
|
1097
|
+
118
|
|
1098
|
+
119
|
|
1099
|
+
120
|
|
1100
|
+
121
|
|
1101
|
+
122
|
|
1102
|
+
123
|
|
1103
|
+
124
|
|
1104
|
+
125</pre>
|
|
1594
1105
|
</td>
|
|
1595
1106
|
<td>
|
|
1596
|
-
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line
|
|
1597
|
-
|
|
1598
|
-
<span class='
|
|
1599
|
-
<span class='
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
<span class='
|
|
1605
|
-
<span class='
|
|
1606
|
-
</
|
|
1107
|
+
<pre class="code"><span class="info file"># File 'lib/axlsx/workbook/worksheet/cell.rb', line 114</span>
|
|
1108
|
+
|
|
1109
|
+
<span class='kw'>def</span> <span class='id to_xml'>to_xml</span><span class='lparen'>(</span><span class='id xml'>xml</span><span class='rparen'>)</span>
|
|
1110
|
+
<span class='comment'># Both 1.8 and 1.9 return the same 'fast_xf'
|
|
1111
|
+
</span> <span class='comment'># &#12491;&#12507;&#12531;&#12468;
|
|
1112
|
+
</span> <span class='comment'># &#12491;&#12507;&#12531;&#12468;
|
|
1113
|
+
</span>
|
|
1114
|
+
<span class='comment'># however nokogiri does a nice 'force_encoding' which we shall remove!
|
|
1115
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>==</span> <span class='symbol'>:string</span>
|
|
1116
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id c'>c</span><span class='lparen'>(</span><span class='symbol'>:r</span> <span class='op'>=></span> <span class='id r'>r</span><span class='comma'>,</span> <span class='symbol'>:t</span><span class='op'>=></span><span class='symbol'>:inlineStr</span><span class='comma'>,</span> <span class='symbol'>:s</span><span class='op'>=></span><span class='id style'>style</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id xml'>xml</span><span class='period'>.</span><span class='id is'>is</span> <span class='lbrace'>{</span> <span class='id xml'>xml</span><span class='period'>.</span><span class='id t'>t</span> <span class='ivar'>@value</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
1117
|
+
<span class='kw'>else</span>
|
|
1118
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id c'>c</span><span class='lparen'>(</span><span class='symbol'>:r</span> <span class='op'>=></span> <span class='id r'>r</span><span class='comma'>,</span> <span class='symbol'>:s</span> <span class='op'>=></span> <span class='id style'>style</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id xml'>xml</span><span class='period'>.</span><span class='id v'>v</span> <span class='id value'>value</span> <span class='rbrace'>}</span>
|
|
1119
|
+
<span class='kw'>end</span>
|
|
1120
|
+
<span class='kw'>end</span></pre>
|
|
1607
1121
|
</td>
|
|
1608
1122
|
</tr>
|
|
1609
1123
|
</table>
|
|
@@ -1614,9 +1128,9 @@ xml text for the cell
|
|
|
1614
1128
|
</div>
|
|
1615
1129
|
|
|
1616
1130
|
<div id="footer">
|
|
1617
|
-
Generated on
|
|
1131
|
+
Generated on Sat Nov 26 13:16:39 2011 by
|
|
1618
1132
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1619
|
-
0.7.3 (ruby-1.
|
|
1133
|
+
0.7.3 (ruby-1.9.3).
|
|
1620
1134
|
</div>
|
|
1621
1135
|
|
|
1622
1136
|
</body>
|