xlsxrb 0.1.5 → 0.1.6
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.
- checksums.yaml +4 -4
- data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +2332 -0
- data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +4 -0
- data/.gem_rbs_collection/rubyzip/3.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rubyzip/3.2/manifest.yaml +8 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/central_directory.rbs +42 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/compressor.rbs +5 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/constants.rbs +47 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/aes_encryption.rbs +30 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/decrypted_io.rbs +9 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/encryption.rbs +7 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/null_encryption.rbs +19 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/traditional_encryption.rbs +31 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/decompressor.rbs +18 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/deflater.rbs +12 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/dirtyable.rbs +11 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/dos_time.rbs +13 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/entry.rbs +95 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/entry_set.rbs +31 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/errors.rbs +58 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/aes.rbs +24 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/generic.rbs +17 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/ntfs.rbs +23 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/old_unix.rbs +22 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/universal_time.rbs +30 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unix.rbs +20 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unknown.rbs +15 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/zip64.rbs +26 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field.rbs +21 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/file.rbs +131 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/file_split.rbs +14 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/dir.rbs +33 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/directory_iterator.rbs +21 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file.rbs +63 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file_stat.rbs +55 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/zip_file_name_mapper.rbs +35 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem.rbs +7 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/inflater.rbs +10 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/input_stream.rbs +22 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_input_stream.rbs +29 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_output_stream.rbs +17 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras.rbs +13 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/null_compressor.rbs +10 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/null_decompressor.rbs +8 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/null_input_stream.rbs +6 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/output_stream.rbs +30 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_compressor.rbs +10 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_decompressor.rbs +10 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_directory.rbs +5 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_stream.rbs +15 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip/version.rbs +3 -0
- data/.gem_rbs_collection/rubyzip/3.2/zip.rbs +40 -0
- data/CHANGELOG.md +18 -0
- data/README.md +39 -32
- data/Rakefile +2 -1
- data/Steepfile +0 -2
- data/benchmark.rb +376 -0
- data/docs/ARCHITECTURE.md +12 -5
- data/docs/wasm/ruby.wasm +0 -0
- data/lib/xlsxrb/elements/cell.rb +39 -7
- data/lib/xlsxrb/elements/row.rb +17 -4
- data/lib/xlsxrb/elements/types.rb +4 -0
- data/lib/xlsxrb/ooxml/shared_strings_parser.rb +104 -40
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +144 -23
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +160 -145
- data/lib/xlsxrb/ooxml/xml_builder.rb +16 -10
- data/lib/xlsxrb/ooxml/zip_reader.rb +104 -18
- data/lib/xlsxrb/ooxml/zip_writer.rb +63 -25
- data/lib/xlsxrb/style_builder.rb +158 -30
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb.rb +443 -236
- data/rbs_collection.lock.yaml +28 -0
- data/sig/generated/xlsxrb/elements/cell.rbs +30 -0
- data/sig/generated/xlsxrb/elements/column.rbs +30 -0
- data/sig/generated/xlsxrb/elements/row.rbs +32 -0
- data/sig/generated/xlsxrb/elements/types.rbs +74 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +25 -0
- data/sig/generated/xlsxrb/elements/worksheet.rbs +27 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +1412 -0
- data/sig/generated/xlsxrb/ooxml/shared_strings_parser.rbs +21 -0
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +44 -0
- data/sig/generated/xlsxrb/ooxml/utils.rbs +40 -0
- data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +46 -0
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +66 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +67 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +92 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +880 -0
- data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +45 -0
- data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +30 -0
- data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +38 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +45 -0
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +45 -0
- data/sig/generated/xlsxrb/style_builder.rbs +212 -50
- data/sig/generated/xlsxrb.rbs +1276 -0
- data/sig/rexml.rbs +4 -0
- metadata +76 -1
data/lib/xlsxrb/style_builder.rb
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
module Xlsxrb
|
|
6
6
|
# Helper class for building cell styles with a fluent DSL.
|
|
7
7
|
# Encapsulates font, fill, border, alignment, and number format properties.
|
|
8
|
+
# @api public
|
|
8
9
|
class StyleBuilder
|
|
9
10
|
COLORS = {
|
|
10
11
|
black: "FF000000",
|
|
@@ -29,7 +30,7 @@ module Xlsxrb
|
|
|
29
30
|
color.to_s
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
#: (?String? name) -> void
|
|
33
34
|
def initialize(name = nil)
|
|
34
35
|
@name = name
|
|
35
36
|
@font_props = {}
|
|
@@ -43,7 +44,12 @@ module Xlsxrb
|
|
|
43
44
|
|
|
44
45
|
# Applies option-style definitions so callers can use add_style(name, **opts)
|
|
45
46
|
# as an alternative to block-based fluent chaining.
|
|
46
|
-
#
|
|
47
|
+
# Applies option-style definitions so callers can use add_style(name, **opts)
|
|
48
|
+
# as an alternative to block-based fluent chaining.
|
|
49
|
+
# @param opts [Hash] The styling options.
|
|
50
|
+
# @return [self]
|
|
51
|
+
# @api public
|
|
52
|
+
#: (**untyped) -> self
|
|
47
53
|
def apply_options!(**opts)
|
|
48
54
|
if opts.key?(:font)
|
|
49
55
|
font_opts = opts[:font] || {}
|
|
@@ -129,7 +135,11 @@ module Xlsxrb
|
|
|
129
135
|
|
|
130
136
|
# --- Font Properties ---
|
|
131
137
|
|
|
132
|
-
#
|
|
138
|
+
# Configures multiple font properties at once.
|
|
139
|
+
# @param opts [Hash] The font properties.
|
|
140
|
+
# @return [self]
|
|
141
|
+
# @api public
|
|
142
|
+
#: (**untyped) -> self
|
|
133
143
|
def font(**opts)
|
|
134
144
|
bold(opts[:bold]) if opts.key?(:bold)
|
|
135
145
|
italic(opts[:italic]) if opts.key?(:italic)
|
|
@@ -143,49 +153,81 @@ module Xlsxrb
|
|
|
143
153
|
end
|
|
144
154
|
|
|
145
155
|
# rubocop:disable Style/OptionalBooleanParameter
|
|
146
|
-
#
|
|
156
|
+
# Sets the font to bold.
|
|
157
|
+
# @param value [Boolean] Whether to apply bold.
|
|
158
|
+
# @return [self]
|
|
159
|
+
# @api public
|
|
160
|
+
#: (?bool) -> self
|
|
147
161
|
def bold(value = true)
|
|
148
162
|
@font_props[:bold] = value
|
|
149
163
|
self
|
|
150
164
|
end
|
|
151
165
|
|
|
152
|
-
#
|
|
166
|
+
# Sets the font to italic.
|
|
167
|
+
# @param value [Boolean] Whether to apply italic.
|
|
168
|
+
# @return [self]
|
|
169
|
+
# @api public
|
|
170
|
+
#: (?bool) -> self
|
|
153
171
|
def italic(value = true)
|
|
154
172
|
@font_props[:italic] = value
|
|
155
173
|
self
|
|
156
174
|
end
|
|
157
175
|
|
|
158
|
-
#
|
|
176
|
+
# Sets the font size.
|
|
177
|
+
# @param size_value [Numeric] The size.
|
|
178
|
+
# @return [self]
|
|
179
|
+
# @api public
|
|
180
|
+
#: (Numeric) -> self
|
|
159
181
|
def size(size_value)
|
|
160
182
|
@font_props[:sz] = size_value.to_i
|
|
161
183
|
self
|
|
162
184
|
end
|
|
163
185
|
|
|
164
|
-
#
|
|
186
|
+
# Sets the font name.
|
|
187
|
+
# @param name [String] The font name.
|
|
188
|
+
# @return [self]
|
|
189
|
+
# @api public
|
|
190
|
+
#: (String) -> self
|
|
165
191
|
def font_name(name)
|
|
166
192
|
@font_props[:name] = name
|
|
167
193
|
self
|
|
168
194
|
end
|
|
169
195
|
|
|
170
|
-
#
|
|
196
|
+
# Sets the font color.
|
|
197
|
+
# @param color [String, Symbol] The color.
|
|
198
|
+
# @return [self]
|
|
199
|
+
# @api public
|
|
200
|
+
#: (String | Symbol) -> self
|
|
171
201
|
def font_color(color)
|
|
172
202
|
@font_props[:color] = resolve_color(color)
|
|
173
203
|
self
|
|
174
204
|
end
|
|
175
205
|
|
|
176
|
-
#
|
|
206
|
+
# Sets the font underline style.
|
|
207
|
+
# @param val [String] The underline style (e.g., 'single').
|
|
208
|
+
# @return [self]
|
|
209
|
+
# @api public
|
|
210
|
+
#: (?String) -> self
|
|
177
211
|
def underline(val = "single")
|
|
178
212
|
@font_props[:underline] = val
|
|
179
213
|
self
|
|
180
214
|
end
|
|
181
215
|
|
|
182
|
-
#
|
|
216
|
+
# Sets the font strikethrough.
|
|
217
|
+
# @param value [Boolean] Whether to apply strike.
|
|
218
|
+
# @return [self]
|
|
219
|
+
# @api public
|
|
220
|
+
#: (?bool) -> self
|
|
183
221
|
def strike(value = true)
|
|
184
222
|
@font_props[:strike] = value
|
|
185
223
|
self
|
|
186
224
|
end
|
|
187
225
|
|
|
188
|
-
#
|
|
226
|
+
# Sets the vertical alignment of the font.
|
|
227
|
+
# @param value [String] The alignment value.
|
|
228
|
+
# @return [self]
|
|
229
|
+
# @api public
|
|
230
|
+
#: (String) -> self
|
|
189
231
|
def vert_align(value)
|
|
190
232
|
@font_props[:vert_align] = value
|
|
191
233
|
self
|
|
@@ -194,7 +236,19 @@ module Xlsxrb
|
|
|
194
236
|
|
|
195
237
|
# --- Fill Properties ---
|
|
196
238
|
|
|
197
|
-
#
|
|
239
|
+
# Sets the fill pattern.
|
|
240
|
+
# @param pattern [String, Symbol] The pattern type.
|
|
241
|
+
# @param fg_color [String, Symbol, nil] The foreground color.
|
|
242
|
+
# @param bg_color [String, Symbol, nil] The background color.
|
|
243
|
+
# @return [self]
|
|
244
|
+
# @api public
|
|
245
|
+
# Configures fill properties.
|
|
246
|
+
# @param pattern [String, Symbol] The pattern type.
|
|
247
|
+
# @param fg_color [String, Symbol, nil] The foreground color.
|
|
248
|
+
# @param bg_color [String, Symbol, nil] The background color.
|
|
249
|
+
# @return [self]
|
|
250
|
+
# @api public
|
|
251
|
+
#: (String | Symbol pattern, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> self
|
|
198
252
|
def fill_pattern(pattern, fg_color: nil, bg_color: nil)
|
|
199
253
|
@fill_props[:pattern] = pattern
|
|
200
254
|
@fill_props[:fg_color] = fg_color if fg_color
|
|
@@ -202,19 +256,29 @@ module Xlsxrb
|
|
|
202
256
|
self
|
|
203
257
|
end
|
|
204
258
|
|
|
205
|
-
#
|
|
259
|
+
# Sets a solid fill color.
|
|
260
|
+
# @param color [String, Symbol] The color.
|
|
261
|
+
# @return [self]
|
|
262
|
+
# @api public
|
|
263
|
+
#: (String | Symbol) -> self
|
|
206
264
|
def fill_color(color)
|
|
207
265
|
@fill_props[:pattern] = "solid"
|
|
208
266
|
@fill_props[:fg_color] = resolve_color(color)
|
|
209
267
|
self
|
|
210
268
|
end
|
|
211
269
|
|
|
212
|
-
|
|
270
|
+
#: (?pattern: String | Symbol, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> self
|
|
213
271
|
def fill(pattern: "solid", fg_color: nil, bg_color: nil)
|
|
214
272
|
fill_pattern(pattern, fg_color: resolve_color(fg_color), bg_color: resolve_color(bg_color))
|
|
215
273
|
end
|
|
216
274
|
|
|
217
|
-
#
|
|
275
|
+
# Sets a gradient fill.
|
|
276
|
+
# @param type [String] The gradient type.
|
|
277
|
+
# @param degree [Numeric, nil] The degree.
|
|
278
|
+
# @param stops [Array] The gradient stops.
|
|
279
|
+
# @return [self]
|
|
280
|
+
# @api public
|
|
281
|
+
#: (type: String, ?degree: Numeric | nil, ?stops: Array[untyped]) -> self
|
|
218
282
|
def fill_gradient(type:, degree: nil, stops: [])
|
|
219
283
|
@fill_props[:gradient] = {
|
|
220
284
|
type: type,
|
|
@@ -226,7 +290,11 @@ module Xlsxrb
|
|
|
226
290
|
|
|
227
291
|
# --- Border Properties ---
|
|
228
292
|
|
|
229
|
-
#
|
|
293
|
+
# Configures multiple border properties.
|
|
294
|
+
# @param opts [Hash] Border options.
|
|
295
|
+
# @return [self]
|
|
296
|
+
# @api public
|
|
297
|
+
#: (**untyped) -> self
|
|
230
298
|
def border(**opts)
|
|
231
299
|
border_all(**opts[:all]) if opts.key?(:all) && opts[:all]
|
|
232
300
|
border_left(**opts[:left]) if opts.key?(:left) && opts[:left]
|
|
@@ -236,7 +304,12 @@ module Xlsxrb
|
|
|
236
304
|
self
|
|
237
305
|
end
|
|
238
306
|
|
|
239
|
-
#
|
|
307
|
+
# Sets all borders.
|
|
308
|
+
# @param style [String, Symbol] The border style.
|
|
309
|
+
# @param color [String, Symbol, nil] The color.
|
|
310
|
+
# @return [self]
|
|
311
|
+
# @api public
|
|
312
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil) -> self
|
|
240
313
|
def border_all(style: "thin", color: nil)
|
|
241
314
|
color_opt = color ? { color: resolve_color(color) } : {}
|
|
242
315
|
@border_props[:left] = { style: style, **color_opt }
|
|
@@ -246,32 +319,59 @@ module Xlsxrb
|
|
|
246
319
|
self
|
|
247
320
|
end
|
|
248
321
|
|
|
249
|
-
#
|
|
322
|
+
# Sets the left border.
|
|
323
|
+
# @param style [String, Symbol] The border style.
|
|
324
|
+
# @param color [String, Symbol, nil] The color.
|
|
325
|
+
# @return [self]
|
|
326
|
+
# @api public
|
|
327
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil) -> self
|
|
250
328
|
def border_left(style: "thin", color: nil)
|
|
251
329
|
@border_props[:left] = { style: style, color: resolve_color(color) }.compact
|
|
252
330
|
self
|
|
253
331
|
end
|
|
254
332
|
|
|
255
|
-
#
|
|
333
|
+
# Sets the right border.
|
|
334
|
+
# @param style [String, Symbol] The border style.
|
|
335
|
+
# @param color [String, Symbol, nil] The color.
|
|
336
|
+
# @return [self]
|
|
337
|
+
# @api public
|
|
338
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil) -> self
|
|
256
339
|
def border_right(style: "thin", color: nil)
|
|
257
340
|
@border_props[:right] = { style: style, color: resolve_color(color) }.compact
|
|
258
341
|
self
|
|
259
342
|
end
|
|
260
343
|
|
|
261
|
-
#
|
|
344
|
+
# Sets the top border.
|
|
345
|
+
# @param style [String, Symbol] The border style.
|
|
346
|
+
# @param color [String, Symbol, nil] The color.
|
|
347
|
+
# @return [self]
|
|
348
|
+
# @api public
|
|
349
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil) -> self
|
|
262
350
|
def border_top(style: "thin", color: nil)
|
|
263
351
|
@border_props[:top] = { style: style, color: resolve_color(color) }.compact
|
|
264
352
|
self
|
|
265
353
|
end
|
|
266
354
|
|
|
267
|
-
#
|
|
355
|
+
# Sets the bottom border.
|
|
356
|
+
# @param style [String, Symbol] The border style.
|
|
357
|
+
# @param color [String, Symbol, nil] The color.
|
|
358
|
+
# @return [self]
|
|
359
|
+
# @api public
|
|
360
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil) -> self
|
|
268
361
|
def border_bottom(style: "thin", color: nil)
|
|
269
362
|
@border_props[:bottom] = { style: style, color: resolve_color(color) }.compact
|
|
270
363
|
self
|
|
271
364
|
end
|
|
272
365
|
|
|
273
366
|
# rubocop:disable Naming/MethodParameterName
|
|
274
|
-
#
|
|
367
|
+
# Sets diagonal borders.
|
|
368
|
+
# @param style [String, Symbol] The border style.
|
|
369
|
+
# @param color [String, Symbol, nil] The color.
|
|
370
|
+
# @param up [Boolean] Diagonal up.
|
|
371
|
+
# @param down [Boolean] Diagonal down.
|
|
372
|
+
# @return [self]
|
|
373
|
+
# @api public
|
|
374
|
+
#: (?style: String | Symbol, ?color: String | Symbol | nil, ?up: bool, ?down: bool) -> self
|
|
275
375
|
def border_diagonal(style: "thin", color: nil, up: false, down: false)
|
|
276
376
|
@border_props[:diagonal] = { style: style, color: resolve_color(color) }.compact
|
|
277
377
|
@border_props[:diagonal_up] = true if up
|
|
@@ -282,39 +382,63 @@ module Xlsxrb
|
|
|
282
382
|
|
|
283
383
|
# --- Alignment Properties ---
|
|
284
384
|
|
|
285
|
-
#
|
|
385
|
+
# Sets horizontal alignment.
|
|
386
|
+
# @param value [String, Symbol] The alignment.
|
|
387
|
+
# @return [self]
|
|
388
|
+
# @api public
|
|
389
|
+
#: (String | Symbol) -> self
|
|
286
390
|
def align_horizontal(value)
|
|
287
391
|
@alignment[:horizontal] = value
|
|
288
392
|
self
|
|
289
393
|
end
|
|
290
394
|
|
|
291
|
-
#
|
|
395
|
+
# Sets vertical alignment.
|
|
396
|
+
# @param value [String, Symbol] The alignment.
|
|
397
|
+
# @return [self]
|
|
398
|
+
# @api public
|
|
399
|
+
#: (String | Symbol) -> self
|
|
292
400
|
def align_vertical(value)
|
|
293
401
|
@alignment[:vertical] = value
|
|
294
402
|
self
|
|
295
403
|
end
|
|
296
404
|
|
|
297
405
|
# rubocop:disable Style/OptionalBooleanParameter
|
|
298
|
-
#
|
|
406
|
+
# Sets text wrapping.
|
|
407
|
+
# @param value [Boolean] Whether to wrap text.
|
|
408
|
+
# @return [self]
|
|
409
|
+
# @api public
|
|
410
|
+
#: (?bool) -> self
|
|
299
411
|
def wrap_text(value = true)
|
|
300
412
|
@alignment[:wrap_text] = value
|
|
301
413
|
self
|
|
302
414
|
end
|
|
303
415
|
|
|
304
|
-
#
|
|
416
|
+
# Sets shrink to fit.
|
|
417
|
+
# @param value [Boolean] Whether to shrink text.
|
|
418
|
+
# @return [self]
|
|
419
|
+
# @api public
|
|
420
|
+
#: (?bool) -> self
|
|
305
421
|
def shrink_to_fit(value = true)
|
|
306
422
|
@alignment[:shrink_to_fit] = value
|
|
307
423
|
self
|
|
308
424
|
end
|
|
309
425
|
# rubocop:enable Style/OptionalBooleanParameter
|
|
310
426
|
|
|
311
|
-
#
|
|
427
|
+
# Sets text rotation.
|
|
428
|
+
# @param value [Numeric] The rotation angle.
|
|
429
|
+
# @return [self]
|
|
430
|
+
# @api public
|
|
431
|
+
#: (Numeric) -> self
|
|
312
432
|
def text_rotation(value)
|
|
313
433
|
@alignment[:text_rotation] = value
|
|
314
434
|
self
|
|
315
435
|
end
|
|
316
436
|
|
|
317
|
-
#
|
|
437
|
+
# Sets text indent.
|
|
438
|
+
# @param value [Numeric] The indent level.
|
|
439
|
+
# @return [self]
|
|
440
|
+
# @api public
|
|
441
|
+
#: (Numeric) -> self
|
|
318
442
|
def indent(value)
|
|
319
443
|
@alignment[:indent] = value.to_i
|
|
320
444
|
self
|
|
@@ -322,7 +446,11 @@ module Xlsxrb
|
|
|
322
446
|
|
|
323
447
|
# --- Number Format ---
|
|
324
448
|
|
|
325
|
-
#
|
|
449
|
+
# Sets the number format.
|
|
450
|
+
# @param num_fmt_id [String, Integer] The format id or format string.
|
|
451
|
+
# @return [self]
|
|
452
|
+
# @api public
|
|
453
|
+
#: (String | Integer) -> self
|
|
326
454
|
def number_format(num_fmt_id)
|
|
327
455
|
@num_fmt_id = num_fmt_id
|
|
328
456
|
self
|
|
@@ -331,7 +459,7 @@ module Xlsxrb
|
|
|
331
459
|
|
|
332
460
|
# Register this style with the given Writer, returning the style_id.
|
|
333
461
|
# writer:: Xlsxrb::Ooxml::Writer instance
|
|
334
|
-
|
|
462
|
+
#: (untyped writer) -> Integer
|
|
335
463
|
def register_with(writer)
|
|
336
464
|
font_id = 0
|
|
337
465
|
fill_id = 0
|
data/lib/xlsxrb/version.rb
CHANGED