xlsxrb 0.1.17 → 0.1.18
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/CHANGELOG.md +93 -1
- data/README.md +79 -19
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
- data/lib/xlsxrb/chart_builder.rb +595 -113
- data/lib/xlsxrb/dsl_helpers.rb +72 -20
- data/lib/xlsxrb/elements/cell.rb +243 -56
- data/lib/xlsxrb/elements/column.rb +94 -5
- data/lib/xlsxrb/elements/coordinate_access.rb +108 -10
- data/lib/xlsxrb/elements/image.rb +81 -15
- data/lib/xlsxrb/elements/metadata.rb +2733 -0
- data/lib/xlsxrb/elements/row.rb +130 -46
- data/lib/xlsxrb/elements/styles.rb +184 -76
- data/lib/xlsxrb/elements/types.rb +242 -7
- data/lib/xlsxrb/elements/workbook.rb +171 -82
- data/lib/xlsxrb/elements/worksheet.rb +598 -102
- data/lib/xlsxrb/elements.rb +1 -0
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +12 -4
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -2
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +264 -17
- data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
- data/lib/xlsxrb/ooxml/reader.rb +4 -0
- data/lib/xlsxrb/ooxml/styles_parser.rb +10 -3
- data/lib/xlsxrb/ooxml/workbook_writer.rb +90 -36
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +2 -2
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +64 -19
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +5 -2
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +26 -5
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +19 -9
- data/lib/xlsxrb/ooxml/writer.rb +22 -6
- data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
- data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
- data/lib/xlsxrb/stream_row.rb +97 -18
- data/lib/xlsxrb/stream_sheet.rb +706 -190
- data/lib/xlsxrb/stream_writer.rb +1893 -374
- data/lib/xlsxrb/style_builder.rb +774 -111
- data/lib/xlsxrb/utils.rb +66 -106
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +380 -83
- data/lib/xlsxrb/worksheet_builder.rb +1210 -233
- data/lib/xlsxrb.rb +1266 -326
- data/sig/generated/xlsxrb/chart_builder.rbs +319 -90
- data/sig/generated/xlsxrb/dsl_helpers.rbs +20 -2
- data/sig/generated/xlsxrb/elements/cell.rbs +92 -20
- data/sig/generated/xlsxrb/elements/column.rbs +61 -2
- data/sig/generated/xlsxrb/elements/coordinate_access.rbs +49 -7
- data/sig/generated/xlsxrb/elements/image.rbs +30 -8
- data/sig/generated/xlsxrb/elements/metadata.rbs +1587 -0
- data/sig/generated/xlsxrb/elements/row.rbs +61 -21
- data/sig/generated/xlsxrb/elements/styles.rbs +96 -58
- data/sig/generated/xlsxrb/elements/types.rbs +27 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +63 -52
- data/sig/generated/xlsxrb/elements/worksheet.rbs +192 -51
- data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/writer.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
- data/sig/generated/xlsxrb/stream_row.rbs +48 -14
- data/sig/generated/xlsxrb/stream_sheet.rbs +324 -115
- data/sig/generated/xlsxrb/stream_writer.rbs +1068 -255
- data/sig/generated/xlsxrb/style_builder.rbs +389 -79
- data/sig/generated/xlsxrb/utils.rbs +34 -18
- data/sig/generated/xlsxrb/workbook_builder.rbs +234 -34
- data/sig/generated/xlsxrb/worksheet_builder.rbs +628 -126
- data/sig/generated/xlsxrb.rbs +257 -49
- metadata +3 -1
|
@@ -53,8 +53,15 @@ module Xlsxrb
|
|
|
53
53
|
# @param pad_empty_rows [Boolean] Whether to yield empty rows for skipped row numbers.
|
|
54
54
|
# @param pad_empty_cells [Boolean] Whether to pad missing cells within rows.
|
|
55
55
|
# @param images [Array<Elements::Image>, nil] Optional preloaded images array.
|
|
56
|
-
#
|
|
57
|
-
|
|
56
|
+
# @param defined_names [Array<Hash, Elements::DefinedName>, nil] Optional workbook defined names.
|
|
57
|
+
# @param sheet_index [Integer, nil] 0-based worksheet index.
|
|
58
|
+
# @param charts [Array<Elements::Chart>, nil] Optional preloaded charts.
|
|
59
|
+
# @param sparkline_groups [Array<Elements::SparklineGroup>, nil] Optional preloaded sparkline groups.
|
|
60
|
+
# @param print_area [String, nil] Optional print area range.
|
|
61
|
+
# @param print_titles [Elements::PrintTitles, nil] Optional repeating print titles.
|
|
62
|
+
# @param header_footer_images [Array<Elements::HeaderFooterImage>, nil] Optional preloaded header/footer images.
|
|
63
|
+
# : (String name, untyped sheet_source, Array[String] shared_strings, ?(Elements::Styles | Hash[untyped, untyped])? styles, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?state: Symbol, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?images: Array[Elements::Image]?, ?defined_names: Array[untyped]?, ?sheet_index: Integer?, ?charts: Array[Elements::Chart]?, ?sparkline_groups: Array[Elements::SparklineGroup]?, ?print_area: String?, ?print_titles: Elements::PrintTitles?, ?header_footer_images: Array[Elements::HeaderFooterImage]?) -> void
|
|
64
|
+
def initialize: (String name, untyped sheet_source, Array[String] shared_strings, ?(Elements::Styles | Hash[untyped, untyped])? styles, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?state: Symbol, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?images: Array[Elements::Image]?, ?defined_names: Array[untyped]?, ?sheet_index: Integer?, ?charts: Array[Elements::Chart]?, ?sparkline_groups: Array[Elements::SparklineGroup]?, ?print_area: String?, ?print_titles: Elements::PrintTitles?, ?header_footer_images: Array[Elements::HeaderFooterImage]?) -> void
|
|
58
65
|
|
|
59
66
|
# Returns whether trailing empty rows are omitted during iteration.
|
|
60
67
|
#
|
|
@@ -63,7 +70,9 @@ module Xlsxrb
|
|
|
63
70
|
# : () -> bool
|
|
64
71
|
def trim_empty_rows?: () -> bool
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
# @deprecated Use {#trim_empty_rows?} instead. Will be removed in 0.2.0.
|
|
74
|
+
# : () -> bool
|
|
75
|
+
def trim_empty_rows: () -> bool
|
|
67
76
|
|
|
68
77
|
# Returns whether skipped rows are padded during iteration.
|
|
69
78
|
#
|
|
@@ -72,7 +81,9 @@ module Xlsxrb
|
|
|
72
81
|
# : () -> bool
|
|
73
82
|
def pad_empty_rows?: () -> bool
|
|
74
83
|
|
|
75
|
-
|
|
84
|
+
# @deprecated Use {#pad_empty_rows?} instead. Will be removed in 0.2.0.
|
|
85
|
+
# : () -> bool
|
|
86
|
+
def pad_empty_rows: () -> bool
|
|
76
87
|
|
|
77
88
|
# Returns whether missing cells within rows are padded during iteration.
|
|
78
89
|
#
|
|
@@ -81,7 +92,9 @@ module Xlsxrb
|
|
|
81
92
|
# : () -> bool
|
|
82
93
|
def pad_empty_cells?: () -> bool
|
|
83
94
|
|
|
84
|
-
|
|
95
|
+
# @deprecated Use {#pad_empty_cells?} instead. Will be removed in 0.2.0.
|
|
96
|
+
# : () -> bool
|
|
97
|
+
def pad_empty_cells: () -> bool
|
|
85
98
|
|
|
86
99
|
# Returns the dimension reference string (e.g. "A1:Z50000"), or nil if not present.
|
|
87
100
|
#
|
|
@@ -92,36 +105,76 @@ module Xlsxrb
|
|
|
92
105
|
|
|
93
106
|
# Returns the 1-based index of the first row defined in the sheet dimension, or nil.
|
|
94
107
|
#
|
|
108
|
+
# @deprecated Returning an Integer row number is deprecated and will be removed in 0.2.0. Use {#row_range} or {#dimension_bounds} for row boundaries.
|
|
95
109
|
# @return [Integer, nil]
|
|
96
110
|
# @api public
|
|
97
111
|
# : () -> Integer?
|
|
98
112
|
def first_row: () -> Integer?
|
|
99
113
|
|
|
114
|
+
# Returns the 0-based index of the first column defined in the sheet dimension, or nil.
|
|
115
|
+
#
|
|
116
|
+
# @return [Integer, nil]
|
|
117
|
+
# @api public
|
|
118
|
+
# : () -> Integer?
|
|
119
|
+
def first_column_index: () -> Integer?
|
|
120
|
+
|
|
100
121
|
# Returns the 1-based index of the first column defined in the sheet dimension, or nil.
|
|
101
122
|
#
|
|
123
|
+
# @deprecated Use 0-based {#first_column_index} instead. Will be removed in 0.2.0.
|
|
102
124
|
# @return [Integer, nil]
|
|
103
125
|
# @api public
|
|
104
126
|
# : () -> Integer?
|
|
105
127
|
def first_column: () -> Integer?
|
|
106
128
|
|
|
129
|
+
# @deprecated Use {#first_column_index} instead. Will be removed in 0.2.0.
|
|
107
130
|
alias first_col first_column
|
|
108
131
|
|
|
109
132
|
# Returns the 1-based index of the last row defined in the sheet dimension, or nil.
|
|
110
133
|
#
|
|
134
|
+
# @deprecated Returning an Integer row number is deprecated and will be removed in 0.2.0. Use {#row_range} or {#dimension_bounds} for row boundaries.
|
|
111
135
|
# @return [Integer, nil]
|
|
112
136
|
# @api public
|
|
113
137
|
# : () -> Integer?
|
|
114
138
|
def last_row: () -> Integer?
|
|
115
139
|
|
|
140
|
+
# Returns the 0-based index of the last column defined in the sheet dimension, or nil.
|
|
141
|
+
#
|
|
142
|
+
# @return [Integer, nil]
|
|
143
|
+
# @api public
|
|
144
|
+
# : () -> Integer?
|
|
145
|
+
def last_column_index: () -> Integer?
|
|
146
|
+
|
|
116
147
|
# Returns the 1-based index of the last column defined in the sheet dimension, or nil.
|
|
117
148
|
#
|
|
149
|
+
# @deprecated Use 0-based {#last_column_index} instead. Will be removed in 0.2.0.
|
|
118
150
|
# @return [Integer, nil]
|
|
119
151
|
# @api public
|
|
120
152
|
# : () -> Integer?
|
|
121
153
|
def last_column: () -> Integer?
|
|
122
154
|
|
|
155
|
+
# @deprecated Use {#last_column_index} instead. Will be removed in 0.2.0.
|
|
123
156
|
alias last_col last_column
|
|
124
157
|
|
|
158
|
+
# Returns the 0-based range of rows defined in the sheet dimension, or nil.
|
|
159
|
+
#
|
|
160
|
+
# @example
|
|
161
|
+
# sheet.row_range #=> 0..9
|
|
162
|
+
#
|
|
163
|
+
# @return [Range<Integer>, nil]
|
|
164
|
+
# @api public
|
|
165
|
+
# : () -> Range[Integer]?
|
|
166
|
+
def row_range: () -> Range[Integer]?
|
|
167
|
+
|
|
168
|
+
# Returns the 0-based range of columns defined in the sheet dimension, or nil.
|
|
169
|
+
#
|
|
170
|
+
# @example
|
|
171
|
+
# sheet.column_range #=> 0..4
|
|
172
|
+
#
|
|
173
|
+
# @return [Range<Integer>, nil]
|
|
174
|
+
# @api public
|
|
175
|
+
# : () -> Range[Integer]?
|
|
176
|
+
def column_range: () -> Range[Integer]?
|
|
177
|
+
|
|
125
178
|
# Returns whether the sheet uses the 1904 date system.
|
|
126
179
|
#
|
|
127
180
|
# @return [Boolean]
|
|
@@ -246,69 +299,80 @@ module Xlsxrb
|
|
|
246
299
|
# : () -> Elements::Worksheet
|
|
247
300
|
def load: () -> Elements::Worksheet
|
|
248
301
|
|
|
249
|
-
|
|
302
|
+
# @deprecated Use {Xlsxrb.load} instead. Will be removed in 0.2.0.
|
|
303
|
+
# : () -> Elements::Worksheet
|
|
304
|
+
def to_worksheet: () -> Elements::Worksheet
|
|
250
305
|
|
|
251
|
-
# Returns hyperlinks configured for this worksheet as a Hash of cell references to
|
|
306
|
+
# Returns hyperlinks configured for this worksheet as a Hash of cell references to {Elements::Hyperlink} objects.
|
|
252
307
|
#
|
|
253
|
-
# @return [Hash<String,
|
|
308
|
+
# @return [Hash<String, Elements::Hyperlink>]
|
|
254
309
|
# @api public
|
|
255
|
-
# : () -> Hash[String,
|
|
256
|
-
def hyperlinks: () -> Hash[String,
|
|
310
|
+
# : () -> Hash[String, Elements::Hyperlink]
|
|
311
|
+
def hyperlinks: () -> Hash[String, Elements::Hyperlink]
|
|
257
312
|
|
|
258
313
|
# Returns hyperlink metadata for a specific cell reference, or nil.
|
|
259
314
|
#
|
|
260
315
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
261
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
262
|
-
# @return [
|
|
316
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
317
|
+
# @return [Elements::Hyperlink, nil]
|
|
263
318
|
# @api public
|
|
264
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
265
|
-
def hyperlink: (String | Symbol | Integer ref_or_row, ?Integer
|
|
319
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Hyperlink?
|
|
320
|
+
def hyperlink: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Hyperlink?
|
|
266
321
|
|
|
267
|
-
# Returns comments configured for this worksheet as an Array of
|
|
322
|
+
# Returns comments configured for this worksheet as an Array of {Elements::Comment} objects.
|
|
268
323
|
#
|
|
269
|
-
# @return [Array<
|
|
324
|
+
# @return [Array<Elements::Comment>]
|
|
270
325
|
# @api public
|
|
271
|
-
# : () -> Array[
|
|
272
|
-
def comments: () -> Array[
|
|
326
|
+
# : () -> Array[Elements::Comment]
|
|
327
|
+
def comments: () -> Array[Elements::Comment]
|
|
273
328
|
|
|
274
329
|
# Returns comment metadata for a specific cell reference, or nil.
|
|
275
330
|
#
|
|
276
331
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
277
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
278
|
-
# @return [
|
|
332
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
333
|
+
# @return [Elements::Comment, nil]
|
|
279
334
|
# @api public
|
|
280
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
281
|
-
def comment: (String | Symbol | Integer ref_or_row, ?Integer
|
|
335
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Comment?
|
|
336
|
+
def comment: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Comment?
|
|
282
337
|
|
|
283
338
|
# Returns comments indexed by cell reference.
|
|
284
339
|
#
|
|
285
|
-
# @return [Hash<String,
|
|
340
|
+
# @return [Hash<String, Elements::Comment>]
|
|
286
341
|
# @api public
|
|
287
|
-
# : () -> Hash[String,
|
|
288
|
-
def comments_by_ref: () -> Hash[String,
|
|
342
|
+
# : () -> Hash[String, Elements::Comment]
|
|
343
|
+
def comments_by_ref: () -> Hash[String, Elements::Comment]
|
|
289
344
|
|
|
290
|
-
# Returns threaded comments configured for this worksheet as an Array of
|
|
345
|
+
# Returns threaded comments configured for this worksheet as an Array of {Elements::ThreadedComment} objects.
|
|
291
346
|
#
|
|
292
|
-
# @return [Array<
|
|
347
|
+
# @return [Array<Elements::ThreadedComment>]
|
|
293
348
|
# @api public
|
|
294
|
-
# : () -> Array[
|
|
295
|
-
def threaded_comments: () -> Array[
|
|
349
|
+
# : () -> Array[Elements::ThreadedComment]
|
|
350
|
+
def threaded_comments: () -> Array[Elements::ThreadedComment]
|
|
351
|
+
|
|
352
|
+
# Returns the root threaded comment for a specific cell reference, or nil.
|
|
353
|
+
#
|
|
354
|
+
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
355
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
356
|
+
# @return [Elements::ThreadedComment, nil]
|
|
357
|
+
# @api public
|
|
358
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::ThreadedComment?
|
|
359
|
+
def threaded_comment: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::ThreadedComment?
|
|
296
360
|
|
|
297
361
|
# Returns threaded comments for a specific cell reference, or empty array.
|
|
298
362
|
#
|
|
299
363
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
300
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
301
|
-
# @return [Array<
|
|
364
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
365
|
+
# @return [Array<Elements::ThreadedComment>]
|
|
302
366
|
# @api public
|
|
303
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
304
|
-
def
|
|
367
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::ThreadedComment]
|
|
368
|
+
def threaded_comments_at: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::ThreadedComment]
|
|
305
369
|
|
|
306
370
|
# Returns threaded comments indexed by cell reference.
|
|
307
371
|
#
|
|
308
|
-
# @return [Hash<String, Array<
|
|
372
|
+
# @return [Hash<String, Array<Elements::ThreadedComment>>]
|
|
309
373
|
# @api public
|
|
310
|
-
# : () -> Hash[String, Array[
|
|
311
|
-
def threaded_comments_by_ref: () -> Hash[String, Array[
|
|
374
|
+
# : () -> Hash[String, Array[Elements::ThreadedComment]]
|
|
375
|
+
def threaded_comments_by_ref: () -> Hash[String, Array[Elements::ThreadedComment]]
|
|
312
376
|
|
|
313
377
|
# Returns all embedded images in this worksheet.
|
|
314
378
|
#
|
|
@@ -320,14 +384,15 @@ module Xlsxrb
|
|
|
320
384
|
# Returns all images anchored at a specific cell reference or 0-based coordinate.
|
|
321
385
|
#
|
|
322
386
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
323
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
387
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
324
388
|
# @return [Array<Elements::Image>]
|
|
325
389
|
# @api public
|
|
326
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
327
|
-
def images_at: (String | Symbol | Integer ref_or_row, ?Integer
|
|
390
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::Image]
|
|
391
|
+
def images_at: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::Image]
|
|
328
392
|
|
|
329
393
|
# Loads and returns images for this worksheet, optionally yielding self for block syntax.
|
|
330
394
|
#
|
|
395
|
+
# @deprecated Access {#images} directly. Lazy-loading is automatic. Will be removed in 0.2.0.
|
|
331
396
|
# @yield [sheet]
|
|
332
397
|
# @yieldparam sheet [StreamSheet]
|
|
333
398
|
# @return [StreamSheet, void]
|
|
@@ -339,21 +404,23 @@ module Xlsxrb
|
|
|
339
404
|
|
|
340
405
|
# Access a cell by reference or 0-based coordinates.
|
|
341
406
|
#
|
|
407
|
+
# @deprecated Use `ws = Xlsxrb.load(source)` to materialize an {Elements::Worksheet} and use {Elements::CoordinateAccess#[]} (e.g. ws["A1"] or ws[0, 0]). Will be removed in 0.2.0.
|
|
342
408
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
343
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
409
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
|
|
344
410
|
# @return [Elements::Cell, nil]
|
|
345
411
|
# @api public
|
|
346
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
347
|
-
def cell: (String | Symbol | Integer ref_or_row, ?Integer
|
|
412
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
|
|
413
|
+
def cell: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
|
|
348
414
|
|
|
349
415
|
# Returns the formatted string representation of a cell's value.
|
|
350
416
|
#
|
|
417
|
+
# @deprecated Use `ws = Xlsxrb.load(source)` to materialize an {Elements::Worksheet} and access `ws["A1"].formatted_value`. Will be removed in 0.2.0.
|
|
351
418
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
352
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
419
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
|
|
353
420
|
# @return [String, nil]
|
|
354
421
|
# @api public
|
|
355
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
356
|
-
def formatted_value: (String | Symbol | Integer ref_or_row, ?Integer
|
|
422
|
+
# : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
|
|
423
|
+
def formatted_value: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
|
|
357
424
|
|
|
358
425
|
# Returns merged cell ranges (e.g. ["A1:B2"]) for this worksheet.
|
|
359
426
|
#
|
|
@@ -369,70 +436,108 @@ module Xlsxrb
|
|
|
369
436
|
# : () -> String?
|
|
370
437
|
def auto_filter: () -> String?
|
|
371
438
|
|
|
439
|
+
# Returns column filter rules defined for this worksheet.
|
|
440
|
+
#
|
|
441
|
+
# @return [Hash<Integer, Elements::FilterColumn>]
|
|
442
|
+
# @api public
|
|
443
|
+
# : () -> Hash[Integer, Elements::FilterColumn]
|
|
444
|
+
def filter_columns: () -> Hash[Integer, Elements::FilterColumn]
|
|
445
|
+
|
|
372
446
|
# Returns data validation rules configured for this worksheet.
|
|
373
447
|
#
|
|
374
|
-
# @return [Array<
|
|
448
|
+
# @return [Array<Elements::DataValidation>]
|
|
375
449
|
# @api public
|
|
376
|
-
# : () -> Array[
|
|
377
|
-
def data_validations: () -> Array[
|
|
450
|
+
# : () -> Array[Elements::DataValidation]
|
|
451
|
+
def data_validations: () -> Array[Elements::DataValidation]
|
|
378
452
|
|
|
379
453
|
# Returns conditional formatting rules configured for this worksheet.
|
|
380
454
|
#
|
|
381
|
-
#
|
|
455
|
+
# Corresponds to ECMA-376 Part 4 §18.3.1.18 (<conditionalFormatting> and <cfRule> elements).
|
|
456
|
+
#
|
|
457
|
+
# @return [Array<Elements::ConditionalFormat>]
|
|
382
458
|
# @api public
|
|
383
|
-
# : () -> Array[
|
|
384
|
-
def conditional_formats: () -> Array[
|
|
459
|
+
# : () -> Array[Elements::ConditionalFormat]
|
|
460
|
+
def conditional_formats: () -> Array[Elements::ConditionalFormat]
|
|
385
461
|
|
|
462
|
+
# @deprecated Use {#conditional_formats} instead. Matches the ECMA-376 XML element name (<conditionalFormatting>), but {#conditional_formats} is canonical in xlsxrb. Will be removed in version 0.2.0.
|
|
386
463
|
alias conditional_formatting conditional_formats
|
|
387
464
|
|
|
388
465
|
# Returns tables defined in this worksheet.
|
|
389
466
|
#
|
|
390
|
-
# @return [Array<
|
|
467
|
+
# @return [Array<Elements::Table>]
|
|
391
468
|
# @api public
|
|
392
|
-
# : () -> Array[
|
|
393
|
-
def tables: () -> Array[
|
|
469
|
+
# : () -> Array[Elements::Table]
|
|
470
|
+
def tables: () -> Array[Elements::Table]
|
|
471
|
+
|
|
472
|
+
# Returns pivot tables defined in this worksheet.
|
|
473
|
+
#
|
|
474
|
+
# @return [Array<Elements::PivotTable>]
|
|
475
|
+
# @api public
|
|
476
|
+
# : () -> Array[Elements::PivotTable]
|
|
477
|
+
def pivot_tables: () -> Array[Elements::PivotTable]
|
|
394
478
|
|
|
395
479
|
# Returns shapes defined in this worksheet.
|
|
396
480
|
#
|
|
397
|
-
# @return [Array<
|
|
481
|
+
# @return [Array<Elements::Shape>]
|
|
398
482
|
# @api public
|
|
399
|
-
# : () -> Array[
|
|
400
|
-
def shapes: () -> Array[
|
|
483
|
+
# : () -> Array[Elements::Shape]
|
|
484
|
+
def shapes: () -> Array[Elements::Shape]
|
|
401
485
|
|
|
402
486
|
# Returns freeze pane settings for this worksheet, or nil if none.
|
|
403
487
|
#
|
|
404
|
-
# @return [
|
|
488
|
+
# @return [Elements::FreezePane, nil]
|
|
405
489
|
# @api public
|
|
406
|
-
# : () ->
|
|
407
|
-
def freeze_pane: () ->
|
|
490
|
+
# : () -> Elements::FreezePane?
|
|
491
|
+
def freeze_pane: () -> Elements::FreezePane?
|
|
492
|
+
|
|
493
|
+
# Returns split pane settings for this worksheet, or nil if none.
|
|
494
|
+
#
|
|
495
|
+
# @return [Elements::SplitPane, nil]
|
|
496
|
+
# @api public
|
|
497
|
+
# : () -> Elements::SplitPane?
|
|
498
|
+
def split_pane: () -> Elements::SplitPane?
|
|
408
499
|
|
|
409
500
|
# Returns sheet view properties for this worksheet.
|
|
410
501
|
#
|
|
411
|
-
# @return [
|
|
502
|
+
# @return [Elements::SheetView]
|
|
412
503
|
# @api public
|
|
413
|
-
# : () ->
|
|
414
|
-
def sheet_view: () ->
|
|
504
|
+
# : () -> Elements::SheetView
|
|
505
|
+
def sheet_view: () -> Elements::SheetView
|
|
506
|
+
|
|
507
|
+
# Returns sheet views for this worksheet.
|
|
508
|
+
#
|
|
509
|
+
# @return [Array<Elements::SheetView>]
|
|
510
|
+
# @api public
|
|
511
|
+
# : () -> Array[Elements::SheetView]
|
|
512
|
+
def sheet_views: () -> Array[Elements::SheetView]
|
|
513
|
+
|
|
514
|
+
# Returns sort state configuration for this worksheet, or nil if none.
|
|
515
|
+
#
|
|
516
|
+
# @return [Elements::SortState, nil]
|
|
517
|
+
# @api public
|
|
518
|
+
# : () -> Elements::SortState?
|
|
519
|
+
def sort_state: () -> Elements::SortState?
|
|
415
520
|
|
|
416
521
|
# Returns selection settings for this worksheet, or nil if none.
|
|
417
522
|
#
|
|
418
|
-
# @return [
|
|
523
|
+
# @return [Elements::Selection, nil]
|
|
419
524
|
# @api public
|
|
420
|
-
# : () ->
|
|
421
|
-
def selection: () ->
|
|
525
|
+
# : () -> Elements::Selection?
|
|
526
|
+
def selection: () -> Elements::Selection?
|
|
422
527
|
|
|
423
528
|
# Returns sheet protection settings as a hash, or nil if unprotected.
|
|
424
529
|
#
|
|
425
|
-
# @return [
|
|
530
|
+
# @return [Elements::SheetProtection, nil]
|
|
426
531
|
# @api public
|
|
427
|
-
# : () ->
|
|
428
|
-
def sheet_protection: () ->
|
|
532
|
+
# : () -> Elements::SheetProtection?
|
|
533
|
+
def sheet_protection: () -> Elements::SheetProtection?
|
|
429
534
|
|
|
430
535
|
# Returns sheet-level properties (tabColor, outlinePr, sheetPr) for this worksheet.
|
|
431
536
|
#
|
|
432
|
-
# @return [
|
|
537
|
+
# @return [Elements::SheetProperties]
|
|
433
538
|
# @api public
|
|
434
|
-
# : () ->
|
|
435
|
-
def sheet_properties: () ->
|
|
539
|
+
# : () -> Elements::SheetProperties
|
|
540
|
+
def sheet_properties: () -> Elements::SheetProperties
|
|
436
541
|
|
|
437
542
|
# Returns the internal VBA or application code name of the worksheet, or nil if not specified.
|
|
438
543
|
#
|
|
@@ -448,7 +553,9 @@ module Xlsxrb
|
|
|
448
553
|
# : () -> bool
|
|
449
554
|
def fit_to_page?: () -> bool
|
|
450
555
|
|
|
451
|
-
|
|
556
|
+
# @deprecated Use {#fit_to_page?} instead. Will be removed in 0.2.0.
|
|
557
|
+
# : () -> bool
|
|
558
|
+
def fit_to_page: () -> bool
|
|
452
559
|
|
|
453
560
|
# Returns whether full calculation on load is enabled on this worksheet.
|
|
454
561
|
#
|
|
@@ -457,16 +564,24 @@ module Xlsxrb
|
|
|
457
564
|
# : () -> bool
|
|
458
565
|
def full_calc_on_load?: () -> bool
|
|
459
566
|
|
|
460
|
-
|
|
567
|
+
# @deprecated Use {#full_calc_on_load?} instead. Will be removed in 0.2.0.
|
|
568
|
+
# : () -> bool
|
|
569
|
+
def full_calc_on_load: () -> bool
|
|
461
570
|
|
|
462
571
|
# Returns sheet calculation properties (<sheetCalcPr>), or nil if not present.
|
|
463
572
|
#
|
|
464
|
-
# @return [
|
|
573
|
+
# @return [Elements::SheetCalcProperties, nil]
|
|
465
574
|
# @api public
|
|
466
|
-
# : () ->
|
|
467
|
-
def
|
|
575
|
+
# : () -> Elements::SheetCalcProperties?
|
|
576
|
+
def sheet_calc_properties: () -> Elements::SheetCalcProperties?
|
|
577
|
+
|
|
578
|
+
# @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
|
|
579
|
+
# : () -> Elements::SheetCalcProperties?
|
|
580
|
+
def sheet_calc_pr: () -> Elements::SheetCalcProperties?
|
|
468
581
|
|
|
469
|
-
|
|
582
|
+
# @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
|
|
583
|
+
# : () -> Elements::SheetCalcProperties?
|
|
584
|
+
def calc_pr: () -> Elements::SheetCalcProperties?
|
|
470
585
|
|
|
471
586
|
# Returns the worksheet tab color specification, or nil if not set.
|
|
472
587
|
#
|
|
@@ -482,63 +597,68 @@ module Xlsxrb
|
|
|
482
597
|
# : () -> Hash[Symbol, untyped]
|
|
483
598
|
def outline_properties: () -> Hash[Symbol, untyped]
|
|
484
599
|
|
|
600
|
+
# @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
|
|
485
601
|
alias outline_pr outline_properties
|
|
486
602
|
|
|
487
603
|
# Returns sheet format properties (defaultRowHeight, defaultColWidth, baseColWidth) for this worksheet.
|
|
488
604
|
#
|
|
489
|
-
# @return [
|
|
605
|
+
# @return [Elements::SheetFormat]
|
|
490
606
|
# @api public
|
|
491
|
-
# : () ->
|
|
492
|
-
def sheet_format: () ->
|
|
607
|
+
# : () -> Elements::SheetFormat
|
|
608
|
+
def sheet_format: () -> Elements::SheetFormat
|
|
493
609
|
|
|
494
610
|
# Returns page setup configurations for this worksheet.
|
|
495
611
|
#
|
|
496
|
-
# @return [
|
|
612
|
+
# @return [Elements::PageSetup]
|
|
497
613
|
# @api public
|
|
498
|
-
# : () ->
|
|
499
|
-
def page_setup: () ->
|
|
614
|
+
# : () -> Elements::PageSetup
|
|
615
|
+
def page_setup: () -> Elements::PageSetup
|
|
500
616
|
|
|
501
617
|
# Returns page margins for this worksheet, or nil if none.
|
|
502
618
|
#
|
|
503
|
-
# @return [
|
|
619
|
+
# @return [Elements::PageMargins, nil]
|
|
504
620
|
# @api public
|
|
505
|
-
# : () ->
|
|
506
|
-
def page_margins: () ->
|
|
621
|
+
# : () -> Elements::PageMargins?
|
|
622
|
+
def page_margins: () -> Elements::PageMargins?
|
|
507
623
|
|
|
508
624
|
# Returns header/footer configurations for this worksheet.
|
|
509
625
|
#
|
|
510
|
-
# @return [
|
|
626
|
+
# @return [Elements::HeaderFooter]
|
|
511
627
|
# @api public
|
|
512
|
-
# : () ->
|
|
513
|
-
def header_footer: () ->
|
|
628
|
+
# : () -> Elements::HeaderFooter
|
|
629
|
+
def header_footer: () -> Elements::HeaderFooter
|
|
514
630
|
|
|
515
631
|
# Returns print options for this worksheet.
|
|
516
632
|
#
|
|
517
|
-
# @return [
|
|
633
|
+
# @return [Elements::PrintOptions]
|
|
518
634
|
# @api public
|
|
519
|
-
# : () ->
|
|
520
|
-
def print_options: () ->
|
|
635
|
+
# : () -> Elements::PrintOptions
|
|
636
|
+
def print_options: () -> Elements::PrintOptions
|
|
521
637
|
|
|
522
638
|
# Returns explicit row page breaks for this worksheet.
|
|
523
639
|
#
|
|
524
|
-
# @return [Array<
|
|
640
|
+
# @return [Array<Elements::PageBreak>]
|
|
525
641
|
# @api public
|
|
526
|
-
# : () -> Array[
|
|
527
|
-
def row_breaks: () -> Array[
|
|
642
|
+
# : () -> Array[Elements::PageBreak]
|
|
643
|
+
def row_breaks: () -> Array[Elements::PageBreak]
|
|
528
644
|
|
|
529
645
|
# Returns explicit column page breaks for this worksheet.
|
|
530
646
|
#
|
|
531
|
-
# @return [Array<
|
|
647
|
+
# @return [Array<Elements::PageBreak>]
|
|
532
648
|
# @api public
|
|
533
|
-
# : () -> Array[
|
|
534
|
-
def
|
|
649
|
+
# : () -> Array[Elements::PageBreak]
|
|
650
|
+
def column_breaks: () -> Array[Elements::PageBreak]
|
|
651
|
+
|
|
652
|
+
# @deprecated Use {#column_breaks} instead.
|
|
653
|
+
# : () -> Array[Elements::PageBreak]
|
|
654
|
+
def col_breaks: () -> Array[Elements::PageBreak]
|
|
535
655
|
|
|
536
656
|
# Returns protected ranges defined for this worksheet.
|
|
537
657
|
#
|
|
538
|
-
# @return [Array<
|
|
658
|
+
# @return [Array<Elements::ProtectedRange>]
|
|
539
659
|
# @api public
|
|
540
|
-
# : () -> Array[
|
|
541
|
-
def protected_ranges: () -> Array[
|
|
660
|
+
# : () -> Array[Elements::ProtectedRange]
|
|
661
|
+
def protected_ranges: () -> Array[Elements::ProtectedRange]
|
|
542
662
|
|
|
543
663
|
# Returns cell watch cell references defined for this worksheet.
|
|
544
664
|
#
|
|
@@ -549,37 +669,130 @@ module Xlsxrb
|
|
|
549
669
|
|
|
550
670
|
# Returns ignored error rules defined for this worksheet.
|
|
551
671
|
#
|
|
552
|
-
# @return [Array<
|
|
672
|
+
# @return [Array<Elements::IgnoredError>]
|
|
553
673
|
# @api public
|
|
554
|
-
# : () -> Array[
|
|
555
|
-
def ignored_errors: () -> Array[
|
|
674
|
+
# : () -> Array[Elements::IgnoredError]
|
|
675
|
+
def ignored_errors: () -> Array[Elements::IgnoredError]
|
|
556
676
|
|
|
557
677
|
# Returns phonetic properties defined for this worksheet, or nil.
|
|
558
678
|
#
|
|
559
|
-
# @return [
|
|
679
|
+
# @return [Elements::PhoneticProperties, nil]
|
|
560
680
|
# @api public
|
|
561
|
-
# : () ->
|
|
562
|
-
def phonetic_properties: () ->
|
|
681
|
+
# : () -> Elements::PhoneticProperties?
|
|
682
|
+
def phonetic_properties: () -> Elements::PhoneticProperties?
|
|
563
683
|
|
|
684
|
+
# @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
|
|
564
685
|
alias phonetic_pr phonetic_properties
|
|
565
686
|
|
|
566
687
|
# Returns the background image configured for this worksheet, or nil.
|
|
567
688
|
#
|
|
568
|
-
# @return [
|
|
689
|
+
# @return [Elements::BackgroundImage, nil]
|
|
569
690
|
# @api public
|
|
570
|
-
# : () ->
|
|
571
|
-
def background_image: () ->
|
|
691
|
+
# : () -> Elements::BackgroundImage?
|
|
692
|
+
def background_image: () -> Elements::BackgroundImage?
|
|
572
693
|
|
|
694
|
+
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
573
695
|
alias background_picture background_image
|
|
574
696
|
|
|
697
|
+
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
575
698
|
alias picture background_image
|
|
576
699
|
|
|
577
700
|
# Closes any underlying reader resources.
|
|
578
701
|
# : () -> void
|
|
579
702
|
def close: () -> void
|
|
580
703
|
|
|
704
|
+
# Returns 0-based bounds { min_row: r1, max_row: r2, min_column: c1, max_column: c2 } from dimension ref.
|
|
705
|
+
#
|
|
706
|
+
# @example
|
|
707
|
+
# sheet.dimension_bounds #=> { min_row: 0, max_row: 4, min_column: 0, max_column: 2 }
|
|
708
|
+
#
|
|
709
|
+
# @return [Hash{Symbol => Integer}, nil]
|
|
710
|
+
# @api public
|
|
711
|
+
# : () -> Hash[Symbol, Integer]?
|
|
712
|
+
def dimension_bounds: () -> Hash[Symbol, Integer]?
|
|
713
|
+
|
|
714
|
+
# Returns column definitions for this worksheet.
|
|
715
|
+
#
|
|
716
|
+
# @return [Array<Elements::Column>]
|
|
717
|
+
# @api public
|
|
718
|
+
# : () -> Array[Elements::Column]
|
|
719
|
+
def columns: () -> Array[Elements::Column]
|
|
720
|
+
|
|
721
|
+
# Returns charts defined in this worksheet.
|
|
722
|
+
#
|
|
723
|
+
# @return [Array<Elements::Chart>]
|
|
724
|
+
# @api public
|
|
725
|
+
# : () -> Array[Elements::Chart]
|
|
726
|
+
def charts: () -> Array[Elements::Chart]
|
|
727
|
+
|
|
728
|
+
# Returns sparkline groups defined in this worksheet.
|
|
729
|
+
#
|
|
730
|
+
# @return [Array<Elements::SparklineGroup>]
|
|
731
|
+
# @api public
|
|
732
|
+
# : () -> Array[Elements::SparklineGroup]
|
|
733
|
+
def sparkline_groups: () -> Array[Elements::SparklineGroup]
|
|
734
|
+
|
|
735
|
+
# Returns the print area range for this worksheet, or nil if unset.
|
|
736
|
+
#
|
|
737
|
+
# @return [String, nil]
|
|
738
|
+
# @api public
|
|
739
|
+
# : () -> String?
|
|
740
|
+
def print_area: () -> String?
|
|
741
|
+
|
|
742
|
+
# Returns print titles configuration for this worksheet, or nil if unset.
|
|
743
|
+
#
|
|
744
|
+
# @return [Elements::PrintTitles, nil]
|
|
745
|
+
# @api public
|
|
746
|
+
# : () -> Elements::PrintTitles?
|
|
747
|
+
def print_titles: () -> Elements::PrintTitles?
|
|
748
|
+
|
|
749
|
+
# Returns whether the worksheet has any structural or schema validation errors.
|
|
750
|
+
#
|
|
751
|
+
# @return [Boolean]
|
|
752
|
+
# @api public
|
|
753
|
+
# : () -> bool
|
|
754
|
+
def valid?: () -> bool
|
|
755
|
+
|
|
756
|
+
# Returns validation error messages for this worksheet.
|
|
757
|
+
#
|
|
758
|
+
# @return [Array<String>]
|
|
759
|
+
# @api public
|
|
760
|
+
# : () -> Array[String]
|
|
761
|
+
def errors: () -> Array[String]
|
|
762
|
+
|
|
763
|
+
# Returns unmapped metadata for this worksheet.
|
|
764
|
+
#
|
|
765
|
+
# @return [Hash[Symbol, untyped]]
|
|
766
|
+
# @api public
|
|
767
|
+
# : () -> Hash[Symbol, untyped]
|
|
768
|
+
def unmapped_data: () -> Hash[Symbol, untyped]
|
|
769
|
+
|
|
770
|
+
# Returns legacy drawing relationship info, or nil.
|
|
771
|
+
#
|
|
772
|
+
# @return [Hash[Symbol, untyped], nil]
|
|
773
|
+
# @api public
|
|
774
|
+
# : () -> Hash[Symbol, untyped]?
|
|
775
|
+
def legacy_drawing: () -> Hash[Symbol, untyped]?
|
|
776
|
+
|
|
777
|
+
# Returns extension list elements, or nil.
|
|
778
|
+
#
|
|
779
|
+
# @return [Array[untyped], nil]
|
|
780
|
+
# @api public
|
|
781
|
+
# : () -> Array[untyped]?
|
|
782
|
+
def ext_lst: () -> Array[untyped]?
|
|
783
|
+
|
|
784
|
+
# Returns header/footer images configured for this worksheet.
|
|
785
|
+
#
|
|
786
|
+
# @return [Array<Elements::HeaderFooterImage>]
|
|
787
|
+
# @api public
|
|
788
|
+
# : () -> Array[Elements::HeaderFooterImage]
|
|
789
|
+
def header_footer_images: () -> Array[Elements::HeaderFooterImage]
|
|
790
|
+
|
|
581
791
|
private
|
|
582
792
|
|
|
793
|
+
# : () -> Hash[Symbol, untyped]
|
|
794
|
+
def auto_filter_data: () -> Hash[Symbol, untyped]
|
|
795
|
+
|
|
583
796
|
# : () -> Hash[Symbol, untyped]
|
|
584
797
|
def sheet_view_data: () -> Hash[Symbol, untyped]
|
|
585
798
|
|
|
@@ -589,10 +802,6 @@ module Xlsxrb
|
|
|
589
802
|
# : () -> String
|
|
590
803
|
def raw_sheet_xml: () -> String
|
|
591
804
|
|
|
592
|
-
# Returns 1-based bounds [first_row, first_col, last_row, last_col] from dimension ref.
|
|
593
|
-
# : () -> Array[Integer]?
|
|
594
|
-
def dimension_bounds: () -> Array[Integer]?
|
|
595
|
-
|
|
596
805
|
# Extracts dimension reference from XML source lazily without parsing the entire file.
|
|
597
806
|
# : () -> String?
|
|
598
807
|
def extract_dimension: () -> String?
|