xlsxrb 0.1.18 → 0.2.1

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +200 -0
  3. data/README.md +35 -12
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +410 -80
  5. data/lib/xlsxrb/chart_builder.rb +251 -386
  6. data/lib/xlsxrb/dsl_helpers.rb +169 -68
  7. data/lib/xlsxrb/elements/cell.rb +37 -157
  8. data/lib/xlsxrb/elements/column.rb +11 -19
  9. data/lib/xlsxrb/elements/coordinate_access.rb +15 -86
  10. data/lib/xlsxrb/elements/image.rb +5 -72
  11. data/lib/xlsxrb/elements/metadata.rb +463 -817
  12. data/lib/xlsxrb/elements/row.rb +27 -145
  13. data/lib/xlsxrb/elements/styles.rb +30 -88
  14. data/lib/xlsxrb/elements/types.rb +6 -99
  15. data/lib/xlsxrb/elements/workbook.rb +19 -126
  16. data/lib/xlsxrb/elements/worksheet.rb +45 -316
  17. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +4 -1
  18. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -7
  19. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +32 -17
  20. data/lib/xlsxrb/ooxml/reader.rb +49 -51
  21. data/lib/xlsxrb/ooxml/styles_parser.rb +26 -2
  22. data/lib/xlsxrb/ooxml/utils.rb +15 -2
  23. data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
  24. data/lib/xlsxrb/ooxml/workbook_writer.rb +184 -94
  25. data/lib/xlsxrb/ooxml/worksheet_parser.rb +61 -29
  26. data/lib/xlsxrb/ooxml/worksheet_writer.rb +353 -261
  27. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +28 -11
  28. data/lib/xlsxrb/ooxml/writer/features_xml.rb +62 -16
  29. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +1 -1
  30. data/lib/xlsxrb/ooxml/writer.rb +106 -42
  31. data/lib/xlsxrb/ooxml/xml_builder.rb +18 -0
  32. data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
  33. data/lib/xlsxrb/ooxml/zip_reader.rb +65 -15
  34. data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
  35. data/lib/xlsxrb/stream_row.rb +14 -118
  36. data/lib/xlsxrb/stream_sheet.rb +14 -261
  37. data/lib/xlsxrb/stream_writer.rb +807 -1537
  38. data/lib/xlsxrb/style_builder.rb +715 -593
  39. data/lib/xlsxrb/version.rb +1 -1
  40. data/lib/xlsxrb/workbook_builder.rb +403 -286
  41. data/lib/xlsxrb/worksheet_builder.rb +1297 -1458
  42. data/lib/xlsxrb.rb +281 -1079
  43. data/sig/generated/xlsxrb/chart_builder.rbs +202 -205
  44. data/sig/generated/xlsxrb/dsl_helpers.rbs +92 -16
  45. data/sig/generated/xlsxrb/elements/cell.rbs +12 -76
  46. data/sig/generated/xlsxrb/elements/column.rbs +0 -7
  47. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +5 -41
  48. data/sig/generated/xlsxrb/elements/image.rbs +3 -29
  49. data/sig/generated/xlsxrb/elements/metadata.rbs +138 -151
  50. data/sig/generated/xlsxrb/elements/row.rbs +10 -53
  51. data/sig/generated/xlsxrb/elements/styles.rbs +1 -39
  52. data/sig/generated/xlsxrb/elements/workbook.rbs +14 -78
  53. data/sig/generated/xlsxrb/elements/worksheet.rbs +5 -121
  54. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +0 -4
  55. data/sig/generated/xlsxrb/ooxml/reader.rbs +0 -3
  56. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
  57. data/sig/generated/xlsxrb/ooxml/utils.rbs +13 -3
  58. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +17 -0
  59. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
  60. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +58 -3
  61. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +10 -0
  62. data/sig/generated/xlsxrb/ooxml/writer.rbs +20 -14
  63. data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +12 -0
  64. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
  65. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +22 -7
  66. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
  67. data/sig/generated/xlsxrb/stream_row.rbs +9 -44
  68. data/sig/generated/xlsxrb/stream_sheet.rbs +1 -158
  69. data/sig/generated/xlsxrb/stream_writer.rbs +491 -974
  70. data/sig/generated/xlsxrb/style_builder.rbs +464 -239
  71. data/sig/generated/xlsxrb/workbook_builder.rbs +124 -139
  72. data/sig/generated/xlsxrb/worksheet_builder.rbs +922 -686
  73. data/sig/generated/xlsxrb.rbs +56 -188
  74. data/sig/rexml.rbs +8 -0
  75. metadata +3 -5
  76. data/lib/xlsxrb/utils.rb +0 -251
  77. data/sig/generated/xlsxrb/utils.rbs +0 -200
@@ -11,9 +11,9 @@ module Xlsxrb
11
11
  # puts "#{cell.ref}: #{cell.value}"
12
12
  # end
13
13
  #
14
- # @example Random access or array conversion (cached on-demand)
14
+ # @example Random access or the row's values (cached on-demand)
15
15
  # cell = row[0]
16
- # values = row.to_a
16
+ # values = row.values
17
17
  #
18
18
  # @api public
19
19
  class StreamRow
@@ -28,34 +28,6 @@ module Xlsxrb
28
28
  #: Integer?
29
29
  attr_reader :style_index
30
30
 
31
- # @deprecated Use {#hidden?} instead. Will be removed in 0.2.0.
32
- #: () -> bool
33
- def hidden
34
- warn "[DEPRECATION] `StreamRow#hidden` is deprecated; use `hidden?` instead.", uplevel: 1
35
- hidden?
36
- end
37
-
38
- # @deprecated Use {#collapsed?} instead. Will be removed in 0.2.0.
39
- #: () -> bool
40
- def collapsed
41
- warn "[DEPRECATION] `StreamRow#collapsed` is deprecated; use `collapsed?` instead.", uplevel: 1
42
- collapsed?
43
- end
44
-
45
- # @deprecated Use {#custom_height?} instead. Will be removed in 0.2.0.
46
- #: () -> bool
47
- def custom_height
48
- warn "[DEPRECATION] `StreamRow#custom_height` is deprecated; use `custom_height?` instead.", uplevel: 1
49
- custom_height?
50
- end
51
-
52
- # @deprecated Use {#pad_empty_cells?} instead. Will be removed in 0.2.0.
53
- #: () -> bool
54
- def pad_empty_cells
55
- warn "[DEPRECATION] `StreamRow#pad_empty_cells` is deprecated; use `pad_empty_cells?` instead.", uplevel: 1
56
- pad_empty_cells?
57
- end
58
-
59
31
  # @param index [Integer] 0-based row index.
60
32
  # @param xml_bytes [String] Raw ASCII-8BIT XML bytes.
61
33
  # @param from [Integer] Byte offset where cells start.
@@ -264,44 +236,19 @@ module Xlsxrb
264
236
  end
265
237
  end
266
238
 
267
- # Access a cell by 0-based column index, column letter, or access row attributes via Symbol.
239
+ # Access a cell by 0-based column index, column letter/Symbol, or column range.
268
240
  #
269
- # @param col_index [Integer, String, Symbol] Column index, column letter, or attribute symbol.
270
- # @return [Elements::Cell, Object, nil]
241
+ # @param col_index_or_range [Integer, String, Symbol, Range<Integer>] Column index, column letter/Symbol, or column index range.
242
+ # @return [Elements::Cell, Array<Elements::Cell>, nil]
271
243
  # @api public
272
- #: (Integer | String | Symbol col_index) -> untyped
273
- def [](col_index)
274
- case col_index
275
- when Symbol
276
- case col_index
277
- when :cells then cells
278
- when :values then values
279
- when :raw_values then raw_values
280
- when :formatted_values then formatted_values
281
- when :formula_expressions, :formulas then formula_expressions
282
- when :index then index
283
- when :height then height
284
- when :hidden, :hidden? then hidden?
285
- when :custom_height, :custom_height? then custom_height?
286
- when :collapsed, :collapsed? then collapsed?
287
- when :outline_level then outline_level
288
- when :style_index then style_index
289
- when :date1904 then date1904?
290
- when :pad_empty_cells then @pad_empty_cells
291
- when :pad_empty_cells? then pad_empty_cells?
292
- when :attributes then attributes
293
- when :attrs
294
- warn "[DEPRECATION] `:attrs` key is deprecated; use `:attributes` instead.", uplevel: 1
295
- h = { height: height, hidden: hidden?, custom_height: custom_height?, collapsed: collapsed?, outline_level: outline_level }
296
- h[:style_index] = style_index if style_index
297
- h
298
- else
299
- idx = Elements::Cell._column_index(col_index.to_s)
300
- idx ? cell_at(idx) : nil
301
- end
244
+ #: (Integer | String | Symbol col_index_or_range) -> Elements::Cell?
245
+ #: (Range[Integer] col_index_or_range) -> Array[Elements::Cell]
246
+ def [](col_index_or_range)
247
+ case col_index_or_range
248
+ when Range
249
+ cells.select { |c| col_index_or_range.cover?(c.column_index) }
302
250
  else
303
- idx = col_index.is_a?(Integer) ? col_index : Elements::Cell._column_index(col_index)
304
- idx ? cell_at(idx) : nil
251
+ cell_at(col_index_or_range)
305
252
  end
306
253
  end
307
254
 
@@ -318,50 +265,6 @@ module Xlsxrb
318
265
  cells.find { |c| c.column_index == col }
319
266
  end
320
267
 
321
- # Convert row cells to a coordinate-keyed Hash (e.g. {"A1" => "value", "B1" => 123}).
322
- #
323
- # @deprecated Use {#values} or {#cells} instead. Will be removed in 0.2.0.
324
- # @param type_cast [Boolean] Whether to coerce date/time serial numbers into Date/Time instances.
325
- # @return [Hash{String => Object}]
326
- # @api public
327
- #: (?type_cast: bool) -> Hash[String, untyped]
328
- def to_h(type_cast: false)
329
- warn "[DEPRECATION] `StreamRow#to_h` is deprecated; use `values` or `cells` instead.", uplevel: 1
330
- result = {}
331
- each_cell do |c|
332
- val = c.value
333
- if type_cast && val.is_a?(Numeric)
334
- fmt_type = if c.style_index && @styles
335
- NumberFormatter.format_type_for(c.style_index, @styles)
336
- elsif c.format_code
337
- NumberFormatter.format_type(c.format_code)
338
- end
339
- begin
340
- case fmt_type
341
- when :date
342
- val = Ooxml::Utils.serial_to_date(val, date1904: @date1904)
343
- when :datetime, :time
344
- val = Ooxml::Utils.serial_to_datetime(val, date1904: @date1904)
345
- end
346
- rescue StandardError
347
- # Keep val numeric on failure
348
- end
349
- end
350
- result[c.ref] = val
351
- end
352
- result
353
- end
354
-
355
- # Convert row cells to an Array of raw values (sparse columns get nil).
356
- #
357
- # @deprecated Use {#values} to get an Array of cell values, or {#cells} for Cell objects. In 0.2.0, {#to_a} will conform to Enumerable#to_a and return Array<Cell>.
358
- # @return [Array<Object>]
359
- # @api public
360
- #: () -> Array[untyped]
361
- def to_a
362
- values
363
- end
364
-
365
268
  # Returns cell values as an Array (sparse columns get nil).
366
269
  #
367
270
  # @param type_cast [Boolean] Whether to coerce date/time serial numbers into Date/Time instances.
@@ -424,13 +327,6 @@ module Xlsxrb
424
327
  arr
425
328
  end
426
329
 
427
- # @deprecated Use {#formula_expressions} instead. Will be removed in 0.2.0.
428
- #: () -> Array[String?]
429
- def formulas
430
- warn "[DEPRECATION] `StreamRow#formulas` is deprecated; use `StreamRow#formula_expressions` instead.", uplevel: 1
431
- formula_expressions
432
- end
433
-
434
330
  # Returns whether the row is valid according to OOXML specifications.
435
331
  #
436
332
  # @return [Boolean]
@@ -458,7 +354,7 @@ module Xlsxrb
458
354
  # @api public
459
355
  #: () -> Hash[untyped, untyped]
460
356
  def unmapped_data
461
- @style_index ? { style_index: @style_index } : Elements::EMPTY_HASH
357
+ Elements::EMPTY_HASH
462
358
  end
463
359
 
464
360
  # Validation errors for compatibility with Elements::Row.
@@ -476,7 +372,7 @@ module Xlsxrb
476
372
  # @api public
477
373
  #: () -> String
478
374
  def inspect
479
- "#<#{self.class.name} index=#{index} height=#{height.inspect} hidden=#{hidden}>"
375
+ "#<#{self.class.name} index=#{index} height=#{height.inspect} hidden=#{@hidden}>"
480
376
  end
481
377
 
482
378
  private
@@ -99,13 +99,6 @@ module Xlsxrb
99
99
  @trim_empty_rows ? true : false
100
100
  end
101
101
 
102
- # @deprecated Use {#trim_empty_rows?} instead. Will be removed in 0.2.0.
103
- #: () -> bool
104
- def trim_empty_rows
105
- warn "[DEPRECATION] #trim_empty_rows is deprecated; use #trim_empty_rows? instead.", uplevel: 1
106
- trim_empty_rows?
107
- end
108
-
109
102
  # Returns whether skipped rows are padded during iteration.
110
103
  #
111
104
  # @return [Boolean]
@@ -115,13 +108,6 @@ module Xlsxrb
115
108
  @pad_empty_rows ? true : false
116
109
  end
117
110
 
118
- # @deprecated Use {#pad_empty_rows?} instead. Will be removed in 0.2.0.
119
- #: () -> bool
120
- def pad_empty_rows
121
- warn "[DEPRECATION] #pad_empty_rows is deprecated; use #pad_empty_rows? instead.", uplevel: 1
122
- pad_empty_rows?
123
- end
124
-
125
111
  # Returns whether missing cells within rows are padded during iteration.
126
112
  #
127
113
  # @return [Boolean]
@@ -131,13 +117,6 @@ module Xlsxrb
131
117
  @pad_empty_cells ? true : false
132
118
  end
133
119
 
134
- # @deprecated Use {#pad_empty_cells?} instead. Will be removed in 0.2.0.
135
- #: () -> bool
136
- def pad_empty_cells
137
- warn "[DEPRECATION] #pad_empty_cells is deprecated; use #pad_empty_cells? instead.", uplevel: 1
138
- pad_empty_cells?
139
- end
140
-
141
120
  # Returns the dimension reference string (e.g. "A1:Z50000"), or nil if not present.
142
121
  #
143
122
  # @return [String, nil]
@@ -150,78 +129,6 @@ module Xlsxrb
150
129
  @dimension = extract_dimension
151
130
  end
152
131
 
153
- # Returns the 1-based index of the first row defined in the sheet dimension, or nil.
154
- #
155
- # @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.
156
- # @return [Integer, nil]
157
- # @api public
158
- #: () -> Integer?
159
- def first_row
160
- bounds = dimension_bounds
161
- bounds ? bounds[:min_row] + 1 : nil
162
- end
163
-
164
- # Returns the 0-based index of the first column defined in the sheet dimension, or nil.
165
- #
166
- # @return [Integer, nil]
167
- # @api public
168
- #: () -> Integer?
169
- def first_column_index
170
- Xlsxrb::Deprecation.warn("StreamSheet#first_column_index is deprecated; use #column_range instead.", uplevel: 1)
171
- bounds = dimension_bounds
172
- bounds ? bounds[:min_column] : nil
173
- end
174
-
175
- # Returns the 1-based index of the first column defined in the sheet dimension, or nil.
176
- #
177
- # @deprecated Use 0-based {#first_column_index} instead. Will be removed in 0.2.0.
178
- # @return [Integer, nil]
179
- # @api public
180
- #: () -> Integer?
181
- def first_column
182
- warn "[Xlsxrb DEPRECATION] StreamSheet#first_column is deprecated and will be removed in v0.2.0. Use 0-based #first_column_index instead.", uplevel: 1
183
- bounds = dimension_bounds
184
- bounds ? bounds[:min_column] + 1 : nil
185
- end
186
- # @deprecated Use {#first_column_index} instead. Will be removed in 0.2.0.
187
- alias first_col first_column
188
-
189
- # Returns the 1-based index of the last row defined in the sheet dimension, or nil.
190
- #
191
- # @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.
192
- # @return [Integer, nil]
193
- # @api public
194
- #: () -> Integer?
195
- def last_row
196
- bounds = dimension_bounds
197
- bounds ? bounds[:max_row] + 1 : nil
198
- end
199
-
200
- # Returns the 0-based index of the last column defined in the sheet dimension, or nil.
201
- #
202
- # @return [Integer, nil]
203
- # @api public
204
- #: () -> Integer?
205
- def last_column_index
206
- Xlsxrb::Deprecation.warn("StreamSheet#last_column_index is deprecated; use #column_range instead.", uplevel: 1)
207
- bounds = dimension_bounds
208
- bounds ? bounds[:max_column] : nil
209
- end
210
-
211
- # Returns the 1-based index of the last column defined in the sheet dimension, or nil.
212
- #
213
- # @deprecated Use 0-based {#last_column_index} instead. Will be removed in 0.2.0.
214
- # @return [Integer, nil]
215
- # @api public
216
- #: () -> Integer?
217
- def last_column
218
- warn "[Xlsxrb DEPRECATION] StreamSheet#last_column is deprecated and will be removed in v0.2.0. Use 0-based #last_column_index instead.", uplevel: 1
219
- bounds = dimension_bounds
220
- bounds ? bounds[:max_column] + 1 : nil
221
- end
222
- # @deprecated Use {#last_column_index} instead. Will be removed in 0.2.0.
223
- alias last_col last_column
224
-
225
132
  # Returns the 0-based range of rows defined in the sheet dimension, or nil.
226
133
  #
227
134
  # @example
@@ -412,8 +319,7 @@ module Xlsxrb
412
319
  end
413
320
 
414
321
  # Loads this sheet completely into an in-memory {Elements::Worksheet},
415
- # enabling coordinate random access (`sheet["A1"]`), row lookups (`row_at`),
416
- # and immutable cell updates (`update_cell`).
322
+ # enabling coordinate random access (`sheet["A1"]`) and row lookups (`row_at`).
417
323
  #
418
324
  # @return [Elements::Worksheet] The fully parsed in-memory worksheet.
419
325
  # @api public
@@ -472,13 +378,6 @@ module Xlsxrb
472
378
  )
473
379
  end
474
380
 
475
- # @deprecated Use {Xlsxrb.load} instead. Will be removed in 0.2.0.
476
- #: () -> Elements::Worksheet
477
- def to_worksheet
478
- warn "[DEPRECATION] #to_worksheet is deprecated; use Xlsxrb.load(source) instead.", uplevel: 1
479
- load
480
- end
481
-
482
381
  # Returns hyperlinks configured for this worksheet as a Hash of cell references to {Elements::Hyperlink} objects.
483
382
  #
484
383
  # @return [Hash<String, Elements::Hyperlink>]
@@ -521,7 +420,8 @@ module Xlsxrb
521
420
  ref: c[:ref] || c[:cell],
522
421
  author: c[:author],
523
422
  text: c[:text],
524
- visible: c[:visible] || false
423
+ visible: c[:visible] || false,
424
+ anchor: c[:anchor]
525
425
  )
526
426
  end
527
427
  end.freeze
@@ -575,8 +475,9 @@ module Xlsxrb
575
475
  author: tc[:author],
576
476
  text: tc[:text],
577
477
  parent_id: tc[:parent_id],
578
- done: tc[:done] || false,
579
- created_at: tc[:created_at]
478
+ resolved: tc[:resolved] || tc[:done] || false,
479
+ created_at: tc[:created_at] || tc[:dt],
480
+ author_id: tc[:author_id] || tc[:person_id]
580
481
  )
581
482
  end
582
483
  end.freeze
@@ -655,67 +556,6 @@ module Xlsxrb
655
556
  images.select { |img| img.ref == ref }
656
557
  end
657
558
 
658
- # Loads and returns images for this worksheet, optionally yielding self for block syntax.
659
- #
660
- # @deprecated Access {#images} directly. Lazy-loading is automatic. Will be removed in 0.2.0.
661
- # @yield [sheet]
662
- # @yieldparam sheet [StreamSheet]
663
- # @return [StreamSheet, void]
664
- # @api public
665
- #: () { (StreamSheet) -> void } -> void
666
- #: () -> StreamSheet
667
- def with_images
668
- warn "[DEPRECATION] `with_images` is deprecated; access `images` directly.", uplevel: 1
669
- images
670
- if block_given?
671
- yield self
672
- nil
673
- else
674
- self
675
- end
676
- end
677
-
678
- # Access a cell by reference or 0-based coordinates.
679
- #
680
- # @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.
681
- # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
682
- # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
683
- # @return [Elements::Cell, nil]
684
- # @api public
685
- #: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
686
- def cell(ref_or_row, col = nil)
687
- warn "[DEPRECATION] StreamSheet#cell is deprecated; use Xlsxrb.load(source) for in-memory random access (e.g. ws[\"A1\"]).", uplevel: 1
688
- target_row, target_col = if col
689
- c_idx = Xlsxrb.column_index(col)
690
- [ref_or_row.to_i, c_idx]
691
- else
692
- parsed = Elements::Cell._parse_ref(ref_or_row.to_s)
693
- return nil unless parsed
694
-
695
- parsed
696
- end
697
-
698
- each_row do |row|
699
- next if row.index < target_row
700
- return row.cell_at(target_col) if row.index == target_row
701
- break if row.index > target_row
702
- end
703
- nil
704
- end
705
-
706
- # Returns the formatted string representation of a cell's value.
707
- #
708
- # @deprecated Use `ws = Xlsxrb.load(source)` to materialize an {Elements::Worksheet} and access `ws["A1"].formatted_value`. Will be removed in 0.2.0.
709
- # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
710
- # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter.
711
- # @return [String, nil]
712
- # @api public
713
- #: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
714
- def formatted_value(ref_or_row, col = nil)
715
- warn "[DEPRECATION] StreamSheet#formatted_value is deprecated; use Xlsxrb.load(source) for in-memory random access (e.g. ws[\"A1\"].formatted_value).", uplevel: 1
716
- cell(ref_or_row, col)&.formatted_value
717
- end
718
-
719
559
  # Returns merged cell ranges (e.g. ["A1:B2"]) for this worksheet.
720
560
  #
721
561
  # @return [Array<String>]
@@ -750,17 +590,7 @@ module Xlsxrb
750
590
  fc = if filter.is_a?(Elements::FilterColumn)
751
591
  filter
752
592
  else
753
- Elements::FilterColumn.new(
754
- column_id: filter[:column_id] || filter[:col_id] || col_id,
755
- hidden: filter[:hidden] || false,
756
- show_button: filter[:show_button] != false,
757
- filters: filter[:filters] || [],
758
- custom_filters: filter[:custom_filters] || [],
759
- top10: filter[:top10],
760
- dynamic_filter: filter[:dynamic_filter],
761
- color_filter: filter[:color_filter],
762
- icon_filter: filter[:icon_filter]
763
- )
593
+ Elements::FilterColumn.from_spec(col_id, filter)
764
594
  end
765
595
  [col_id, fc]
766
596
  end.freeze
@@ -806,8 +636,6 @@ module Xlsxrb
806
636
  [].freeze
807
637
  end
808
638
  end
809
- # @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.
810
- alias conditional_formatting conditional_formats
811
639
 
812
640
  # Returns tables defined in this worksheet.
813
641
  #
@@ -822,7 +650,7 @@ module Xlsxrb
822
650
  tb
823
651
  else
824
652
  cols = (tb[:columns] || []).map { |col| col.is_a?(Elements::TableColumn) ? col : Elements::TableColumn.new(**col) }
825
- si = tb[:style_info]
653
+ si = tb[:style_info] || Elements::Table.style_info_from(tb)
826
654
  si = Elements::TableStyleInfo.new(**si) if si.is_a?(Hash)
827
655
  Elements::Table.new(**tb, columns: cols, style_info: si)
828
656
  end
@@ -892,16 +720,6 @@ module Xlsxrb
892
720
  v.is_a?(Elements::SheetView) ? v : Elements::SheetView.new(**v)
893
721
  end
894
722
 
895
- # Returns sheet views for this worksheet.
896
- #
897
- # @return [Array<Elements::SheetView>]
898
- # @api public
899
- #: () -> Array[Elements::SheetView]
900
- def sheet_views
901
- Xlsxrb::Deprecation.warn("StreamSheet#sheet_views is deprecated; use #sheet_view instead.", uplevel: 1)
902
- [sheet_view]
903
- end
904
-
905
723
  # Returns sort state configuration for this worksheet, or nil if none.
906
724
  #
907
725
  # @return [Elements::SortState, nil]
@@ -979,14 +797,7 @@ module Xlsxrb
979
797
  # @api public
980
798
  #: () -> bool
981
799
  def fit_to_page?
982
- sheet_properties.fit_to_page == true
983
- end
984
-
985
- # @deprecated Use {#fit_to_page?} instead. Will be removed in 0.2.0.
986
- #: () -> bool
987
- def fit_to_page
988
- warn "[DEPRECATION] #fit_to_page is deprecated; use #fit_to_page? instead.", uplevel: 1
989
- fit_to_page?
800
+ sheet_properties.fit_to_page?
990
801
  end
991
802
 
992
803
  # Returns whether full calculation on load is enabled on this worksheet.
@@ -995,14 +806,7 @@ module Xlsxrb
995
806
  # @api public
996
807
  #: () -> bool
997
808
  def full_calc_on_load?
998
- sheet_calc_properties&.full_calc_on_load == true || sheet_properties.full_calc_on_load == true
999
- end
1000
-
1001
- # @deprecated Use {#full_calc_on_load?} instead. Will be removed in 0.2.0.
1002
- #: () -> bool
1003
- def full_calc_on_load
1004
- warn "[DEPRECATION] #full_calc_on_load is deprecated; use #full_calc_on_load? instead.", uplevel: 1
1005
- full_calc_on_load?
809
+ sheet_calc_properties&.to_h&.[](:full_calc_on_load) == true || sheet_properties.to_h[:full_calc_on_load] == true
1006
810
  end
1007
811
 
1008
812
  # Returns sheet calculation properties (<sheetCalcPr>), or nil if not present.
@@ -1011,21 +815,7 @@ module Xlsxrb
1011
815
  # @api public
1012
816
  #: () -> Elements::SheetCalcProperties?
1013
817
  def sheet_calc_properties
1014
- sheet_properties.full_calc_on_load ? Elements::SheetCalcProperties.new(full_calc_on_load: true) : nil
1015
- end
1016
-
1017
- # @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
1018
- #: () -> Elements::SheetCalcProperties?
1019
- def sheet_calc_pr
1020
- warn "[DEPRECATION] #sheet_calc_pr is deprecated; use #sheet_calc_properties instead.", uplevel: 1
1021
- sheet_calc_properties
1022
- end
1023
-
1024
- # @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
1025
- #: () -> Elements::SheetCalcProperties?
1026
- def calc_pr
1027
- warn "[DEPRECATION] #calc_pr is deprecated; use #sheet_calc_properties instead.", uplevel: 1
1028
- sheet_calc_properties
818
+ sheet_properties.full_calc_on_load? ? Elements::SheetCalcProperties.new(full_calc_on_load: true) : nil
1029
819
  end
1030
820
 
1031
821
  # Returns the worksheet tab color specification, or nil if not set.
@@ -1061,8 +851,6 @@ module Xlsxrb
1061
851
  res[:apply_styles] = props[:apply_styles] unless props[:apply_styles].nil?
1062
852
  res
1063
853
  end
1064
- # @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
1065
- alias outline_pr outline_properties
1066
854
 
1067
855
  # Returns sheet format properties (defaultRowHeight, defaultColWidth, baseColWidth) for this worksheet.
1068
856
  #
@@ -1149,18 +937,11 @@ module Xlsxrb
1149
937
  # @api public
1150
938
  #: () -> Array[Elements::PageBreak]
1151
939
  def column_breaks
1152
- @column_breaks ||= (print_page_data[:column_breaks] || print_page_data[:col_breaks] || []).map do |cb|
940
+ @column_breaks ||= (print_page_data[:column_breaks] || []).map do |cb|
1153
941
  cb.is_a?(Elements::PageBreak) ? cb : Elements::PageBreak.new(**cb)
1154
942
  end.freeze
1155
943
  end
1156
944
 
1157
- # @deprecated Use {#column_breaks} instead.
1158
- #: () -> Array[Elements::PageBreak]
1159
- def col_breaks
1160
- warn "[DEPRECATION] `col_breaks` is deprecated; use `column_breaks` instead.", uplevel: 1
1161
- column_breaks
1162
- end
1163
-
1164
945
  # Returns protected ranges defined for this worksheet.
1165
946
  #
1166
947
  # @return [Array<Elements::ProtectedRange>]
@@ -1225,8 +1006,6 @@ module Xlsxrb
1225
1006
  end
1226
1007
  end
1227
1008
  end
1228
- # @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
1229
- alias phonetic_pr phonetic_properties
1230
1009
 
1231
1010
  # Returns the background image configured for this worksheet, or nil.
1232
1011
  #
@@ -1241,10 +1020,6 @@ module Xlsxrb
1241
1020
  end
1242
1021
  end
1243
1022
  end
1244
- # @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
1245
- alias background_picture background_image
1246
- # @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
1247
- alias picture background_image
1248
1023
 
1249
1024
  # Closes any underlying reader resources.
1250
1025
  #: () -> void
@@ -1384,26 +1159,6 @@ module Xlsxrb
1384
1159
  {}
1385
1160
  end
1386
1161
 
1387
- # Returns legacy drawing relationship info, or nil.
1388
- #
1389
- # @return [Hash[Symbol, untyped], nil]
1390
- # @api public
1391
- #: () -> Hash[Symbol, untyped]?
1392
- def legacy_drawing
1393
- Xlsxrb::Deprecation.warn("StreamSheet#legacy_drawing is deprecated.", uplevel: 1)
1394
- nil
1395
- end
1396
-
1397
- # Returns extension list elements, or nil.
1398
- #
1399
- # @return [Array[untyped], nil]
1400
- # @api public
1401
- #: () -> Array[untyped]?
1402
- def ext_lst
1403
- Xlsxrb::Deprecation.warn("StreamSheet#ext_lst is deprecated.", uplevel: 1)
1404
- nil
1405
- end
1406
-
1407
1162
  # Returns header/footer images configured for this worksheet.
1408
1163
  #
1409
1164
  # @return [Array<Elements::HeaderFooterImage>]
@@ -1455,8 +1210,7 @@ module Xlsxrb
1455
1210
  header_footer: listener.header_footer,
1456
1211
  print_options: listener.print_options,
1457
1212
  row_breaks: listener.row_breaks,
1458
- column_breaks: listener.column_breaks,
1459
- col_breaks: listener.col_breaks
1213
+ column_breaks: listener.column_breaks
1460
1214
  }
1461
1215
  else
1462
1216
  {
@@ -1465,8 +1219,7 @@ module Xlsxrb
1465
1219
  header_footer: {},
1466
1220
  print_options: {},
1467
1221
  row_breaks: [],
1468
- column_breaks: [],
1469
- col_breaks: []
1222
+ column_breaks: []
1470
1223
  }
1471
1224
  end
1472
1225
  end