xlsxrb 0.1.16 → 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 +157 -1
- data/README.md +81 -21
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
- data/lib/xlsxrb/chart_builder.rb +619 -98
- data/lib/xlsxrb/dsl_helpers.rb +583 -15
- data/lib/xlsxrb/elements/cell.rb +265 -53
- data/lib/xlsxrb/elements/column.rb +95 -6
- 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 +243 -7
- data/lib/xlsxrb/elements/workbook.rb +202 -65
- data/lib/xlsxrb/elements/worksheet.rb +728 -85
- data/lib/xlsxrb/elements.rb +1 -0
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +32 -3
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +194 -26
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +372 -18
- data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +33 -14
- data/lib/xlsxrb/ooxml/reader.rb +92 -0
- data/lib/xlsxrb/ooxml/styles_parser.rb +29 -14
- data/lib/xlsxrb/ooxml/workbook_parser.rb +18 -3
- data/lib/xlsxrb/ooxml/workbook_writer.rb +351 -77
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +18 -4
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +349 -103
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +584 -443
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +52 -14
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +42 -18
- data/lib/xlsxrb/ooxml/writer.rb +288 -35
- data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
- data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
- data/lib/xlsxrb/ooxml/zip_writer.rb +15 -5
- data/lib/xlsxrb/stream_row.rb +97 -18
- data/lib/xlsxrb/stream_sheet.rb +827 -157
- data/lib/xlsxrb/stream_writer.rb +2766 -375
- data/lib/xlsxrb/style_builder.rb +821 -105
- data/lib/xlsxrb/utils.rb +82 -57
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +542 -62
- data/lib/xlsxrb/worksheet_builder.rb +2279 -209
- data/lib/xlsxrb.rb +1539 -344
- data/sig/generated/xlsxrb/chart_builder.rbs +336 -79
- data/sig/generated/xlsxrb/dsl_helpers.rbs +137 -4
- data/sig/generated/xlsxrb/elements/cell.rbs +104 -15
- data/sig/generated/xlsxrb/elements/column.rbs +62 -3
- 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 +29 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +92 -44
- data/sig/generated/xlsxrb/elements/worksheet.rbs +259 -38
- data/sig/generated/xlsxrb/ooxml/reader/listeners/core_listeners.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/reader/listeners/drawing_listeners.rbs +74 -2
- data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +97 -0
- data/sig/generated/xlsxrb/ooxml/reader/listeners/style_listeners.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +20 -0
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +8 -0
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +8 -4
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +12 -1
- data/sig/generated/xlsxrb/ooxml/writer/drawing_xml.rbs +16 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +45 -8
- data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +8 -2
- data/sig/generated/xlsxrb/stream_row.rbs +48 -14
- data/sig/generated/xlsxrb/stream_sheet.rbs +398 -89
- data/sig/generated/xlsxrb/stream_writer.rbs +1601 -219
- data/sig/generated/xlsxrb/style_builder.rbs +403 -75
- data/sig/generated/xlsxrb/utils.rbs +49 -13
- data/sig/generated/xlsxrb/workbook_builder.rbs +308 -26
- data/sig/generated/xlsxrb/worksheet_builder.rbs +1142 -96
- data/sig/generated/xlsxrb.rbs +321 -52
- 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,46 +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>]
|
|
341
|
+
# @api public
|
|
342
|
+
# : () -> Hash[String, Elements::Comment]
|
|
343
|
+
def comments_by_ref: () -> Hash[String, Elements::Comment]
|
|
344
|
+
|
|
345
|
+
# Returns threaded comments configured for this worksheet as an Array of {Elements::ThreadedComment} objects.
|
|
346
|
+
#
|
|
347
|
+
# @return [Array<Elements::ThreadedComment>]
|
|
286
348
|
# @api public
|
|
287
|
-
# : () ->
|
|
288
|
-
def
|
|
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?
|
|
360
|
+
|
|
361
|
+
# Returns threaded comments for a specific cell reference, or empty array.
|
|
362
|
+
#
|
|
363
|
+
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
364
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
365
|
+
# @return [Array<Elements::ThreadedComment>]
|
|
366
|
+
# @api public
|
|
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]
|
|
369
|
+
|
|
370
|
+
# Returns threaded comments indexed by cell reference.
|
|
371
|
+
#
|
|
372
|
+
# @return [Hash<String, Array<Elements::ThreadedComment>>]
|
|
373
|
+
# @api public
|
|
374
|
+
# : () -> Hash[String, Array[Elements::ThreadedComment]]
|
|
375
|
+
def threaded_comments_by_ref: () -> Hash[String, Array[Elements::ThreadedComment]]
|
|
289
376
|
|
|
290
377
|
# Returns all embedded images in this worksheet.
|
|
291
378
|
#
|
|
@@ -297,14 +384,15 @@ module Xlsxrb
|
|
|
297
384
|
# Returns all images anchored at a specific cell reference or 0-based coordinate.
|
|
298
385
|
#
|
|
299
386
|
# @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.
|
|
387
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
301
388
|
# @return [Array<Elements::Image>]
|
|
302
389
|
# @api public
|
|
303
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
304
|
-
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]
|
|
305
392
|
|
|
306
393
|
# Loads and returns images for this worksheet, optionally yielding self for block syntax.
|
|
307
394
|
#
|
|
395
|
+
# @deprecated Access {#images} directly. Lazy-loading is automatic. Will be removed in 0.2.0.
|
|
308
396
|
# @yield [sheet]
|
|
309
397
|
# @yieldparam sheet [StreamSheet]
|
|
310
398
|
# @return [StreamSheet, void]
|
|
@@ -316,21 +404,23 @@ module Xlsxrb
|
|
|
316
404
|
|
|
317
405
|
# Access a cell by reference or 0-based coordinates.
|
|
318
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.
|
|
319
408
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
320
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
409
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
|
|
321
410
|
# @return [Elements::Cell, nil]
|
|
322
411
|
# @api public
|
|
323
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
324
|
-
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?
|
|
325
414
|
|
|
326
415
|
# Returns the formatted string representation of a cell's value.
|
|
327
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.
|
|
328
418
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
329
|
-
# @param col [Integer, nil] Optional 0-based column index.
|
|
419
|
+
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
|
|
330
420
|
# @return [String, nil]
|
|
331
421
|
# @api public
|
|
332
|
-
# : (String | Symbol | Integer ref_or_row, ?Integer
|
|
333
|
-
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?
|
|
334
424
|
|
|
335
425
|
# Returns merged cell ranges (e.g. ["A1:B2"]) for this worksheet.
|
|
336
426
|
#
|
|
@@ -346,126 +436,229 @@ module Xlsxrb
|
|
|
346
436
|
# : () -> String?
|
|
347
437
|
def auto_filter: () -> String?
|
|
348
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
|
+
|
|
349
446
|
# Returns data validation rules configured for this worksheet.
|
|
350
447
|
#
|
|
351
|
-
# @return [Array<
|
|
448
|
+
# @return [Array<Elements::DataValidation>]
|
|
352
449
|
# @api public
|
|
353
|
-
# : () -> Array[
|
|
354
|
-
def data_validations: () -> Array[
|
|
450
|
+
# : () -> Array[Elements::DataValidation]
|
|
451
|
+
def data_validations: () -> Array[Elements::DataValidation]
|
|
355
452
|
|
|
356
453
|
# Returns conditional formatting rules configured for this worksheet.
|
|
357
454
|
#
|
|
358
|
-
#
|
|
455
|
+
# Corresponds to ECMA-376 Part 4 §18.3.1.18 (<conditionalFormatting> and <cfRule> elements).
|
|
456
|
+
#
|
|
457
|
+
# @return [Array<Elements::ConditionalFormat>]
|
|
359
458
|
# @api public
|
|
360
|
-
# : () -> Array[
|
|
361
|
-
def conditional_formats: () -> Array[
|
|
459
|
+
# : () -> Array[Elements::ConditionalFormat]
|
|
460
|
+
def conditional_formats: () -> Array[Elements::ConditionalFormat]
|
|
362
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.
|
|
363
463
|
alias conditional_formatting conditional_formats
|
|
364
464
|
|
|
365
465
|
# Returns tables defined in this worksheet.
|
|
366
466
|
#
|
|
367
|
-
# @return [Array<
|
|
467
|
+
# @return [Array<Elements::Table>]
|
|
368
468
|
# @api public
|
|
369
|
-
# : () -> Array[
|
|
370
|
-
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]
|
|
371
478
|
|
|
372
479
|
# Returns shapes defined in this worksheet.
|
|
373
480
|
#
|
|
374
|
-
# @return [Array<
|
|
481
|
+
# @return [Array<Elements::Shape>]
|
|
375
482
|
# @api public
|
|
376
|
-
# : () -> Array[
|
|
377
|
-
def shapes: () -> Array[
|
|
483
|
+
# : () -> Array[Elements::Shape]
|
|
484
|
+
def shapes: () -> Array[Elements::Shape]
|
|
378
485
|
|
|
379
486
|
# Returns freeze pane settings for this worksheet, or nil if none.
|
|
380
487
|
#
|
|
381
|
-
# @return [
|
|
488
|
+
# @return [Elements::FreezePane, nil]
|
|
382
489
|
# @api public
|
|
383
|
-
# : () ->
|
|
384
|
-
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?
|
|
385
499
|
|
|
386
500
|
# Returns sheet view properties for this worksheet.
|
|
387
501
|
#
|
|
388
|
-
# @return [
|
|
502
|
+
# @return [Elements::SheetView]
|
|
389
503
|
# @api public
|
|
390
|
-
# : () ->
|
|
391
|
-
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?
|
|
392
520
|
|
|
393
521
|
# Returns selection settings for this worksheet, or nil if none.
|
|
394
522
|
#
|
|
395
|
-
# @return [
|
|
523
|
+
# @return [Elements::Selection, nil]
|
|
396
524
|
# @api public
|
|
397
|
-
# : () ->
|
|
398
|
-
def selection: () ->
|
|
525
|
+
# : () -> Elements::Selection?
|
|
526
|
+
def selection: () -> Elements::Selection?
|
|
399
527
|
|
|
400
528
|
# Returns sheet protection settings as a hash, or nil if unprotected.
|
|
401
529
|
#
|
|
402
|
-
# @return [
|
|
530
|
+
# @return [Elements::SheetProtection, nil]
|
|
403
531
|
# @api public
|
|
404
|
-
# : () ->
|
|
405
|
-
def sheet_protection: () ->
|
|
532
|
+
# : () -> Elements::SheetProtection?
|
|
533
|
+
def sheet_protection: () -> Elements::SheetProtection?
|
|
406
534
|
|
|
407
|
-
# Returns sheet-level properties (tabColor, outlinePr) for this worksheet.
|
|
535
|
+
# Returns sheet-level properties (tabColor, outlinePr, sheetPr) for this worksheet.
|
|
408
536
|
#
|
|
409
|
-
# @return [
|
|
537
|
+
# @return [Elements::SheetProperties]
|
|
538
|
+
# @api public
|
|
539
|
+
# : () -> Elements::SheetProperties
|
|
540
|
+
def sheet_properties: () -> Elements::SheetProperties
|
|
541
|
+
|
|
542
|
+
# Returns the internal VBA or application code name of the worksheet, or nil if not specified.
|
|
543
|
+
#
|
|
544
|
+
# @return [String, nil]
|
|
545
|
+
# @api public
|
|
546
|
+
# : () -> String?
|
|
547
|
+
def code_name: () -> String?
|
|
548
|
+
|
|
549
|
+
# Returns whether fit-to-page is enabled for page setup on this worksheet.
|
|
550
|
+
#
|
|
551
|
+
# @return [Boolean]
|
|
552
|
+
# @api public
|
|
553
|
+
# : () -> bool
|
|
554
|
+
def fit_to_page?: () -> bool
|
|
555
|
+
|
|
556
|
+
# @deprecated Use {#fit_to_page?} instead. Will be removed in 0.2.0.
|
|
557
|
+
# : () -> bool
|
|
558
|
+
def fit_to_page: () -> bool
|
|
559
|
+
|
|
560
|
+
# Returns whether full calculation on load is enabled on this worksheet.
|
|
561
|
+
#
|
|
562
|
+
# @return [Boolean]
|
|
563
|
+
# @api public
|
|
564
|
+
# : () -> bool
|
|
565
|
+
def full_calc_on_load?: () -> bool
|
|
566
|
+
|
|
567
|
+
# @deprecated Use {#full_calc_on_load?} instead. Will be removed in 0.2.0.
|
|
568
|
+
# : () -> bool
|
|
569
|
+
def full_calc_on_load: () -> bool
|
|
570
|
+
|
|
571
|
+
# Returns sheet calculation properties (<sheetCalcPr>), or nil if not present.
|
|
572
|
+
#
|
|
573
|
+
# @return [Elements::SheetCalcProperties, nil]
|
|
574
|
+
# @api public
|
|
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?
|
|
581
|
+
|
|
582
|
+
# @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
|
|
583
|
+
# : () -> Elements::SheetCalcProperties?
|
|
584
|
+
def calc_pr: () -> Elements::SheetCalcProperties?
|
|
585
|
+
|
|
586
|
+
# Returns the worksheet tab color specification, or nil if not set.
|
|
587
|
+
#
|
|
588
|
+
# @return [String, Hash, nil] RGB hex string (e.g. "FFFF0000") or color hash (e.g. { theme: 3, tint: -0.5 }).
|
|
589
|
+
# @api public
|
|
590
|
+
# : () -> (String | Hash[Symbol, untyped])?
|
|
591
|
+
def tab_color: () -> (String | Hash[Symbol, untyped])?
|
|
592
|
+
|
|
593
|
+
# Returns the outline and grouping properties of the worksheet, or an empty hash if none configured.
|
|
594
|
+
#
|
|
595
|
+
# @return [Hash]
|
|
410
596
|
# @api public
|
|
411
597
|
# : () -> Hash[Symbol, untyped]
|
|
412
|
-
def
|
|
598
|
+
def outline_properties: () -> Hash[Symbol, untyped]
|
|
599
|
+
|
|
600
|
+
# @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
|
|
601
|
+
alias outline_pr outline_properties
|
|
413
602
|
|
|
414
603
|
# Returns sheet format properties (defaultRowHeight, defaultColWidth, baseColWidth) for this worksheet.
|
|
415
604
|
#
|
|
416
|
-
# @return [
|
|
605
|
+
# @return [Elements::SheetFormat]
|
|
417
606
|
# @api public
|
|
418
|
-
# : () ->
|
|
419
|
-
def sheet_format: () ->
|
|
607
|
+
# : () -> Elements::SheetFormat
|
|
608
|
+
def sheet_format: () -> Elements::SheetFormat
|
|
420
609
|
|
|
421
610
|
# Returns page setup configurations for this worksheet.
|
|
422
611
|
#
|
|
423
|
-
# @return [
|
|
612
|
+
# @return [Elements::PageSetup]
|
|
424
613
|
# @api public
|
|
425
|
-
# : () ->
|
|
426
|
-
def page_setup: () ->
|
|
614
|
+
# : () -> Elements::PageSetup
|
|
615
|
+
def page_setup: () -> Elements::PageSetup
|
|
427
616
|
|
|
428
617
|
# Returns page margins for this worksheet, or nil if none.
|
|
429
618
|
#
|
|
430
|
-
# @return [
|
|
619
|
+
# @return [Elements::PageMargins, nil]
|
|
431
620
|
# @api public
|
|
432
|
-
# : () ->
|
|
433
|
-
def page_margins: () ->
|
|
621
|
+
# : () -> Elements::PageMargins?
|
|
622
|
+
def page_margins: () -> Elements::PageMargins?
|
|
434
623
|
|
|
435
624
|
# Returns header/footer configurations for this worksheet.
|
|
436
625
|
#
|
|
437
|
-
# @return [
|
|
626
|
+
# @return [Elements::HeaderFooter]
|
|
438
627
|
# @api public
|
|
439
|
-
# : () ->
|
|
440
|
-
def header_footer: () ->
|
|
628
|
+
# : () -> Elements::HeaderFooter
|
|
629
|
+
def header_footer: () -> Elements::HeaderFooter
|
|
441
630
|
|
|
442
631
|
# Returns print options for this worksheet.
|
|
443
632
|
#
|
|
444
|
-
# @return [
|
|
633
|
+
# @return [Elements::PrintOptions]
|
|
445
634
|
# @api public
|
|
446
|
-
# : () ->
|
|
447
|
-
def print_options: () ->
|
|
635
|
+
# : () -> Elements::PrintOptions
|
|
636
|
+
def print_options: () -> Elements::PrintOptions
|
|
448
637
|
|
|
449
638
|
# Returns explicit row page breaks for this worksheet.
|
|
450
639
|
#
|
|
451
|
-
# @return [Array<
|
|
640
|
+
# @return [Array<Elements::PageBreak>]
|
|
452
641
|
# @api public
|
|
453
|
-
# : () -> Array[
|
|
454
|
-
def row_breaks: () -> Array[
|
|
642
|
+
# : () -> Array[Elements::PageBreak]
|
|
643
|
+
def row_breaks: () -> Array[Elements::PageBreak]
|
|
455
644
|
|
|
456
645
|
# Returns explicit column page breaks for this worksheet.
|
|
457
646
|
#
|
|
458
|
-
# @return [Array<
|
|
647
|
+
# @return [Array<Elements::PageBreak>]
|
|
459
648
|
# @api public
|
|
460
|
-
# : () -> Array[
|
|
461
|
-
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]
|
|
462
655
|
|
|
463
656
|
# Returns protected ranges defined for this worksheet.
|
|
464
657
|
#
|
|
465
|
-
# @return [Array<
|
|
658
|
+
# @return [Array<Elements::ProtectedRange>]
|
|
466
659
|
# @api public
|
|
467
|
-
# : () -> Array[
|
|
468
|
-
def protected_ranges: () -> Array[
|
|
660
|
+
# : () -> Array[Elements::ProtectedRange]
|
|
661
|
+
def protected_ranges: () -> Array[Elements::ProtectedRange]
|
|
469
662
|
|
|
470
663
|
# Returns cell watch cell references defined for this worksheet.
|
|
471
664
|
#
|
|
@@ -474,12 +667,132 @@ module Xlsxrb
|
|
|
474
667
|
# : () -> Array[String]
|
|
475
668
|
def cell_watches: () -> Array[String]
|
|
476
669
|
|
|
670
|
+
# Returns ignored error rules defined for this worksheet.
|
|
671
|
+
#
|
|
672
|
+
# @return [Array<Elements::IgnoredError>]
|
|
673
|
+
# @api public
|
|
674
|
+
# : () -> Array[Elements::IgnoredError]
|
|
675
|
+
def ignored_errors: () -> Array[Elements::IgnoredError]
|
|
676
|
+
|
|
677
|
+
# Returns phonetic properties defined for this worksheet, or nil.
|
|
678
|
+
#
|
|
679
|
+
# @return [Elements::PhoneticProperties, nil]
|
|
680
|
+
# @api public
|
|
681
|
+
# : () -> Elements::PhoneticProperties?
|
|
682
|
+
def phonetic_properties: () -> Elements::PhoneticProperties?
|
|
683
|
+
|
|
684
|
+
# @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
|
|
685
|
+
alias phonetic_pr phonetic_properties
|
|
686
|
+
|
|
687
|
+
# Returns the background image configured for this worksheet, or nil.
|
|
688
|
+
#
|
|
689
|
+
# @return [Elements::BackgroundImage, nil]
|
|
690
|
+
# @api public
|
|
691
|
+
# : () -> Elements::BackgroundImage?
|
|
692
|
+
def background_image: () -> Elements::BackgroundImage?
|
|
693
|
+
|
|
694
|
+
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
695
|
+
alias background_picture background_image
|
|
696
|
+
|
|
697
|
+
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
698
|
+
alias picture background_image
|
|
699
|
+
|
|
477
700
|
# Closes any underlying reader resources.
|
|
478
701
|
# : () -> void
|
|
479
702
|
def close: () -> void
|
|
480
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
|
+
|
|
481
791
|
private
|
|
482
792
|
|
|
793
|
+
# : () -> Hash[Symbol, untyped]
|
|
794
|
+
def auto_filter_data: () -> Hash[Symbol, untyped]
|
|
795
|
+
|
|
483
796
|
# : () -> Hash[Symbol, untyped]
|
|
484
797
|
def sheet_view_data: () -> Hash[Symbol, untyped]
|
|
485
798
|
|
|
@@ -489,10 +802,6 @@ module Xlsxrb
|
|
|
489
802
|
# : () -> String
|
|
490
803
|
def raw_sheet_xml: () -> String
|
|
491
804
|
|
|
492
|
-
# Returns 1-based bounds [first_row, first_col, last_row, last_col] from dimension ref.
|
|
493
|
-
# : () -> Array[Integer]?
|
|
494
|
-
def dimension_bounds: () -> Array[Integer]?
|
|
495
|
-
|
|
496
805
|
# Extracts dimension reference from XML source lazily without parsing the entire file.
|
|
497
806
|
# : () -> String?
|
|
498
807
|
def extract_dimension: () -> String?
|