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/SeriesTitle.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Axlsx::SeriesTitle
|
|
8
8
|
|
|
9
|
-
—
|
|
9
|
+
— AXLSX
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -96,10 +96,9 @@
|
|
|
96
96
|
|
|
97
97
|
<h2>Overview</h2><div class="docstring">
|
|
98
98
|
<div class="discussion">
|
|
99
|
-
|
|
100
|
-
A series title is a Title with a slightly different serialization than
|
|
101
|
-
chart titles
|
|
102
|
-
</p>
|
|
99
|
+
|
|
100
|
+
<p>A series title is a Title with a slightly different serialization than
|
|
101
|
+
chart titles.</p>
|
|
103
102
|
|
|
104
103
|
|
|
105
104
|
</div>
|
|
@@ -148,9 +147,8 @@ chart titles.
|
|
|
148
147
|
|
|
149
148
|
|
|
150
149
|
|
|
151
|
-
<span class="summary_desc"><div class='inline'
|
|
152
|
-
Serializes the series title
|
|
153
|
-
</p>
|
|
150
|
+
<span class="summary_desc"><div class='inline'>
|
|
151
|
+
<p>Serializes the series title.</p>
|
|
154
152
|
</div></span>
|
|
155
153
|
|
|
156
154
|
</li>
|
|
@@ -168,7 +166,7 @@ Serializes the series title.
|
|
|
168
166
|
|
|
169
167
|
|
|
170
168
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Title.html" title="Axlsx::Title (class)">Title</a></span></h3>
|
|
171
|
-
<p class="inherited"><span class='object_link'><a href="Title.html#initialize-instance_method" title="Axlsx::Title#initialize (method)">#initialize</a></span
|
|
169
|
+
<p class="inherited"><span class='object_link'><a href="Title.html#initialize-instance_method" title="Axlsx::Title#initialize (method)">#initialize</a></span></p>
|
|
172
170
|
<div id="constructor_details" class="method_details_list">
|
|
173
171
|
<h2>Constructor Details</h2>
|
|
174
172
|
|
|
@@ -190,9 +188,8 @@ Serializes the series title.
|
|
|
190
188
|
|
|
191
189
|
</p><div class="docstring">
|
|
192
190
|
<div class="discussion">
|
|
193
|
-
|
|
194
|
-
Serializes the series title
|
|
195
|
-
</p>
|
|
191
|
+
|
|
192
|
+
<p>Serializes the series title</p>
|
|
196
193
|
|
|
197
194
|
|
|
198
195
|
</div>
|
|
@@ -211,9 +208,8 @@ Serializes the series title
|
|
|
211
208
|
|
|
212
209
|
|
|
213
210
|
—
|
|
214
|
-
<div class='inline'
|
|
215
|
-
The document builder instance this objects xml will be added to
|
|
216
|
-
</p>
|
|
211
|
+
<div class='inline'>
|
|
212
|
+
<p>The document builder instance this objects xml will be added to.</p>
|
|
217
213
|
</div>
|
|
218
214
|
|
|
219
215
|
</li>
|
|
@@ -257,20 +253,19 @@ The document builder instance this objects xml will be added to.
|
|
|
257
253
|
<td>
|
|
258
254
|
<pre class="code"><span class="info file"># File 'lib/axlsx/drawing/series_title.rb', line 8</span>
|
|
259
255
|
|
|
260
|
-
<span class='
|
|
261
|
-
<span class='xml
|
|
262
|
-
<span class='xml
|
|
263
|
-
<span class='xml
|
|
264
|
-
<span class='xml
|
|
265
|
-
<span class='xml
|
|
266
|
-
<span class='xml
|
|
267
|
-
<span class='xml
|
|
268
|
-
<span class='rbrace
|
|
269
|
-
<span class='rbrace
|
|
270
|
-
<span class='rbrace
|
|
271
|
-
<span class='rbrace
|
|
272
|
-
<span class='
|
|
273
|
-
</pre>
|
|
256
|
+
<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>
|
|
257
|
+
<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:tx</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
258
|
+
<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>
|
|
259
|
+
<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='lbracket'>[</span><span class='ivar'>@cell</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
260
|
+
<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>
|
|
261
|
+
<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='int'>1</span><span class='rparen'>)</span>
|
|
262
|
+
<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='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
263
|
+
<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='ivar'>@text</span><span class='rparen'>)</span>
|
|
264
|
+
<span class='rbrace'>}</span>
|
|
265
|
+
<span class='rbrace'>}</span>
|
|
266
|
+
<span class='rbrace'>}</span>
|
|
267
|
+
<span class='rbrace'>}</span>
|
|
268
|
+
<span class='kw'>end</span></pre>
|
|
274
269
|
</td>
|
|
275
270
|
</tr>
|
|
276
271
|
</table>
|
|
@@ -281,9 +276,9 @@ The document builder instance this objects xml will be added to.
|
|
|
281
276
|
</div>
|
|
282
277
|
|
|
283
278
|
<div id="footer">
|
|
284
|
-
Generated on
|
|
279
|
+
Generated on Sat Nov 26 13:16:38 2011 by
|
|
285
280
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
286
|
-
0.7.3 (ruby-1.
|
|
281
|
+
0.7.3 (ruby-1.9.3).
|
|
287
282
|
</div>
|
|
288
283
|
|
|
289
284
|
</body>
|
data/doc/Axlsx/Styles.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Axlsx::Styles
|
|
8
8
|
|
|
9
|
-
—
|
|
9
|
+
— AXLSX
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -97,20 +97,18 @@
|
|
|
97
97
|
|
|
98
98
|
<div class="note notetag">
|
|
99
99
|
<strong>Note:</strong>
|
|
100
|
-
<div class='inline'
|
|
101
|
-
The recommended way to manage styles is with add_style
|
|
102
|
-
</p>
|
|
100
|
+
<div class='inline'>
|
|
101
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
103
102
|
</div>
|
|
104
103
|
</div>
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
The Styles class manages worksheet styles In addition to creating the
|
|
105
|
+
|
|
106
|
+
<p>The Styles class manages worksheet styles In addition to creating the
|
|
108
107
|
require style objects for a valid xlsx package, this class provides the key
|
|
109
108
|
mechanism for adding styles to your workbook, and safely applying them to
|
|
110
109
|
the cells of your worksheet. All portions of the stylesheet are implemented
|
|
111
110
|
here exception colors, which specify legacy and modified pallete colors,
|
|
112
|
-
and exLst, whic is used as a future feature data storage area
|
|
113
|
-
</p>
|
|
111
|
+
and exLst, whic is used as a future feature data storage area.</p>
|
|
114
112
|
|
|
115
113
|
|
|
116
114
|
</div>
|
|
@@ -151,10 +149,9 @@ and exLst, whic is used as a future feature data storage area.
|
|
|
151
149
|
|
|
152
150
|
|
|
153
151
|
|
|
154
|
-
<span class="summary_desc"><div class='inline'
|
|
155
|
-
The collection of borders used in this workbook Axlsx predefines
|
|
156
|
-
THIN_BORDER which can be used to put a border around all of your cells
|
|
157
|
-
</p>
|
|
152
|
+
<span class="summary_desc"><div class='inline'>
|
|
153
|
+
<p>The collection of borders used in this workbook Axlsx predefines
|
|
154
|
+
THIN_BORDER which can be used to put a border around all of your cells.</p>
|
|
158
155
|
</div></span>
|
|
159
156
|
|
|
160
157
|
</li>
|
|
@@ -179,10 +176,9 @@ THIN_BORDER which can be used to put a border around all of your cells.
|
|
|
179
176
|
|
|
180
177
|
|
|
181
178
|
|
|
182
|
-
<span class="summary_desc"><div class='inline'
|
|
183
|
-
The collection of named styles, referencing cellStyleXfs items in the
|
|
184
|
-
workbook
|
|
185
|
-
</p>
|
|
179
|
+
<span class="summary_desc"><div class='inline'>
|
|
180
|
+
<p>The collection of named styles, referencing cellStyleXfs items in the
|
|
181
|
+
workbook.</p>
|
|
186
182
|
</div></span>
|
|
187
183
|
|
|
188
184
|
</li>
|
|
@@ -207,10 +203,9 @@ workbook.
|
|
|
207
203
|
|
|
208
204
|
|
|
209
205
|
|
|
210
|
-
<span class="summary_desc"><div class='inline'
|
|
211
|
-
The collection of master formatting records for named cell styles, which
|
|
212
|
-
means records defined in cellStyles, in the workbook
|
|
213
|
-
</p>
|
|
206
|
+
<span class="summary_desc"><div class='inline'>
|
|
207
|
+
<p>The collection of master formatting records for named cell styles, which
|
|
208
|
+
means records defined in cellStyles, in the workbook.</p>
|
|
214
209
|
</div></span>
|
|
215
210
|
|
|
216
211
|
</li>
|
|
@@ -235,9 +230,8 @@ means records defined in cellStyles, in the workbook.
|
|
|
235
230
|
|
|
236
231
|
|
|
237
232
|
|
|
238
|
-
<span class="summary_desc"><div class='inline'
|
|
239
|
-
The collection of master formatting records
|
|
240
|
-
</p>
|
|
233
|
+
<span class="summary_desc"><div class='inline'>
|
|
234
|
+
<p>The collection of master formatting records.</p>
|
|
241
235
|
</div></span>
|
|
242
236
|
|
|
243
237
|
</li>
|
|
@@ -262,9 +256,8 @@ The collection of master formatting records.
|
|
|
262
256
|
|
|
263
257
|
|
|
264
258
|
|
|
265
|
-
<span class="summary_desc"><div class='inline'
|
|
266
|
-
The collection of non-cell formatting records used in the worksheet
|
|
267
|
-
</p>
|
|
259
|
+
<span class="summary_desc"><div class='inline'>
|
|
260
|
+
<p>The collection of non-cell formatting records used in the worksheet.</p>
|
|
268
261
|
</div></span>
|
|
269
262
|
|
|
270
263
|
</li>
|
|
@@ -289,9 +282,8 @@ The collection of non-cell formatting records used in the worksheet.
|
|
|
289
282
|
|
|
290
283
|
|
|
291
284
|
|
|
292
|
-
<span class="summary_desc"><div class='inline'
|
|
293
|
-
The collection of fills used in this workbook
|
|
294
|
-
</p>
|
|
285
|
+
<span class="summary_desc"><div class='inline'>
|
|
286
|
+
<p>The collection of fills used in this workbook.</p>
|
|
295
287
|
</div></span>
|
|
296
288
|
|
|
297
289
|
</li>
|
|
@@ -316,9 +308,8 @@ The collection of fills used in this workbook.
|
|
|
316
308
|
|
|
317
309
|
|
|
318
310
|
|
|
319
|
-
<span class="summary_desc"><div class='inline'
|
|
320
|
-
The collection of fonts used in this workbook
|
|
321
|
-
</p>
|
|
311
|
+
<span class="summary_desc"><div class='inline'>
|
|
312
|
+
<p>The collection of fonts used in this workbook.</p>
|
|
322
313
|
</div></span>
|
|
323
314
|
|
|
324
315
|
</li>
|
|
@@ -343,9 +334,8 @@ The collection of fonts used in this workbook.
|
|
|
343
334
|
|
|
344
335
|
|
|
345
336
|
|
|
346
|
-
<span class="summary_desc"><div class='inline'
|
|
347
|
-
numFmts for your styles
|
|
348
|
-
</p>
|
|
337
|
+
<span class="summary_desc"><div class='inline'>
|
|
338
|
+
<p>numFmts for your styles.</p>
|
|
349
339
|
</div></span>
|
|
350
340
|
|
|
351
341
|
</li>
|
|
@@ -370,10 +360,9 @@ numFmts for your styles.
|
|
|
370
360
|
|
|
371
361
|
|
|
372
362
|
|
|
373
|
-
<span class="summary_desc"><div class='inline'
|
|
374
|
-
The collection of table styles that will be available to the user in the
|
|
375
|
-
excel UI
|
|
376
|
-
</p>
|
|
363
|
+
<span class="summary_desc"><div class='inline'>
|
|
364
|
+
<p>The collection of table styles that will be available to the user in the
|
|
365
|
+
excel UI.</p>
|
|
377
366
|
</div></span>
|
|
378
367
|
|
|
379
368
|
</li>
|
|
@@ -408,9 +397,8 @@ excel UI.
|
|
|
408
397
|
|
|
409
398
|
|
|
410
399
|
|
|
411
|
-
<span class="summary_desc"><div class='inline'
|
|
412
|
-
Drastically simplifies style creation and management
|
|
413
|
-
</p>
|
|
400
|
+
<span class="summary_desc"><div class='inline'>
|
|
401
|
+
<p>Drastically simplifies style creation and management.</p>
|
|
414
402
|
</div></span>
|
|
415
403
|
|
|
416
404
|
</li>
|
|
@@ -434,10 +422,9 @@ Drastically simplifies style creation and management.
|
|
|
434
422
|
|
|
435
423
|
|
|
436
424
|
|
|
437
|
-
<span class="summary_desc"><div class='inline'
|
|
438
|
-
Creates a new Styles object and prepopulates it with the requires objects
|
|
439
|
-
to generate a valid package style part
|
|
440
|
-
</p>
|
|
425
|
+
<span class="summary_desc"><div class='inline'>
|
|
426
|
+
<p>Creates a new Styles object and prepopulates it with the requires objects
|
|
427
|
+
to generate a valid package style part.</p>
|
|
441
428
|
</div></span>
|
|
442
429
|
|
|
443
430
|
</li>
|
|
@@ -459,9 +446,8 @@ to generate a valid package style part.
|
|
|
459
446
|
|
|
460
447
|
|
|
461
448
|
|
|
462
|
-
<span class="summary_desc"><div class='inline'
|
|
463
|
-
Serializes the styles document
|
|
464
|
-
</p>
|
|
449
|
+
<span class="summary_desc"><div class='inline'>
|
|
450
|
+
<p>Serializes the styles document.</p>
|
|
465
451
|
</div></span>
|
|
466
452
|
|
|
467
453
|
</li>
|
|
@@ -482,10 +468,9 @@ Serializes the styles document.
|
|
|
482
468
|
|
|
483
469
|
</p><div class="docstring">
|
|
484
470
|
<div class="discussion">
|
|
485
|
-
|
|
486
|
-
Creates a new Styles object and prepopulates it with the requires objects
|
|
487
|
-
to generate a valid package style part
|
|
488
|
-
</p>
|
|
471
|
+
|
|
472
|
+
<p>Creates a new Styles object and prepopulates it with the requires objects
|
|
473
|
+
to generate a valid package style part.</p>
|
|
489
474
|
|
|
490
475
|
|
|
491
476
|
</div>
|
|
@@ -506,10 +491,9 @@ to generate a valid package style part.
|
|
|
506
491
|
<td>
|
|
507
492
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 118</span>
|
|
508
493
|
|
|
509
|
-
<span class='
|
|
510
|
-
<span class='load_default_styles
|
|
511
|
-
<span class='
|
|
512
|
-
</pre>
|
|
494
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
495
|
+
<span class='id load_default_styles'>load_default_styles</span>
|
|
496
|
+
<span class='kw'>end</span></pre>
|
|
513
497
|
</td>
|
|
514
498
|
</tr>
|
|
515
499
|
</table>
|
|
@@ -535,16 +519,14 @@ to generate a valid package style part.
|
|
|
535
519
|
|
|
536
520
|
<div class="note notetag">
|
|
537
521
|
<strong>Note:</strong>
|
|
538
|
-
<div class='inline'
|
|
539
|
-
The recommended way to manage styles is with add_style
|
|
540
|
-
</p>
|
|
522
|
+
<div class='inline'>
|
|
523
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
541
524
|
</div>
|
|
542
525
|
</div>
|
|
543
526
|
|
|
544
|
-
|
|
545
|
-
The collection of borders used in this workbook Axlsx predefines
|
|
546
|
-
THIN_BORDER which can be used to put a border around all of your cells
|
|
547
|
-
</p>
|
|
527
|
+
|
|
528
|
+
<p>The collection of borders used in this workbook Axlsx predefines
|
|
529
|
+
THIN_BORDER which can be used to put a border around all of your cells.</p>
|
|
548
530
|
|
|
549
531
|
|
|
550
532
|
</div>
|
|
@@ -585,10 +567,9 @@ THIN_BORDER which can be used to put a border around all of your cells.
|
|
|
585
567
|
<td>
|
|
586
568
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 85</span>
|
|
587
569
|
|
|
588
|
-
<span class='
|
|
589
|
-
<span class='
|
|
590
|
-
<span class='
|
|
591
|
-
</pre>
|
|
570
|
+
<span class='kw'>def</span> <span class='id borders'>borders</span>
|
|
571
|
+
<span class='ivar'>@borders</span>
|
|
572
|
+
<span class='kw'>end</span></pre>
|
|
592
573
|
</td>
|
|
593
574
|
</tr>
|
|
594
575
|
</table>
|
|
@@ -609,16 +590,14 @@ THIN_BORDER which can be used to put a border around all of your cells.
|
|
|
609
590
|
|
|
610
591
|
<div class="note notetag">
|
|
611
592
|
<strong>Note:</strong>
|
|
612
|
-
<div class='inline'
|
|
613
|
-
The recommended way to manage styles is with add_style
|
|
614
|
-
</p>
|
|
593
|
+
<div class='inline'>
|
|
594
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
615
595
|
</div>
|
|
616
596
|
</div>
|
|
617
597
|
|
|
618
|
-
|
|
619
|
-
The collection of named styles, referencing cellStyleXfs items in the
|
|
620
|
-
workbook
|
|
621
|
-
</p>
|
|
598
|
+
|
|
599
|
+
<p>The collection of named styles, referencing cellStyleXfs items in the
|
|
600
|
+
workbook.</p>
|
|
622
601
|
|
|
623
602
|
|
|
624
603
|
</div>
|
|
@@ -659,10 +638,9 @@ workbook.
|
|
|
659
638
|
<td>
|
|
660
639
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 97</span>
|
|
661
640
|
|
|
662
|
-
<span class='
|
|
663
|
-
<span class='
|
|
664
|
-
<span class='
|
|
665
|
-
</pre>
|
|
641
|
+
<span class='kw'>def</span> <span class='id cellStyles'>cellStyles</span>
|
|
642
|
+
<span class='ivar'>@cellStyles</span>
|
|
643
|
+
<span class='kw'>end</span></pre>
|
|
666
644
|
</td>
|
|
667
645
|
</tr>
|
|
668
646
|
</table>
|
|
@@ -683,16 +661,14 @@ workbook.
|
|
|
683
661
|
|
|
684
662
|
<div class="note notetag">
|
|
685
663
|
<strong>Note:</strong>
|
|
686
|
-
<div class='inline'
|
|
687
|
-
The recommended way to manage styles is with add_style
|
|
688
|
-
</p>
|
|
664
|
+
<div class='inline'>
|
|
665
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
689
666
|
</div>
|
|
690
667
|
</div>
|
|
691
668
|
|
|
692
|
-
|
|
693
|
-
The collection of master formatting records for named cell styles, which
|
|
694
|
-
means records defined in cellStyles, in the workbook
|
|
695
|
-
</p>
|
|
669
|
+
|
|
670
|
+
<p>The collection of master formatting records for named cell styles, which
|
|
671
|
+
means records defined in cellStyles, in the workbook</p>
|
|
696
672
|
|
|
697
673
|
|
|
698
674
|
</div>
|
|
@@ -733,10 +709,9 @@ means records defined in cellStyles, in the workbook
|
|
|
733
709
|
<td>
|
|
734
710
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 91</span>
|
|
735
711
|
|
|
736
|
-
<span class='
|
|
737
|
-
<span class='
|
|
738
|
-
<span class='
|
|
739
|
-
</pre>
|
|
712
|
+
<span class='kw'>def</span> <span class='id cellStyleXfs'>cellStyleXfs</span>
|
|
713
|
+
<span class='ivar'>@cellStyleXfs</span>
|
|
714
|
+
<span class='kw'>end</span></pre>
|
|
740
715
|
</td>
|
|
741
716
|
</tr>
|
|
742
717
|
</table>
|
|
@@ -757,16 +732,14 @@ means records defined in cellStyles, in the workbook
|
|
|
757
732
|
|
|
758
733
|
<div class="note notetag">
|
|
759
734
|
<strong>Note:</strong>
|
|
760
|
-
<div class='inline'
|
|
761
|
-
The recommended way to manage styles is with add_style
|
|
762
|
-
</p>
|
|
735
|
+
<div class='inline'>
|
|
736
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
763
737
|
</div>
|
|
764
738
|
</div>
|
|
765
739
|
|
|
766
|
-
|
|
767
|
-
The collection of master formatting records. This is the list that you will
|
|
768
|
-
actually use in styling a workbook
|
|
769
|
-
</p>
|
|
740
|
+
|
|
741
|
+
<p>The collection of master formatting records. This is the list that you will
|
|
742
|
+
actually use in styling a workbook.</p>
|
|
770
743
|
|
|
771
744
|
|
|
772
745
|
</div>
|
|
@@ -807,10 +780,9 @@ actually use in styling a workbook.
|
|
|
807
780
|
<td>
|
|
808
781
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 103</span>
|
|
809
782
|
|
|
810
|
-
<span class='
|
|
811
|
-
<span class='
|
|
812
|
-
<span class='
|
|
813
|
-
</pre>
|
|
783
|
+
<span class='kw'>def</span> <span class='id cellXfs'>cellXfs</span>
|
|
784
|
+
<span class='ivar'>@cellXfs</span>
|
|
785
|
+
<span class='kw'>end</span></pre>
|
|
814
786
|
</td>
|
|
815
787
|
</tr>
|
|
816
788
|
</table>
|
|
@@ -831,15 +803,13 @@ actually use in styling a workbook.
|
|
|
831
803
|
|
|
832
804
|
<div class="note notetag">
|
|
833
805
|
<strong>Note:</strong>
|
|
834
|
-
<div class='inline'
|
|
835
|
-
The recommended way to manage styles is with add_style
|
|
836
|
-
</p>
|
|
806
|
+
<div class='inline'>
|
|
807
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
837
808
|
</div>
|
|
838
809
|
</div>
|
|
839
810
|
|
|
840
|
-
|
|
841
|
-
The collection of non-cell formatting records used in the worksheet
|
|
842
|
-
</p>
|
|
811
|
+
|
|
812
|
+
<p>The collection of non-cell formatting records used in the worksheet.</p>
|
|
843
813
|
|
|
844
814
|
|
|
845
815
|
</div>
|
|
@@ -880,10 +850,9 @@ The collection of non-cell formatting records used in the worksheet.
|
|
|
880
850
|
<td>
|
|
881
851
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 109</span>
|
|
882
852
|
|
|
883
|
-
<span class='
|
|
884
|
-
<span class='
|
|
885
|
-
<span class='
|
|
886
|
-
</pre>
|
|
853
|
+
<span class='kw'>def</span> <span class='id dxfs'>dxfs</span>
|
|
854
|
+
<span class='ivar'>@dxfs</span>
|
|
855
|
+
<span class='kw'>end</span></pre>
|
|
887
856
|
</td>
|
|
888
857
|
</tr>
|
|
889
858
|
</table>
|
|
@@ -904,15 +873,13 @@ The collection of non-cell formatting records used in the worksheet.
|
|
|
904
873
|
|
|
905
874
|
<div class="note notetag">
|
|
906
875
|
<strong>Note:</strong>
|
|
907
|
-
<div class='inline'
|
|
908
|
-
The recommended way to manage styles is with add_style
|
|
909
|
-
</p>
|
|
876
|
+
<div class='inline'>
|
|
877
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
910
878
|
</div>
|
|
911
879
|
</div>
|
|
912
880
|
|
|
913
|
-
|
|
914
|
-
The collection of fills used in this workbook
|
|
915
|
-
</p>
|
|
881
|
+
|
|
882
|
+
<p>The collection of fills used in this workbook</p>
|
|
916
883
|
|
|
917
884
|
|
|
918
885
|
</div>
|
|
@@ -953,10 +920,9 @@ The collection of fills used in this workbook
|
|
|
953
920
|
<td>
|
|
954
921
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 78</span>
|
|
955
922
|
|
|
956
|
-
<span class='
|
|
957
|
-
<span class='
|
|
958
|
-
<span class='
|
|
959
|
-
</pre>
|
|
923
|
+
<span class='kw'>def</span> <span class='id fills'>fills</span>
|
|
924
|
+
<span class='ivar'>@fills</span>
|
|
925
|
+
<span class='kw'>end</span></pre>
|
|
960
926
|
</td>
|
|
961
927
|
</tr>
|
|
962
928
|
</table>
|
|
@@ -977,15 +943,13 @@ The collection of fills used in this workbook
|
|
|
977
943
|
|
|
978
944
|
<div class="note notetag">
|
|
979
945
|
<strong>Note:</strong>
|
|
980
|
-
<div class='inline'
|
|
981
|
-
The recommended way to manage styles is with add_style
|
|
982
|
-
</p>
|
|
946
|
+
<div class='inline'>
|
|
947
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
983
948
|
</div>
|
|
984
949
|
</div>
|
|
985
950
|
|
|
986
|
-
|
|
987
|
-
The collection of fonts used in this workbook
|
|
988
|
-
</p>
|
|
951
|
+
|
|
952
|
+
<p>The collection of fonts used in this workbook</p>
|
|
989
953
|
|
|
990
954
|
|
|
991
955
|
</div>
|
|
@@ -1026,10 +990,9 @@ The collection of fonts used in this workbook
|
|
|
1026
990
|
<td>
|
|
1027
991
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 72</span>
|
|
1028
992
|
|
|
1029
|
-
<span class='
|
|
1030
|
-
<span class='
|
|
1031
|
-
<span class='
|
|
1032
|
-
</pre>
|
|
993
|
+
<span class='kw'>def</span> <span class='id fonts'>fonts</span>
|
|
994
|
+
<span class='ivar'>@fonts</span>
|
|
995
|
+
<span class='kw'>end</span></pre>
|
|
1033
996
|
</td>
|
|
1034
997
|
</tr>
|
|
1035
998
|
</table>
|
|
@@ -1050,51 +1013,48 @@ The collection of fonts used in this workbook
|
|
|
1050
1013
|
|
|
1051
1014
|
<div class="note notetag">
|
|
1052
1015
|
<strong>Note:</strong>
|
|
1053
|
-
<div class='inline'
|
|
1054
|
-
The recommended way to manage styles is with add_style
|
|
1055
|
-
</p>
|
|
1016
|
+
<div class='inline'>
|
|
1017
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
1056
1018
|
</div>
|
|
1057
1019
|
</div>
|
|
1058
1020
|
|
|
1059
|
-
|
|
1060
|
-
numFmts for your styles
|
|
1061
|
-
|
|
1062
|
-
<pre class="code">
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
<span class='NUM_FMT_YYYYMMDDHHMMSS constant id'>NUM_FMT_YYYYMMDDHHMMSS</span> <span class='formats identifier id'>formats</span> <span class='to identifier id'>to</span> <span class='string val'>"yyyy/mm/dd hh:mm:ss"</span>
|
|
1097
|
-
</pre>
|
|
1021
|
+
|
|
1022
|
+
<p>numFmts for your styles.</p>
|
|
1023
|
+
|
|
1024
|
+
<pre class="code">The default styles, which change based on the system local, are as follows.
|
|
1025
|
+
id formatCode
|
|
1026
|
+
0 General
|
|
1027
|
+
1 0
|
|
1028
|
+
2 0.00
|
|
1029
|
+
3 #,##0
|
|
1030
|
+
4 #,##0.00
|
|
1031
|
+
9 0%
|
|
1032
|
+
10 0.00%
|
|
1033
|
+
11 0.00E+00
|
|
1034
|
+
12 # ?/?
|
|
1035
|
+
13 # ??/??
|
|
1036
|
+
14 mm-dd-yy
|
|
1037
|
+
15 d-mmm-yy
|
|
1038
|
+
16 d-mmm
|
|
1039
|
+
17 mmm-yy
|
|
1040
|
+
18 h:mm AM/PM
|
|
1041
|
+
19 h:mm:ss AM/PM
|
|
1042
|
+
20 h:mm
|
|
1043
|
+
21 h:mm:ss
|
|
1044
|
+
22 m/d/yy h:mm
|
|
1045
|
+
37 #,##0 ;(#,##0)
|
|
1046
|
+
38 #,##0 ;[Red](#,##0)
|
|
1047
|
+
39 #,##0.00;(#,##0.00)
|
|
1048
|
+
40 #,##0.00;[Red](#,##0.00)
|
|
1049
|
+
45 mm:ss
|
|
1050
|
+
46 [h]:mm:ss
|
|
1051
|
+
47 mmss.0
|
|
1052
|
+
48 ##0.0E+0
|
|
1053
|
+
49 @
|
|
1054
|
+
Axlsx also defines the following constants which you can use in add_style.
|
|
1055
|
+
NUM_FMT_PERCENT formats to "0%"
|
|
1056
|
+
NUM_FMT_YYYYMMDD formats to "yyyy/mm/dd"
|
|
1057
|
+
NUM_FMT_YYYYMMDDHHMMSS formats to "yyyy/mm/dd hh:mm:ss"</pre>
|
|
1098
1058
|
|
|
1099
1059
|
|
|
1100
1060
|
</div>
|
|
@@ -1137,10 +1097,9 @@ numFmts for your styles.
|
|
|
1137
1097
|
<td>
|
|
1138
1098
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 66</span>
|
|
1139
1099
|
|
|
1140
|
-
<span class='
|
|
1141
|
-
<span class='
|
|
1142
|
-
<span class='
|
|
1143
|
-
</pre>
|
|
1100
|
+
<span class='kw'>def</span> <span class='id numFmts'>numFmts</span>
|
|
1101
|
+
<span class='ivar'>@numFmts</span>
|
|
1102
|
+
<span class='kw'>end</span></pre>
|
|
1144
1103
|
</td>
|
|
1145
1104
|
</tr>
|
|
1146
1105
|
</table>
|
|
@@ -1161,16 +1120,14 @@ numFmts for your styles.
|
|
|
1161
1120
|
|
|
1162
1121
|
<div class="note notetag">
|
|
1163
1122
|
<strong>Note:</strong>
|
|
1164
|
-
<div class='inline'
|
|
1165
|
-
The recommended way to manage styles is with add_style
|
|
1166
|
-
</p>
|
|
1123
|
+
<div class='inline'>
|
|
1124
|
+
<p>The recommended way to manage styles is with add_style</p>
|
|
1167
1125
|
</div>
|
|
1168
1126
|
</div>
|
|
1169
1127
|
|
|
1170
|
-
|
|
1171
|
-
The collection of table styles that will be available to the user in the
|
|
1172
|
-
excel UI
|
|
1173
|
-
</p>
|
|
1128
|
+
|
|
1129
|
+
<p>The collection of table styles that will be available to the user in the
|
|
1130
|
+
excel UI</p>
|
|
1174
1131
|
|
|
1175
1132
|
|
|
1176
1133
|
</div>
|
|
@@ -1211,10 +1168,9 @@ excel UI
|
|
|
1211
1168
|
<td>
|
|
1212
1169
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 115</span>
|
|
1213
1170
|
|
|
1214
|
-
<span class='
|
|
1215
|
-
<span class='
|
|
1216
|
-
<span class='
|
|
1217
|
-
</pre>
|
|
1171
|
+
<span class='kw'>def</span> <span class='id tableStyles'>tableStyles</span>
|
|
1172
|
+
<span class='ivar'>@tableStyles</span>
|
|
1173
|
+
<span class='kw'>end</span></pre>
|
|
1218
1174
|
</td>
|
|
1219
1175
|
</tr>
|
|
1220
1176
|
</table>
|
|
@@ -1236,9 +1192,8 @@ excel UI
|
|
|
1236
1192
|
|
|
1237
1193
|
</p><div class="docstring">
|
|
1238
1194
|
<div class="discussion">
|
|
1239
|
-
|
|
1240
|
-
Drastically simplifies style creation and management
|
|
1241
|
-
</p>
|
|
1195
|
+
|
|
1196
|
+
<p>Drastically simplifies style creation and management.</p>
|
|
1242
1197
|
|
|
1243
1198
|
|
|
1244
1199
|
</div>
|
|
@@ -1248,63 +1203,59 @@ Drastically simplifies style creation and management.
|
|
|
1248
1203
|
<div class="examples">
|
|
1249
1204
|
<h3>Examples:</h3>
|
|
1250
1205
|
|
|
1251
|
-
<h4><div class='inline'
|
|
1252
|
-
You Got Style
|
|
1253
|
-
</p>
|
|
1206
|
+
<h4><div class='inline'>
|
|
1207
|
+
<p>You Got Style</p>
|
|
1254
1208
|
</div></h4>
|
|
1255
|
-
<pre class="example code"
|
|
1256
|
-
|
|
1209
|
+
<pre class="example code">require "rubygems" # if that is your preferred way to manage gems!
|
|
1210
|
+
require "axlsx"
|
|
1257
1211
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1212
|
+
p = Axlsx::Package.new
|
|
1213
|
+
ws = p.workbook.add_worksheet
|
|
1260
1214
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1215
|
+
# black text on a white background at 14pt with thin borders!
|
|
1216
|
+
title = ws.style.add_style(:bg_color => "FFFF0000", :fg_color=>"#FF000000", :sz=>14, :border=>Axlsx::STYLE_THIN_BORDER
|
|
1263
1217
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
</pre>
|
|
1218
|
+
ws.add_row :values => ["Least Popular Pets"]
|
|
1219
|
+
ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"], :style=>title
|
|
1220
|
+
ws.add_row :values => ["Votes", 6, 4, 1], :style=>Axlsx::STYLE_THIN_BORDER
|
|
1221
|
+
f = File.open('example_you_got_style.xlsx', 'w')
|
|
1222
|
+
p.serialize(f)</pre>
|
|
1270
1223
|
|
|
1271
|
-
<h4><div class='inline'
|
|
1272
|
-
Styling specifically
|
|
1273
|
-
</p>
|
|
1224
|
+
<h4><div class='inline'>
|
|
1225
|
+
<p>Styling specifically</p>
|
|
1274
1226
|
</div></h4>
|
|
1275
|
-
<pre class="example code"><span class='comment
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
<span class='p
|
|
1280
|
-
<span class='ws
|
|
1281
|
-
|
|
1282
|
-
<span class='comment
|
|
1283
|
-
|
|
1284
|
-
<span class='symbol
|
|
1285
|
-
<span class='symbol
|
|
1286
|
-
<span class='symbol
|
|
1287
|
-
|
|
1288
|
-
<span class='date_time
|
|
1289
|
-
<span class='symbol
|
|
1290
|
-
|
|
1291
|
-
<span class='percent
|
|
1292
|
-
<span class='symbol
|
|
1293
|
-
|
|
1294
|
-
<span class='currency
|
|
1295
|
-
<span class='symbol
|
|
1296
|
-
|
|
1297
|
-
<span class='comment
|
|
1298
|
-
|
|
1299
|
-
<span class='ws
|
|
1300
|
-
<span class='ws
|
|
1301
|
-
<span class='ws
|
|
1302
|
-
<span class='ws
|
|
1303
|
-
<span class='ws
|
|
1304
|
-
<span class='ws
|
|
1305
|
-
<span class='f
|
|
1306
|
-
<span class='p
|
|
1307
|
-
</pre>
|
|
1227
|
+
<pre class="example code"><span class='comment'># an example of applying specific styles to specific cells
|
|
1228
|
+
</span><span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rubygems</span><span class='tstring_end'>"</span></span> <span class='comment'># if that is your preferred way to manage gems!
|
|
1229
|
+
</span><span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>axlsx</span><span class='tstring_end'>"</span></span>
|
|
1230
|
+
|
|
1231
|
+
<span class='id p'>p</span> <span class='op'>=</span> <span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>Package</span><span class='period'>.</span><span class='id new'>new</span>
|
|
1232
|
+
<span class='id ws'>ws</span> <span class='op'>=</span> <span class='id p'>p</span><span class='period'>.</span><span class='id workbook'>workbook</span><span class='period'>.</span><span class='id add_worksheet'>add_worksheet</span>
|
|
1233
|
+
|
|
1234
|
+
<span class='comment'># define your styles
|
|
1235
|
+
</span><span class='id title'>title</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id style'>style</span><span class='period'>.</span><span class='id add_style'>add_style</span><span class='lparen'>(</span><span class='symbol'>:bg_color</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>FFFF0000</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
1236
|
+
<span class='symbol'>:fg_color</span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>#FF000000</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
1237
|
+
<span class='symbol'>:border</span><span class='op'>=></span><span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>STYLE_THIN_BORDER</span><span class='comma'>,</span>
|
|
1238
|
+
<span class='symbol'>:alignment</span><span class='op'>=></span><span class='lbrace'>{</span><span class='symbol'>:horizontal</span> <span class='op'>=></span> <span class='symbol'>:center</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1239
|
+
|
|
1240
|
+
<span class='id date_time'>date_time</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id style'>style</span><span class='period'>.</span><span class='id add_style'>add_style</span><span class='lparen'>(</span><span class='symbol'>:num_fmt</span> <span class='op'>=></span> <span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>NUM_FMT_YYYYMMDDHHMMSS</span><span class='comma'>,</span>
|
|
1241
|
+
<span class='symbol'>:border</span><span class='op'>=></span><span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>STYLE_THIN_BORDER</span><span class='rparen'>)</span>
|
|
1242
|
+
|
|
1243
|
+
<span class='id percent'>percent</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id style'>style</span><span class='period'>.</span><span class='id add_style'>add_style</span><span class='lparen'>(</span><span class='symbol'>:num_fmt</span> <span class='op'>=></span> <span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>NUM_FMT_PERCENT</span><span class='comma'>,</span>
|
|
1244
|
+
<span class='symbol'>:border</span><span class='op'>=></span><span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>STYLE_THIN_BORDER</span><span class='rparen'>)</span>
|
|
1245
|
+
|
|
1246
|
+
<span class='id currency'>currency</span> <span class='op'>=</span> <span class='id ws'>ws</span><span class='period'>.</span><span class='id style'>style</span><span class='period'>.</span><span class='id add_style'>add_style</span><span class='lparen'>(</span><span class='symbol'>:format_code</span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>¥#,##0;[Red]¥-#,##0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
1247
|
+
<span class='symbol'>:border</span><span class='op'>=></span><span class='const'>Axlsx</span><span class='op'>::</span><span class='const'>STYLE_THIN_BORDER</span><span class='rparen'>)</span>
|
|
1248
|
+
|
|
1249
|
+
<span class='comment'># build your rows
|
|
1250
|
+
</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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Genreated At:</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><span class='comma'>,</span> <span class='symbol'>:styles</span><span class='op'>=></span><span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id date_time'>date_time</span><span class='rbracket'>]</span>
|
|
1251
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Previous Year Quarterly Profits (JPY)</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='id title'>title</span>
|
|
1252
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Quarter</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Profit</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>% of Total</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='id title'>title</span>
|
|
1253
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q1</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>4000</span><span class='comma'>,</span> <span class='int'>40</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='lbracket'>[</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id currency'>currency</span><span class='comma'>,</span> <span class='id percent'>percent</span><span class='rbracket'>]</span>
|
|
1254
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q2</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>3000</span><span class='comma'>,</span> <span class='int'>30</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='lbracket'>[</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id currency'>currency</span><span class='comma'>,</span> <span class='id percent'>percent</span><span class='rbracket'>]</span>
|
|
1255
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q3</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>1000</span><span class='comma'>,</span> <span class='int'>10</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='lbracket'>[</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id currency'>currency</span><span class='comma'>,</span> <span class='id percent'>percent</span><span class='rbracket'>]</span>
|
|
1256
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q4</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>2000</span><span class='comma'>,</span> <span class='int'>20</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:style</span><span class='op'>=></span><span class='lbracket'>[</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id currency'>currency</span><span class='comma'>,</span> <span class='id percent'>percent</span><span class='rbracket'>]</span>
|
|
1257
|
+
<span class='id f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>example_you_got_style.xlsx</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
1258
|
+
<span class='id p'>p</span><span class='period'>.</span><span class='id serialize'>serialize</span><span class='lparen'>(</span><span class='id f'>f</span><span class='rparen'>)</span></pre>
|
|
1308
1259
|
|
|
1309
1260
|
</div>
|
|
1310
1261
|
<h3>Parameters:</h3>
|
|
@@ -1322,9 +1273,8 @@ Styling specifically
|
|
|
1322
1273
|
|
|
1323
1274
|
|
|
1324
1275
|
—
|
|
1325
|
-
<div class='inline'
|
|
1326
|
-
a customizable set of options
|
|
1327
|
-
</p>
|
|
1276
|
+
<div class='inline'>
|
|
1277
|
+
<p>a customizable set of options</p>
|
|
1328
1278
|
</div>
|
|
1329
1279
|
|
|
1330
1280
|
</li>
|
|
@@ -1343,9 +1293,8 @@ a customizable set of options
|
|
|
1343
1293
|
<span class="default">
|
|
1344
1294
|
|
|
1345
1295
|
</span>
|
|
1346
|
-
— <div class='inline'
|
|
1347
|
-
The text color
|
|
1348
|
-
</p>
|
|
1296
|
+
— <div class='inline'>
|
|
1297
|
+
<p>The text color</p>
|
|
1349
1298
|
</div>
|
|
1350
1299
|
</li>
|
|
1351
1300
|
|
|
@@ -1355,9 +1304,8 @@ The text color
|
|
|
1355
1304
|
<span class="default">
|
|
1356
1305
|
|
|
1357
1306
|
</span>
|
|
1358
|
-
— <div class='inline'
|
|
1359
|
-
The text size
|
|
1360
|
-
</p>
|
|
1307
|
+
— <div class='inline'>
|
|
1308
|
+
<p>The text size</p>
|
|
1361
1309
|
</div>
|
|
1362
1310
|
</li>
|
|
1363
1311
|
|
|
@@ -1367,9 +1315,8 @@ The text size
|
|
|
1367
1315
|
<span class="default">
|
|
1368
1316
|
|
|
1369
1317
|
</span>
|
|
1370
|
-
— <div class='inline'
|
|
1371
|
-
Indicates if the text should be bold
|
|
1372
|
-
</p>
|
|
1318
|
+
— <div class='inline'>
|
|
1319
|
+
<p>Indicates if the text should be bold</p>
|
|
1373
1320
|
</div>
|
|
1374
1321
|
</li>
|
|
1375
1322
|
|
|
@@ -1379,9 +1326,8 @@ Indicates if the text should be bold
|
|
|
1379
1326
|
<span class="default">
|
|
1380
1327
|
|
|
1381
1328
|
</span>
|
|
1382
|
-
— <div class='inline'
|
|
1383
|
-
Indicates if the text should be italicised
|
|
1384
|
-
</p>
|
|
1329
|
+
— <div class='inline'>
|
|
1330
|
+
<p>Indicates if the text should be italicised</p>
|
|
1385
1331
|
</div>
|
|
1386
1332
|
</li>
|
|
1387
1333
|
|
|
@@ -1391,9 +1337,8 @@ Indicates if the text should be italicised
|
|
|
1391
1337
|
<span class="default">
|
|
1392
1338
|
|
|
1393
1339
|
</span>
|
|
1394
|
-
— <div class='inline'
|
|
1395
|
-
Indicates if the text should be rendered with a strikethrough
|
|
1396
|
-
</p>
|
|
1340
|
+
— <div class='inline'>
|
|
1341
|
+
<p>Indicates if the text should be rendered with a strikethrough</p>
|
|
1397
1342
|
</div>
|
|
1398
1343
|
</li>
|
|
1399
1344
|
|
|
@@ -1403,9 +1348,8 @@ Indicates if the text should be rendered with a strikethrough
|
|
|
1403
1348
|
<span class="default">
|
|
1404
1349
|
|
|
1405
1350
|
</span>
|
|
1406
|
-
— <div class='inline'
|
|
1407
|
-
Indicates if the text should be rendered with a shadow
|
|
1408
|
-
</p>
|
|
1351
|
+
— <div class='inline'>
|
|
1352
|
+
<p>Indicates if the text should be rendered with a shadow</p>
|
|
1409
1353
|
</div>
|
|
1410
1354
|
</li>
|
|
1411
1355
|
|
|
@@ -1415,9 +1359,8 @@ Indicates if the text should be rendered with a shadow
|
|
|
1415
1359
|
<span class="default">
|
|
1416
1360
|
|
|
1417
1361
|
</span>
|
|
1418
|
-
— <div class='inline'
|
|
1419
|
-
The character set to use
|
|
1420
|
-
</p>
|
|
1362
|
+
— <div class='inline'>
|
|
1363
|
+
<p>The character set to use.</p>
|
|
1421
1364
|
</div>
|
|
1422
1365
|
</li>
|
|
1423
1366
|
|
|
@@ -1427,9 +1370,8 @@ The character set to use.
|
|
|
1427
1370
|
<span class="default">
|
|
1428
1371
|
|
|
1429
1372
|
</span>
|
|
1430
|
-
— <div class='inline'
|
|
1431
|
-
The font family to use
|
|
1432
|
-
</p>
|
|
1373
|
+
— <div class='inline'>
|
|
1374
|
+
<p>The font family to use.</p>
|
|
1433
1375
|
</div>
|
|
1434
1376
|
</li>
|
|
1435
1377
|
|
|
@@ -1439,9 +1381,8 @@ The font family to use.
|
|
|
1439
1381
|
<span class="default">
|
|
1440
1382
|
|
|
1441
1383
|
</span>
|
|
1442
|
-
— <div class='inline'
|
|
1443
|
-
The name of the font to use
|
|
1444
|
-
</p>
|
|
1384
|
+
— <div class='inline'>
|
|
1385
|
+
<p>The name of the font to use</p>
|
|
1445
1386
|
</div>
|
|
1446
1387
|
</li>
|
|
1447
1388
|
|
|
@@ -1451,9 +1392,8 @@ The name of the font to use
|
|
|
1451
1392
|
<span class="default">
|
|
1452
1393
|
|
|
1453
1394
|
</span>
|
|
1454
|
-
— <div class='inline'
|
|
1455
|
-
The number format to apply
|
|
1456
|
-
</p>
|
|
1395
|
+
— <div class='inline'>
|
|
1396
|
+
<p>The number format to apply</p>
|
|
1457
1397
|
</div>
|
|
1458
1398
|
</li>
|
|
1459
1399
|
|
|
@@ -1463,9 +1403,8 @@ The number format to apply
|
|
|
1463
1403
|
<span class="default">
|
|
1464
1404
|
|
|
1465
1405
|
</span>
|
|
1466
|
-
— <div class='inline'
|
|
1467
|
-
The formatting to apply. If this is specified, num_fmt is ignored
|
|
1468
|
-
</p>
|
|
1406
|
+
— <div class='inline'>
|
|
1407
|
+
<p>The formatting to apply. If this is specified, num_fmt is ignored.</p>
|
|
1469
1408
|
</div>
|
|
1470
1409
|
</li>
|
|
1471
1410
|
|
|
@@ -1475,9 +1414,8 @@ The formatting to apply. If this is specified, num_fmt is ignored.
|
|
|
1475
1414
|
<span class="default">
|
|
1476
1415
|
|
|
1477
1416
|
</span>
|
|
1478
|
-
— <div class='inline'
|
|
1479
|
-
The border style to use
|
|
1480
|
-
</p>
|
|
1417
|
+
— <div class='inline'>
|
|
1418
|
+
<p>The border style to use.</p>
|
|
1481
1419
|
</div>
|
|
1482
1420
|
</li>
|
|
1483
1421
|
|
|
@@ -1487,9 +1425,8 @@ The border style to use.
|
|
|
1487
1425
|
<span class="default">
|
|
1488
1426
|
|
|
1489
1427
|
</span>
|
|
1490
|
-
— <div class='inline'
|
|
1491
|
-
The background color to apply to the cell
|
|
1492
|
-
</p>
|
|
1428
|
+
— <div class='inline'>
|
|
1429
|
+
<p>The background color to apply to the cell</p>
|
|
1493
1430
|
</div>
|
|
1494
1431
|
</li>
|
|
1495
1432
|
|
|
@@ -1499,9 +1436,8 @@ The background color to apply to the cell
|
|
|
1499
1436
|
<span class="default">
|
|
1500
1437
|
|
|
1501
1438
|
</span>
|
|
1502
|
-
— <div class='inline'
|
|
1503
|
-
Indicates if the cell should be hidden
|
|
1504
|
-
</p>
|
|
1439
|
+
— <div class='inline'>
|
|
1440
|
+
<p>Indicates if the cell should be hidden</p>
|
|
1505
1441
|
</div>
|
|
1506
1442
|
</li>
|
|
1507
1443
|
|
|
@@ -1511,9 +1447,8 @@ Indicates if the cell should be hidden
|
|
|
1511
1447
|
<span class="default">
|
|
1512
1448
|
|
|
1513
1449
|
</span>
|
|
1514
|
-
— <div class='inline'
|
|
1515
|
-
Indicates if the cell should be locked
|
|
1516
|
-
</p>
|
|
1450
|
+
— <div class='inline'>
|
|
1451
|
+
<p>Indicates if the cell should be locked</p>
|
|
1517
1452
|
</div>
|
|
1518
1453
|
</li>
|
|
1519
1454
|
|
|
@@ -1523,9 +1458,8 @@ Indicates if the cell should be locked
|
|
|
1523
1458
|
<span class="default">
|
|
1524
1459
|
|
|
1525
1460
|
</span>
|
|
1526
|
-
— <div class='inline'
|
|
1527
|
-
A hash defining any of the attributes used in CellAlignment
|
|
1528
|
-
</p>
|
|
1461
|
+
— <div class='inline'>
|
|
1462
|
+
<p>A hash defining any of the attributes used in CellAlignment</p>
|
|
1529
1463
|
</div>
|
|
1530
1464
|
</li>
|
|
1531
1465
|
|
|
@@ -1621,52 +1555,51 @@ A hash defining any of the attributes used in CellAlignment
|
|
|
1621
1555
|
<td>
|
|
1622
1556
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 191</span>
|
|
1623
1557
|
|
|
1624
|
-
<span class='
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
<span class='applyProtection
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
<span class='
|
|
1669
|
-
</pre>
|
|
1558
|
+
<span class='kw'>def</span> <span class='id add_style'>add_style</span><span class='lparen'>(</span><span class='id options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1559
|
+
|
|
1560
|
+
<span class='id numFmtId'>numFmtId</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:format_code</span><span class='rbracket'>]</span>
|
|
1561
|
+
<span class='id n'>n</span> <span class='op'>=</span> <span class='ivar'>@numFmts</span><span class='period'>.</span><span class='id map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span> <span class='id f'>f</span><span class='period'>.</span><span class='id numFmtId'>numFmtId</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id max'>max</span> <span class='op'>+</span> <span class='int'>1</span>
|
|
1562
|
+
<span class='id numFmts'>numFmts</span> <span class='op'><<</span> <span class='const'>NumFmt</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:numFmtId</span> <span class='op'>=></span> <span class='id n'>n</span><span class='comma'>,</span> <span class='symbol'>:formatCode</span><span class='op'>=></span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:format_code</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
1563
|
+
<span class='id n'>n</span>
|
|
1564
|
+
<span class='kw'>else</span>
|
|
1565
|
+
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:num_fmt</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>0</span>
|
|
1566
|
+
<span class='kw'>end</span>
|
|
1567
|
+
|
|
1568
|
+
<span class='id borderId'>borderId</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:border</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>0</span>
|
|
1569
|
+
<span class='id raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid borderId</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id borderId'>borderId</span> <span class='op'><</span> <span class='id borders'>borders</span><span class='period'>.</span><span class='id size'>size</span>
|
|
1570
|
+
|
|
1571
|
+
<span class='id fill'>fill</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:bg_color</span><span class='rbracket'>]</span>
|
|
1572
|
+
<span class='id color'>color</span> <span class='op'>=</span> <span class='const'>Color</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:rgb</span><span class='op'>=></span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:bg_color</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
1573
|
+
<span class='id pattern'>pattern</span> <span class='op'>=</span> <span class='const'>PatternFill</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:patternType</span> <span class='op'>=></span><span class='symbol'>:solid</span><span class='comma'>,</span> <span class='symbol'>:fgColor</span><span class='op'>=></span><span class='id color'>color</span><span class='rparen'>)</span>
|
|
1574
|
+
<span class='id fills'>fills</span> <span class='op'><<</span> <span class='const'>Fill</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id pattern'>pattern</span><span class='rparen'>)</span>
|
|
1575
|
+
<span class='kw'>else</span>
|
|
1576
|
+
<span class='int'>0</span>
|
|
1577
|
+
<span class='kw'>end</span>
|
|
1578
|
+
|
|
1579
|
+
<span class='id fontId'>fontId</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id options'>options</span><span class='period'>.</span><span class='id values_at'>values_at</span><span class='lparen'>(</span><span class='symbol'>:fg_color</span><span class='comma'>,</span> <span class='symbol'>:sz</span><span class='comma'>,</span> <span class='symbol'>:b</span><span class='comma'>,</span> <span class='symbol'>:i</span><span class='comma'>,</span> <span class='symbol'>:strike</span><span class='comma'>,</span> <span class='symbol'>:outline</span><span class='comma'>,</span> <span class='symbol'>:shadow</span><span class='comma'>,</span> <span class='symbol'>:charset</span><span class='comma'>,</span> <span class='symbol'>:family</span><span class='comma'>,</span> <span class='symbol'>:font_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id length'>length</span><span class='rparen'>)</span>
|
|
1580
|
+
<span class='id font'>font</span> <span class='op'>=</span> <span class='const'>Font</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
1581
|
+
<span class='lbracket'>[</span><span class='symbol'>:b</span><span class='comma'>,</span> <span class='symbol'>:i</span><span class='comma'>,</span> <span class='symbol'>:strike</span><span class='comma'>,</span> <span class='symbol'>:outline</span><span class='comma'>,</span> <span class='symbol'>:shadow</span><span class='comma'>,</span> <span class='symbol'>:charset</span><span class='comma'>,</span> <span class='symbol'>:family</span><span class='comma'>,</span> <span class='symbol'>:sz</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id k'>k</span><span class='op'>|</span> <span class='id font'>font</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='embexpr_beg'>#{</span><span class='id k'>k</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='id k'>k</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='id k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='rbrace'>}</span>
|
|
1582
|
+
<span class='id font'>font</span><span class='period'>.</span><span class='id color'>color</span> <span class='op'>=</span> <span class='const'>Color</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:rgb</span> <span class='op'>=></span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fg_color</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fg_color</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
|
1583
|
+
<span class='id font'>font</span><span class='period'>.</span><span class='id name'>name</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:font_name</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:font_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
|
1584
|
+
<span class='id fonts'>fonts</span> <span class='op'><<</span> <span class='id font'>font</span>
|
|
1585
|
+
<span class='kw'>else</span>
|
|
1586
|
+
<span class='int'>0</span>
|
|
1587
|
+
<span class='kw'>end</span>
|
|
1588
|
+
|
|
1589
|
+
<span class='id applyProtection'>applyProtection</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:hidden</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locked</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='int'>0</span>
|
|
1590
|
+
|
|
1591
|
+
<span class='id xf'>xf</span> <span class='op'>=</span> <span class='const'>Xf</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:fillId</span> <span class='op'>=></span> <span class='id fill'>fill</span><span class='comma'>,</span> <span class='symbol'>:fontId</span><span class='op'>=></span><span class='id fontId'>fontId</span><span class='comma'>,</span> <span class='symbol'>:applyFill</span><span class='op'>=></span><span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:applyFont</span><span class='op'>=></span><span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:numFmtId</span><span class='op'>=></span><span class='id numFmtId'>numFmtId</span><span class='comma'>,</span> <span class='symbol'>:borderId</span><span class='op'>=></span><span class='id borderId'>borderId</span><span class='comma'>,</span> <span class='symbol'>:applyProtection</span><span class='op'>=></span><span class='id applyProtection'>applyProtection</span><span class='rparen'>)</span>
|
|
1592
|
+
|
|
1593
|
+
<span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:alignment</span><span class='rbracket'>]</span>
|
|
1594
|
+
<span class='id xf'>xf</span><span class='period'>.</span><span class='id alignment'>alignment</span> <span class='op'>=</span> <span class='const'>CellAlignment</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:alignment</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
1595
|
+
<span class='kw'>end</span>
|
|
1596
|
+
|
|
1597
|
+
<span class='kw'>if</span> <span class='id applyProtection'>applyProtection</span>
|
|
1598
|
+
<span class='id xf'>xf</span><span class='period'>.</span><span class='id protection'>protection</span> <span class='op'>=</span> <span class='const'>CellProtection</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id options'>options</span><span class='rparen'>)</span>
|
|
1599
|
+
<span class='kw'>end</span>
|
|
1600
|
+
|
|
1601
|
+
<span class='id cellXfs'>cellXfs</span> <span class='op'><<</span> <span class='id xf'>xf</span>
|
|
1602
|
+
<span class='kw'>end</span></pre>
|
|
1670
1603
|
</td>
|
|
1671
1604
|
</tr>
|
|
1672
1605
|
</table>
|
|
@@ -1681,9 +1614,8 @@ A hash defining any of the attributes used in CellAlignment
|
|
|
1681
1614
|
|
|
1682
1615
|
</p><div class="docstring">
|
|
1683
1616
|
<div class="discussion">
|
|
1684
|
-
|
|
1685
|
-
Serializes the styles document
|
|
1686
|
-
</p>
|
|
1617
|
+
|
|
1618
|
+
<p>Serializes the styles document</p>
|
|
1687
1619
|
|
|
1688
1620
|
|
|
1689
1621
|
</div>
|
|
@@ -1724,17 +1656,16 @@ Serializes the styles document
|
|
|
1724
1656
|
<td>
|
|
1725
1657
|
<pre class="code"><span class="info file"># File 'lib/axlsx/stylesheet/styles.rb', line 239</span>
|
|
1726
1658
|
|
|
1727
|
-
<span class='
|
|
1728
|
-
<span class='builder
|
|
1729
|
-
<span class='xml
|
|
1730
|
-
<span class='
|
|
1731
|
-
<span class='
|
|
1732
|
-
<span class='
|
|
1733
|
-
<span class='rbrace
|
|
1734
|
-
<span class='
|
|
1735
|
-
<span class='builder
|
|
1736
|
-
<span class='
|
|
1737
|
-
</pre>
|
|
1659
|
+
<span class='kw'>def</span> <span class='id to_xml'>to_xml</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
1660
|
+
<span class='id builder'>builder</span> <span class='op'>=</span> <span class='const'>Nokogiri</span><span class='op'>::</span><span class='const'>XML</span><span class='op'>::</span><span class='const'>Builder</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:encoding</span> <span class='op'>=></span> <span class='const'>ENCODING</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id xml'>xml</span><span class='op'>|</span>
|
|
1661
|
+
<span class='id xml'>xml</span><span class='period'>.</span><span class='id styleSheet'>styleSheet</span><span class='lparen'>(</span><span class='symbol'>:xmlns</span> <span class='op'>=></span> <span class='const'>XML_NS</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
|
1662
|
+
<span class='lbracket'>[</span><span class='symbol'>:numFmts</span><span class='comma'>,</span> <span class='symbol'>:fonts</span><span class='comma'>,</span> <span class='symbol'>:fills</span><span class='comma'>,</span> <span class='symbol'>:borders</span><span class='comma'>,</span> <span class='symbol'>:cellStyleXfs</span><span class='comma'>,</span> <span class='symbol'>:cellXfs</span><span class='comma'>,</span> <span class='symbol'>:cellStyles</span><span class='comma'>,</span> <span class='symbol'>:dxfs</span><span class='comma'>,</span> <span class='symbol'>:tableStyles</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id key'>key</span><span class='op'>|</span>
|
|
1663
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id instance_values'>instance_values</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id to_xml'>to_xml</span><span class='lparen'>(</span><span class='id xml'>xml</span><span class='rparen'>)</span>
|
|
1664
|
+
<span class='kw'>end</span>
|
|
1665
|
+
<span class='rbrace'>}</span>
|
|
1666
|
+
<span class='kw'>end</span>
|
|
1667
|
+
<span class='id builder'>builder</span><span class='period'>.</span><span class='id to_xml'>to_xml</span>
|
|
1668
|
+
<span class='kw'>end</span></pre>
|
|
1738
1669
|
</td>
|
|
1739
1670
|
</tr>
|
|
1740
1671
|
</table>
|
|
@@ -1745,9 +1676,9 @@ Serializes the styles document
|
|
|
1745
1676
|
</div>
|
|
1746
1677
|
|
|
1747
1678
|
<div id="footer">
|
|
1748
|
-
Generated on
|
|
1679
|
+
Generated on Sat Nov 26 13:16:38 2011 by
|
|
1749
1680
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1750
|
-
0.7.3 (ruby-1.
|
|
1681
|
+
0.7.3 (ruby-1.9.3).
|
|
1751
1682
|
</div>
|
|
1752
1683
|
|
|
1753
1684
|
</body>
|