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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +93 -1
  3. data/README.md +79 -19
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
  5. data/lib/xlsxrb/chart_builder.rb +595 -113
  6. data/lib/xlsxrb/dsl_helpers.rb +72 -20
  7. data/lib/xlsxrb/elements/cell.rb +243 -56
  8. data/lib/xlsxrb/elements/column.rb +94 -5
  9. data/lib/xlsxrb/elements/coordinate_access.rb +108 -10
  10. data/lib/xlsxrb/elements/image.rb +81 -15
  11. data/lib/xlsxrb/elements/metadata.rb +2733 -0
  12. data/lib/xlsxrb/elements/row.rb +130 -46
  13. data/lib/xlsxrb/elements/styles.rb +184 -76
  14. data/lib/xlsxrb/elements/types.rb +242 -7
  15. data/lib/xlsxrb/elements/workbook.rb +171 -82
  16. data/lib/xlsxrb/elements/worksheet.rb +598 -102
  17. data/lib/xlsxrb/elements.rb +1 -0
  18. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +12 -4
  19. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -2
  20. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +264 -17
  21. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
  22. data/lib/xlsxrb/ooxml/reader.rb +4 -0
  23. data/lib/xlsxrb/ooxml/styles_parser.rb +10 -3
  24. data/lib/xlsxrb/ooxml/workbook_writer.rb +90 -36
  25. data/lib/xlsxrb/ooxml/worksheet_parser.rb +2 -2
  26. data/lib/xlsxrb/ooxml/worksheet_writer.rb +64 -19
  27. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +5 -2
  28. data/lib/xlsxrb/ooxml/writer/features_xml.rb +26 -5
  29. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +19 -9
  30. data/lib/xlsxrb/ooxml/writer.rb +22 -6
  31. data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
  32. data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
  33. data/lib/xlsxrb/stream_row.rb +97 -18
  34. data/lib/xlsxrb/stream_sheet.rb +706 -190
  35. data/lib/xlsxrb/stream_writer.rb +1893 -374
  36. data/lib/xlsxrb/style_builder.rb +774 -111
  37. data/lib/xlsxrb/utils.rb +66 -106
  38. data/lib/xlsxrb/version.rb +1 -1
  39. data/lib/xlsxrb/workbook_builder.rb +380 -83
  40. data/lib/xlsxrb/worksheet_builder.rb +1210 -233
  41. data/lib/xlsxrb.rb +1266 -326
  42. data/sig/generated/xlsxrb/chart_builder.rbs +319 -90
  43. data/sig/generated/xlsxrb/dsl_helpers.rbs +20 -2
  44. data/sig/generated/xlsxrb/elements/cell.rbs +92 -20
  45. data/sig/generated/xlsxrb/elements/column.rbs +61 -2
  46. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +49 -7
  47. data/sig/generated/xlsxrb/elements/image.rbs +30 -8
  48. data/sig/generated/xlsxrb/elements/metadata.rbs +1587 -0
  49. data/sig/generated/xlsxrb/elements/row.rbs +61 -21
  50. data/sig/generated/xlsxrb/elements/styles.rbs +96 -58
  51. data/sig/generated/xlsxrb/elements/types.rbs +27 -0
  52. data/sig/generated/xlsxrb/elements/workbook.rbs +63 -52
  53. data/sig/generated/xlsxrb/elements/worksheet.rbs +192 -51
  54. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -0
  55. data/sig/generated/xlsxrb/ooxml/reader.rbs +3 -0
  56. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +1 -1
  57. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +1 -1
  58. data/sig/generated/xlsxrb/ooxml/writer.rbs +3 -0
  59. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
  60. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
  61. data/sig/generated/xlsxrb/stream_row.rbs +48 -14
  62. data/sig/generated/xlsxrb/stream_sheet.rbs +324 -115
  63. data/sig/generated/xlsxrb/stream_writer.rbs +1068 -255
  64. data/sig/generated/xlsxrb/style_builder.rbs +389 -79
  65. data/sig/generated/xlsxrb/utils.rbs +34 -18
  66. data/sig/generated/xlsxrb/workbook_builder.rbs +234 -34
  67. data/sig/generated/xlsxrb/worksheet_builder.rbs +628 -126
  68. data/sig/generated/xlsxrb.rbs +257 -49
  69. metadata +3 -1
@@ -13,96 +13,198 @@ module Xlsxrb
13
13
  #
14
14
  # @api public
15
15
  class Worksheet
16
+ # @return [Array<Hash[Symbol, untyped]>]
17
+ #
18
+ # Corresponds to ECMA-376 Part 4 §18.3.1.18 (<conditionalFormatting> and <cfRule> elements).
19
+ # In the OpenXML specification, conditional formatting definitions are emitted as
20
+ # `<conditionalFormatting>` elements containing individual rule definitions (`<cfRule>`).
21
+ # While ECMA-376 uses the uncountable noun `conditionalFormatting` as the XML element name,
22
+ # xlsxrb exposes these rules collectively as {#conditional_formats} (Array of Hashes)
23
+ # to maintain symmetric plural collection naming alongside other collections
24
+ # (e.g. {#tables}, {#data_validations}, {#merged_cells}) and paired with the singular builder
25
+ # method {WorksheetBuilder#conditional_format}.
26
+ #
27
+ # @api public
28
+ # : Array[Elements::ConditionalFormat]
29
+ attr_reader conditional_formats: untyped
30
+
31
+ # : String?
16
32
  attr_reader name: untyped
17
33
 
34
+ # : Array[Elements::Row]
18
35
  attr_reader rows: untyped
19
36
 
37
+ # : Array[Elements::Column]
20
38
  attr_reader columns: untyped
21
39
 
40
+ # : Array[Elements::Chart]
22
41
  attr_reader charts: untyped
23
42
 
24
- attr_reader conditional_formatting: untyped
25
-
43
+ # : Array[Elements::DataValidation]
26
44
  attr_reader data_validations: untyped
27
45
 
46
+ # : Hash[untyped, untyped]
28
47
  attr_reader unmapped_data: untyped
29
48
 
49
+ # : Array[String]
30
50
  attr_reader errors: untyped
31
51
 
52
+ # : Symbol
32
53
  attr_reader state: untyped
33
54
 
55
+ # : Hash[String, Elements::Hyperlink]
34
56
  attr_reader hyperlinks: untyped
35
57
 
58
+ # : Array[Elements::Comment]
36
59
  attr_reader comments: untyped
37
60
 
61
+ # : Array[Elements::Image]
38
62
  attr_reader images: untyped
39
63
 
64
+ # : (Elements::Styles | Hash[untyped, untyped])?
40
65
  attr_reader styles: untyped
41
66
 
42
- attr_reader date1904: untyped
43
-
67
+ # : String?
44
68
  attr_reader print_area: untyped
45
69
 
70
+ # : Elements::PrintTitles?
46
71
  attr_reader print_titles: untyped
47
72
 
73
+ # : Array[Elements::SparklineGroup]
48
74
  attr_reader sparkline_groups: untyped
49
75
 
76
+ # : Array[String]
50
77
  attr_reader merged_cells: untyped
51
78
 
79
+ # : String?
52
80
  attr_reader auto_filter: untyped
53
81
 
82
+ # : Array[Elements::Table]
54
83
  attr_reader tables: untyped
55
84
 
85
+ # : Array[Elements::Shape]
56
86
  attr_reader shapes: untyped
57
87
 
88
+ # : Elements::FreezePane?
58
89
  attr_reader freeze_pane: untyped
59
90
 
91
+ # : Elements::PageSetup
60
92
  attr_reader page_setup: untyped
61
93
 
94
+ # : Elements::PageMargins?
62
95
  attr_reader page_margins: untyped
63
96
 
97
+ # : Elements::HeaderFooter
64
98
  attr_reader header_footer: untyped
65
99
 
100
+ # : Elements::PrintOptions
66
101
  attr_reader print_options: untyped
67
102
 
103
+ # : Elements::SheetProtection?
68
104
  attr_reader sheet_protection: untyped
69
105
 
106
+ # : Elements::SheetView
70
107
  attr_reader sheet_view: untyped
71
108
 
109
+ # : Elements::SheetProperties
72
110
  attr_reader sheet_properties: untyped
73
111
 
112
+ # : Elements::SheetFormat
74
113
  attr_reader sheet_format: untyped
75
114
 
115
+ # : Array[Elements::PageBreak]
76
116
  attr_reader row_breaks: untyped
77
117
 
78
- attr_reader col_breaks: untyped
118
+ # : Array[Elements::PageBreak]
119
+ attr_reader column_breaks: untyped
79
120
 
121
+ # : Array[Elements::ProtectedRange]
80
122
  attr_reader protected_ranges: untyped
81
123
 
124
+ # : Array[String]
82
125
  attr_reader cell_watches: untyped
83
126
 
127
+ # : Array[Elements::IgnoredError]
84
128
  attr_reader ignored_errors: untyped
85
129
 
130
+ # : Elements::PhoneticProperties?
86
131
  attr_reader phonetic_properties: untyped
87
132
 
133
+ # : (Elements::Selection | Array[Elements::Selection])?
88
134
  attr_reader selection: untyped
89
135
 
90
- attr_reader sheet_calc_pr: untyped
91
-
136
+ # : Elements::BackgroundImage?
92
137
  attr_reader background_image: untyped
93
138
 
139
+ # : Array[Elements::ThreadedComment]
94
140
  attr_reader threaded_comments: untyped
95
141
 
96
- attr_writer dimension: untyped
142
+ # : Array[Elements::PivotTable]
143
+ attr_reader pivot_tables: untyped
97
144
 
98
- alias conditional_formats conditional_formatting
145
+ # : Elements::SplitPane?
146
+ attr_reader split_pane: untyped
99
147
 
100
- alias phonetic_pr phonetic_properties
148
+ # : Hash[Integer, Elements::FilterColumn]
149
+ attr_reader filter_columns: untyped
150
+
151
+ # : Elements::SortState?
152
+ attr_reader sort_state: untyped
153
+
154
+ # : Array[Elements::HeaderFooterImage]
155
+ attr_reader header_footer_images: untyped
156
+
157
+ # @deprecated Worksheet instances are immutable value objects. In 0.2.0, #dimension= will be removed.
158
+ # : (String? new_dim) -> String?
159
+ def dimension=: (String? new_dim) -> String?
160
+
161
+ # @deprecated Use {#date1904?} instead. Will be removed in 0.2.0.
162
+ # : () -> bool
163
+ def date1904: () -> bool
164
+
165
+ # Closes the worksheet resources (no-op for in-memory worksheet).
166
+ #
167
+ # @return [void]
168
+ # @api public
169
+ # : () -> void
170
+ def close: () -> void
171
+
172
+ # Support array pattern matching.
173
+ #
174
+ # @return [Array<Object>]
175
+ # @api public
176
+ # : () -> Array[untyped]
177
+ def deconstruct: () -> Array[untyped]
178
+
179
+ # @deprecated Use {#column_breaks} instead.
180
+ # : () -> Array[Elements::PageBreak]
181
+ def col_breaks: () -> Array[Elements::PageBreak]
182
+
183
+ # Returns worksheet calculation properties (<sheetCalcPr>), or nil if none configured.
184
+ #
185
+ # @return [Elements::SheetCalcProperties, nil]
186
+ # @api public
187
+ # : () -> Elements::SheetCalcProperties?
188
+ def sheet_calc_properties: () -> Elements::SheetCalcProperties?
189
+
190
+ # @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
191
+ # : () -> Elements::SheetCalcProperties?
192
+ def sheet_calc_pr: () -> Elements::SheetCalcProperties?
101
193
 
102
- alias calc_pr sheet_calc_pr
194
+ # @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
195
+ # : () -> Elements::SheetCalcProperties?
196
+ def calc_pr: () -> Elements::SheetCalcProperties?
197
+
198
+ # @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.
199
+ alias conditional_formatting conditional_formats
200
+
201
+ # @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
202
+ alias phonetic_pr phonetic_properties
103
203
 
204
+ # @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
104
205
  alias background_picture background_image
105
206
 
207
+ # @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
106
208
  alias picture background_image
107
209
 
108
210
  # @param name [String] The worksheet name (max 31 characters).
@@ -140,7 +242,8 @@ module Xlsxrb
140
242
  # @param sheet_properties [Hash] Sheet properties (e.g. tabColor, outlinePr).
141
243
  # @param sheet_format [Hash] Sheet format properties (e.g. defaultRowHeight, defaultColWidth).
142
244
  # @param row_breaks [Array<Integer | Hash>] Explicit page row breaks.
143
- # @param col_breaks [Array<Integer | Hash>] Explicit page column breaks.
245
+ # @param column_breaks [Array<Integer | Hash>] Explicit page column breaks.
246
+ # @param col_breaks [Array<Integer | Hash>] Deprecated alias for column_breaks.
144
247
  # @param protected_ranges [Array<Hash>] Protected range definitions.
145
248
  # @param cell_watches [Array<String>] Watched cell references.
146
249
  # @param ignored_errors [Array<Hash>] Ignored error rules.
@@ -149,8 +252,8 @@ module Xlsxrb
149
252
  # @param sheet_calc_pr [Hash, nil] Worksheet calculation properties.
150
253
  # @param background_image [Hash, nil] Worksheet background image specification.
151
254
  # @param threaded_comments [Array<Hash>] Threaded comments in the sheet.
152
- # : (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[Hash[Symbol, untyped]], ?conditional_formatting: Array[Hash[Symbol, untyped]]?, ?data_validations: Array[Hash[Symbol, untyped]], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?, ?conditional_formats: Array[Hash[Symbol, untyped]]?, ?state: Symbol, ?hyperlinks: Hash[String, untyped], ?comments: Array[Hash[Symbol, untyped]], ?images: Array[Elements::Image], ?styles: (Elements::Styles | Hash[untyped, untyped])?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?print_area: String?, ?print_titles: Hash[Symbol, untyped]?, ?sparkline_groups: Array[Hash[Symbol, untyped]], ?merged_cells: Array[String], ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]], ?shapes: Array[Hash[Symbol, untyped]], ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped], ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped], ?print_options: Hash[Symbol, untyped], ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped], ?sheet_properties: Hash[Symbol, untyped], ?sheet_format: Hash[Symbol, untyped], ?row_breaks: Array[untyped], ?col_breaks: Array[untyped], ?protected_ranges: Array[Hash[Symbol, untyped]], ?cell_watches: Array[String], ?ignored_errors: Array[Hash[Symbol, untyped]], ?phonetic_properties: Hash[Symbol, untyped]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?, ?sheet_calc_pr: Hash[Symbol, untyped]?, ?background_image: Hash[Symbol, untyped]?, ?threaded_comments: Array[Hash[Symbol, untyped]]) -> void
153
- def initialize: (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[Hash[Symbol, untyped]], ?conditional_formatting: Array[Hash[Symbol, untyped]]?, ?data_validations: Array[Hash[Symbol, untyped]], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?, ?conditional_formats: Array[Hash[Symbol, untyped]]?, ?state: Symbol, ?hyperlinks: Hash[String, untyped], ?comments: Array[Hash[Symbol, untyped]], ?images: Array[Elements::Image], ?styles: (Elements::Styles | Hash[untyped, untyped])?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?print_area: String?, ?print_titles: Hash[Symbol, untyped]?, ?sparkline_groups: Array[Hash[Symbol, untyped]], ?merged_cells: Array[String], ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]], ?shapes: Array[Hash[Symbol, untyped]], ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped], ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped], ?print_options: Hash[Symbol, untyped], ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped], ?sheet_properties: Hash[Symbol, untyped], ?sheet_format: Hash[Symbol, untyped], ?row_breaks: Array[untyped], ?col_breaks: Array[untyped], ?protected_ranges: Array[Hash[Symbol, untyped]], ?cell_watches: Array[String], ?ignored_errors: Array[Hash[Symbol, untyped]], ?phonetic_properties: Hash[Symbol, untyped]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?, ?sheet_calc_pr: Hash[Symbol, untyped]?, ?background_image: Hash[Symbol, untyped]?, ?threaded_comments: Array[Hash[Symbol, untyped]]) -> void
255
+ # : (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[untyped], ?conditional_formatting: Array[untyped]?, ?data_validations: Array[untyped], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?, ?conditional_formats: Array[untyped]?, ?state: Symbol, ?hyperlinks: Hash[String, untyped], ?comments: Array[untyped], ?images: Array[Elements::Image], ?styles: (Elements::Styles | Hash[untyped, untyped])?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?print_area: String?, ?print_titles: untyped, ?sparkline_groups: Array[untyped], ?merged_cells: Array[String], ?auto_filter: String?, ?tables: Array[untyped], ?shapes: Array[untyped], ?freeze_pane: untyped, ?page_setup: untyped, ?page_margins: untyped, ?header_footer: untyped, ?print_options: untyped, ?sheet_protection: untyped, ?sheet_view: untyped, ?sheet_properties: untyped, ?sheet_format: untyped, ?row_breaks: Array[untyped], ?column_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[untyped], ?cell_watches: Array[String], ?ignored_errors: Array[untyped], ?phonetic_properties: untyped, ?selection: untyped, ?sheet_calc_properties: untyped, ?sheet_calc_pr: untyped, ?background_image: untyped, ?threaded_comments: Array[untyped], ?pivot_tables: Array[untyped]?, ?split_pane: untyped, ?filter_columns: Hash[Integer, untyped]?, ?sort_state: untyped, ?header_footer_images: Array[untyped]?) -> void
256
+ def initialize: (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[untyped], ?conditional_formatting: Array[untyped]?, ?data_validations: Array[untyped], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?, ?conditional_formats: Array[untyped]?, ?state: Symbol, ?hyperlinks: Hash[String, untyped], ?comments: Array[untyped], ?images: Array[Elements::Image], ?styles: (Elements::Styles | Hash[untyped, untyped])?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?print_area: String?, ?print_titles: untyped, ?sparkline_groups: Array[untyped], ?merged_cells: Array[String], ?auto_filter: String?, ?tables: Array[untyped], ?shapes: Array[untyped], ?freeze_pane: untyped, ?page_setup: untyped, ?page_margins: untyped, ?header_footer: untyped, ?print_options: untyped, ?sheet_protection: untyped, ?sheet_view: untyped, ?sheet_properties: untyped, ?sheet_format: untyped, ?row_breaks: Array[untyped], ?column_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[untyped], ?cell_watches: Array[String], ?ignored_errors: Array[untyped], ?phonetic_properties: untyped, ?selection: untyped, ?sheet_calc_properties: untyped, ?sheet_calc_pr: untyped, ?background_image: untyped, ?threaded_comments: Array[untyped], ?pivot_tables: Array[untyped]?, ?split_pane: untyped, ?filter_columns: Hash[Integer, untyped]?, ?sort_state: untyped, ?header_footer_images: Array[untyped]?) -> void
154
257
 
155
258
  # Returns whether trailing empty rows are omitted during iteration.
156
259
  #
@@ -159,7 +262,9 @@ module Xlsxrb
159
262
  # : () -> bool
160
263
  def trim_empty_rows?: () -> bool
161
264
 
162
- alias trim_empty_rows trim_empty_rows?
265
+ # @deprecated Use {#trim_empty_rows?} instead. Will be removed in 0.2.0.
266
+ # : () -> bool
267
+ def trim_empty_rows: () -> bool
163
268
 
164
269
  # Returns whether skipped rows are padded during iteration.
165
270
  #
@@ -168,7 +273,9 @@ module Xlsxrb
168
273
  # : () -> bool
169
274
  def pad_empty_rows?: () -> bool
170
275
 
171
- alias pad_empty_rows pad_empty_rows?
276
+ # @deprecated Use {#pad_empty_rows?} instead. Will be removed in 0.2.0.
277
+ # : () -> bool
278
+ def pad_empty_rows: () -> bool
172
279
 
173
280
  # Returns whether missing cells within rows are padded during iteration.
174
281
  #
@@ -177,7 +284,9 @@ module Xlsxrb
177
284
  # : () -> bool
178
285
  def pad_empty_cells?: () -> bool
179
286
 
180
- alias pad_empty_cells pad_empty_cells?
287
+ # @deprecated Use {#pad_empty_cells?} instead. Will be removed in 0.2.0.
288
+ # : () -> bool
289
+ def pad_empty_cells: () -> bool
181
290
 
182
291
  # Returns whether the worksheet uses the 1904 date system.
183
292
  #
@@ -215,7 +324,9 @@ module Xlsxrb
215
324
  # : () -> bool
216
325
  def fit_to_page?: () -> bool
217
326
 
218
- alias fit_to_page fit_to_page?
327
+ # @deprecated Use {#fit_to_page?} instead. Will be removed in 0.2.0.
328
+ # : () -> bool
329
+ def fit_to_page: () -> bool
219
330
 
220
331
  # Returns whether full calculation on load is enabled on this worksheet.
221
332
  #
@@ -224,7 +335,9 @@ module Xlsxrb
224
335
  # : () -> bool
225
336
  def full_calc_on_load?: () -> bool
226
337
 
227
- alias full_calc_on_load full_calc_on_load?
338
+ # @deprecated Use {#full_calc_on_load?} instead. Will be removed in 0.2.0.
339
+ # : () -> bool
340
+ def full_calc_on_load: () -> bool
228
341
 
229
342
  # Returns the outline and grouping properties of the worksheet, or an empty hash if none configured.
230
343
  #
@@ -233,6 +346,7 @@ module Xlsxrb
233
346
  # : () -> Hash[Symbol, untyped]
234
347
  def outline_properties: () -> Hash[Symbol, untyped]
235
348
 
349
+ # @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
236
350
  alias outline_pr outline_properties
237
351
 
238
352
  # Iterate over rows in the worksheet.
@@ -327,14 +441,15 @@ module Xlsxrb
327
441
  # Returns all images anchored at a specific cell reference or 0-based coordinate.
328
442
  #
329
443
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
330
- # @param col [Integer, nil] Optional 0-based column index.
444
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
331
445
  # @return [Array<Elements::Image>]
332
446
  # @api public
333
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> Array[Elements::Image]
334
- def images_at: (String | Symbol | Integer ref_or_row, ?Integer? col) -> Array[Elements::Image]
447
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::Image]
448
+ def images_at: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::Image]
335
449
 
336
450
  # Yields self with images loaded or returns self.
337
451
  #
452
+ # @deprecated Access {#images} directly. Lazy-loading is automatic. Will be removed in 0.2.0.
338
453
  # @yield [sheet]
339
454
  # @yieldparam sheet [Elements::Worksheet]
340
455
  # @return [Elements::Worksheet, void]
@@ -374,77 +489,96 @@ module Xlsxrb
374
489
  # Returns hyperlink metadata for the given cell reference, or nil.
375
490
  #
376
491
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
377
- # @param col [Integer, nil] Optional 0-based column index if ref_or_row is a row index.
378
- # @return [Hash, nil]
492
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
493
+ # @return [Elements::Hyperlink, nil]
379
494
  # @api public
380
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> Hash[Symbol, untyped]?
381
- def hyperlink: (String | Symbol | Integer ref_or_row, ?Integer? col) -> Hash[Symbol, untyped]?
495
+ # : (String | Symbol | Integer | nil ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Hyperlink?
496
+ def hyperlink: (String | Symbol | Integer | nil ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Hyperlink?
382
497
 
383
498
  # Returns comment metadata for the given cell reference, or nil.
384
499
  #
385
500
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
386
- # @param col [Integer, nil] Optional 0-based column index if ref_or_row is a row index.
387
- # @return [Hash, nil]
501
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
502
+ # @return [Elements::Comment, nil]
388
503
  # @api public
389
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> Hash[Symbol, untyped]?
390
- def comment: (String | Symbol | Integer ref_or_row, ?Integer? col) -> Hash[Symbol, untyped]?
504
+ # : (String | Symbol | Integer | nil ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Comment?
505
+ def comment: (String | Symbol | Integer | nil ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Comment?
391
506
 
392
507
  # Returns comments indexed by cell reference.
393
508
  #
394
- # @return [Hash<String, Hash[Symbol, untyped]>]
509
+ # @return [Hash<String, Elements::Comment>]
395
510
  # @api public
396
- # : () -> Hash[String, Hash[Symbol, untyped]]
397
- def comments_by_ref: () -> Hash[String, Hash[Symbol, untyped]]
511
+ # : () -> Hash[String, Elements::Comment]
512
+ def comments_by_ref: () -> Hash[String, Elements::Comment]
513
+
514
+ # Returns the root threaded comment for the given cell reference, or nil.
515
+ #
516
+ # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
517
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
518
+ # @return [Elements::ThreadedComment, nil]
519
+ # @api public
520
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::ThreadedComment?
521
+ def threaded_comment: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::ThreadedComment?
398
522
 
399
523
  # Returns threaded comments for the given cell reference, or empty array.
400
524
  #
401
525
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
402
- # @param col [Integer, nil] Optional 0-based column index.
403
- # @return [Array<Hash[Symbol, untyped]>]
526
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
527
+ # @return [Array<Elements::ThreadedComment>]
404
528
  # @api public
405
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> Array[Hash[Symbol, untyped]]
406
- def threaded_comment: (String | Symbol | Integer ref_or_row, ?Integer? col) -> Array[Hash[Symbol, untyped]]
529
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::ThreadedComment]
530
+ def threaded_comments_at: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Array[Elements::ThreadedComment]
407
531
 
408
532
  # Returns threaded comments indexed by cell reference.
409
533
  #
410
- # @return [Hash<String, Array<Hash[Symbol, untyped]>>]
534
+ # @return [Hash<String, Array<Elements::ThreadedComment>>]
411
535
  # @api public
412
- # : () -> Hash[String, Array[Hash[Symbol, untyped]]]
413
- def threaded_comments_by_ref: () -> Hash[String, Array[Hash[Symbol, untyped]]]
536
+ # : () -> Hash[String, Array[Elements::ThreadedComment]]
537
+ def threaded_comments_by_ref: () -> Hash[String, Array[Elements::ThreadedComment]]
414
538
 
415
539
  # Access a cell by reference or 0-based coordinates.
416
540
  #
417
541
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
418
- # @param col [Integer, nil] Optional 0-based column index.
542
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
419
543
  # @return [Elements::Cell, nil]
420
544
  # @api public
421
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> Elements::Cell?
422
- def cell: (String | Symbol | Integer ref_or_row, ?Integer? col) -> Elements::Cell?
545
+ # Access a cell by reference (e.g. "A1") or 0-based coordinate indices (row, col).
546
+ #
547
+ # @deprecated Use {#[]} instead (e.g. sheet["A1"] or sheet[0, 0]). Will be removed in 0.2.0.
548
+ # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
549
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
550
+ # @return [Elements::Cell, nil]
551
+ # @api public
552
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
553
+ def cell: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
423
554
 
424
555
  # Returns the formatted string representation of a cell's value.
425
556
  #
426
557
  # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
427
- # @param col [Integer, nil] Optional 0-based column index.
558
+ # @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
428
559
  # @return [String, nil]
429
560
  # @api public
430
- # : (String | Symbol | Integer ref_or_row, ?Integer? col) -> String?
431
- def formatted_value: (String | Symbol | Integer ref_or_row, ?Integer? col) -> String?
561
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
562
+ def formatted_value: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
432
563
 
433
564
  # Returns a new Worksheet with the specified cell updated.
434
565
  #
435
566
  # @example
436
567
  # new_sheet = sheet.update_cell("B1", value: "Updated")
437
568
  #
438
- # @param ref [String] The cell reference (e.g. "B1").
569
+ # @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "B1") or 0-based row index.
570
+ # @param col_or_value [Integer, String, Symbol, nil] 0-based column index or column letter/Symbol when ref_or_row is a row index.
439
571
  # @param value [Object] The new cell value.
440
- # @param style_index [Integer, String, nil] Optional new style index.
572
+ # @param style [String, Symbol, Hash, nil] Optional new style name or inline style properties.
573
+ # @param style_index [Integer, nil] Optional new 0-based style index.
441
574
  # @param formula [Elements::Formula, nil] Optional new formula.
442
575
  # @param hyperlink [Hash, String, nil] Optional new hyperlink.
576
+ # @deprecated Use {Xlsxrb.read} + {Xlsxrb.write} for streaming transformations or {Xlsxrb.write} DSL for report generation. Will be removed in 0.2.0.
443
577
  # @param comment [Hash, String, nil] Optional new comment.
444
578
  # @return [Worksheet] A new Worksheet instance.
445
579
  # @api public
446
- # : (String ref, ?value: untyped, ?style_index: Integer | String | nil, ?formula: Elements::Formula?, ?hyperlink: (Hash[Symbol, untyped] | String)?, ?comment: (Hash[Symbol, untyped] | String)?) -> Elements::Worksheet
447
- def update_cell: (String ref, ?value: untyped, ?style_index: Integer | String | nil, ?formula: Elements::Formula?, ?hyperlink: (Hash[Symbol, untyped] | String)?, ?comment: (Hash[Symbol, untyped] | String)?) -> Elements::Worksheet
580
+ # : (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col_or_value, ?value: untyped, ?style: (String | Symbol | Hash[Symbol, untyped])?, ?style_index: (Integer | String | Symbol | Hash[Symbol, untyped])?, ?formula: Elements::Formula?, ?hyperlink: (Hash[Symbol, untyped] | String)?, ?comment: (Hash[Symbol, untyped] | String)?) -> Elements::Worksheet
581
+ def update_cell: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col_or_value, ?value: untyped, ?style: (String | Symbol | Hash[Symbol, untyped])?, ?style_index: (Integer | String | Symbol | Hash[Symbol, untyped])?, ?formula: Elements::Formula?, ?hyperlink: (Hash[Symbol, untyped] | String)?, ?comment: (Hash[Symbol, untyped] | String)?) -> Elements::Worksheet
448
582
 
449
583
  # Returns a new Worksheet with attributes replaced (Data-like behavior).
450
584
  #
@@ -474,10 +608,16 @@ module Xlsxrb
474
608
  # : () -> Elements::Worksheet
475
609
  def load: () -> Elements::Worksheet
476
610
 
477
- alias to_worksheet load
611
+ # @deprecated Use {#load} instead. Will be removed in 0.2.0.
612
+ # : () -> Elements::Worksheet
613
+ def to_worksheet: () -> Elements::Worksheet
478
614
 
479
615
  FORBIDDEN_NAME_CHARS: ::Regexp
480
616
 
617
+ # @api private
618
+ # : () -> Regexp
619
+ def self.forbidden_name_chars: () -> Regexp
620
+
481
621
  # Returns whether the worksheet name is valid according to OOXML specifications (1..31 chars, no forbidden chars).
482
622
  #
483
623
  # @param name [Object]
@@ -490,6 +630,7 @@ module Xlsxrb
490
630
  # @param name [String]
491
631
  # @param rows [Array<Elements::Row>]
492
632
  # @return [Array<String>] List of errors.
633
+ # @api private
493
634
  # : (untyped name, untyped rows) -> Array[String]
494
635
  def self.validate: (untyped name, untyped rows) -> Array[String]
495
636
 
@@ -317,6 +317,8 @@ module Xlsxrb
317
317
 
318
318
  attr_reader col_breaks: untyped
319
319
 
320
+ attr_reader column_breaks: untyped
321
+
320
322
  def initialize: () -> untyped
321
323
 
322
324
  def start_element: (untyped _uri, untyped local_name, untyped qname, untyped attributes) -> untyped
@@ -473,6 +475,65 @@ module Xlsxrb
473
475
 
474
476
  def element_name: (untyped local_name, untyped qname) -> untyped
475
477
  end
478
+
479
+ # SAX2 listener for parsing <x14:sparklineGroups> and child <x14:sparklineGroup> elements.
480
+ class SparklineGroupsListener
481
+ include REXML::SAX2Listener
482
+
483
+ COLOR_TAG_MAP: untyped
484
+
485
+ # @return [Array<Hash[Symbol, untyped]>]
486
+ # : Array[Hash[Symbol, untyped]]
487
+ attr_reader groups: untyped
488
+
489
+ alias sparkline_groups groups
490
+
491
+ # : () -> void
492
+ def initialize: () -> void
493
+
494
+ # : (untyped _uri, String? local_name, String? qname, Hash[String, String] attributes) -> void
495
+ def start_element: (untyped _uri, String? local_name, String? qname, Hash[String, String] attributes) -> void
496
+
497
+ # : (String text) -> void
498
+ def characters: (String text) -> void
499
+
500
+ # : (untyped _uri, String? local_name, String? qname) -> void
501
+ def end_element: (untyped _uri, String? local_name, String? qname) -> void
502
+
503
+ private
504
+
505
+ # : (String? str) -> (Integer | Float | nil)
506
+ def parse_numeric: (String? str) -> (Integer | Float | nil)
507
+
508
+ # : (Hash[String, String] attributes) -> (String | Hash[Symbol, untyped] | nil)
509
+ def parse_color: (Hash[String, String] attributes) -> (String | Hash[Symbol, untyped] | nil)
510
+
511
+ # : (String? local_name, String? qname) -> String
512
+ def element_name: (String? local_name, String? qname) -> String
513
+ end
514
+
515
+ # SAX2 listener for parsing VML drawings of header and footer images (<v:shape> and <v:imagedata>).
516
+ class VmlHeaderFooterListener
517
+ include REXML::SAX2Listener
518
+
519
+ # @return [Array<Hash[Symbol, untyped]>]
520
+ # : Array[Hash[Symbol, untyped]]
521
+ attr_reader shapes: untyped
522
+
523
+ # : () -> void
524
+ def initialize: () -> void
525
+
526
+ # : (untyped _uri, String? local_name, String? qname, Hash[String, String] attributes) -> void
527
+ def start_element: (untyped _uri, String? local_name, String? qname, Hash[String, String] attributes) -> void
528
+
529
+ # : (untyped _uri, String? local_name, String? qname) -> void
530
+ def end_element: (untyped _uri, String? local_name, String? qname) -> void
531
+
532
+ private
533
+
534
+ # : (String? local_name, String? qname) -> String
535
+ def element_name: (String? local_name, String? qname) -> String
536
+ end
476
537
  end
477
538
  end
478
539
  end
@@ -3,6 +3,8 @@
3
3
  module Xlsxrb
4
4
  module Ooxml
5
5
  # Reads cells from an XLSX file.
6
+ #
7
+ # @api private
6
8
  class Reader
7
9
  def initialize: (untyped filepath) -> untyped
8
10
 
@@ -95,6 +97,7 @@ module Xlsxrb
95
97
  # Returns outline and grouping properties (<outlinePr>) for the given sheet.
96
98
  def outline_properties: (?sheet: untyped) -> untyped
97
99
 
100
+ # @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
98
101
  alias outline_pr outline_properties
99
102
 
100
103
  # Returns phonetic properties for the given sheet, or nil if not present.
@@ -80,7 +80,7 @@ module Xlsxrb
80
80
 
81
81
  def write_shared_strings_xml: (untyped zip) -> untyped
82
82
 
83
- def write_worksheet_xml: (untyped io, untyped sheet, ?drawing_rid: untyped, ?picture_rid: untyped, ?sheet_protection: untyped, ?protected_ranges: untyped, ?auto_filter: untyped, ?filter_columns: untyped, ?sort_state: untyped, ?merge_cells: untyped, ?conditional_formats: untyped, ?data_validations: untyped, ?hyperlinks: untyped, ?print_options: untyped, ?page_margins: untyped, ?page_setup: untyped, ?header_footer: untyped, ?row_breaks: untyped, ?col_breaks: untyped, ?cell_watches: untyped, ?ignored_errors: untyped, ?freeze_pane: untyped, ?split_pane: untyped, ?selection: untyped, ?sheet_view: untyped, ?sheet_properties: untyped, ?sheet_format: untyped, ?tables: untyped, ?table_start_rid: untyped, ?legacy_drawing_rid: untyped, ?sparkline_groups: untyped, ?phonetic_pr: untyped, ?sheet_calc_pr: untyped) -> untyped
83
+ def write_worksheet_xml: (untyped io, untyped sheet, ?drawing_rid: untyped, ?picture_rid: untyped, ?sheet_protection: untyped, ?protected_ranges: untyped, ?auto_filter: untyped, ?filter_columns: untyped, ?sort_state: untyped, ?merge_cells: untyped, ?conditional_formats: untyped, ?data_validations: untyped, ?hyperlinks: untyped, ?print_options: untyped, ?page_margins: untyped, ?page_setup: untyped, ?header_footer: untyped, ?row_breaks: untyped, ?col_breaks: untyped, ?column_breaks: untyped, ?cell_watches: untyped, ?ignored_errors: untyped, ?freeze_pane: untyped, ?split_pane: untyped, ?selection: untyped, ?sheet_view: untyped, ?sheet_properties: untyped, ?sheet_format: untyped, ?tables: untyped, ?table_start_rid: untyped, ?legacy_drawing_rid: untyped, ?sparkline_groups: untyped, ?phonetic_pr: untyped, ?sheet_calc_pr: untyped) -> untyped
84
84
 
85
85
  def build_table_xml: (untyped tbl, untyped table_id) -> untyped
86
86
 
@@ -36,7 +36,7 @@ module Xlsxrb
36
36
 
37
37
  # Write the worksheet footer. Call once after all rows.
38
38
  # Options for post-sheetData elements (in OOXML order):
39
- def finish: (?drawing_rid: untyped, ?picture_rid: untyped, ?sheet_protection: untyped, ?protected_ranges: untyped, ?auto_filter: untyped, ?filter_columns: untyped, ?sort_state: untyped, ?merge_cells: untyped, ?conditional_formats: untyped, ?data_validations: untyped, ?hyperlinks: untyped, ?print_options: untyped, ?page_margins: untyped, ?page_setup: untyped, ?header_footer: untyped, ?row_breaks: untyped, ?col_breaks: untyped, ?cell_watches: untyped, ?ignored_errors: untyped, ?tables: untyped, ?table_start_rid: untyped, ?legacy_drawing_rid: untyped, ?sparkline_groups: untyped, ?phonetic_pr: untyped, ?sheet_calc_pr: untyped) -> untyped
39
+ def finish: (?drawing_rid: untyped, ?picture_rid: untyped, ?sheet_protection: untyped, ?protected_ranges: untyped, ?auto_filter: untyped, ?filter_columns: untyped, ?sort_state: untyped, ?merge_cells: untyped, ?conditional_formats: untyped, ?data_validations: untyped, ?hyperlinks: untyped, ?print_options: untyped, ?page_margins: untyped, ?page_setup: untyped, ?header_footer: untyped, ?row_breaks: untyped, ?col_breaks: untyped, ?column_breaks: untyped, ?cell_watches: untyped, ?ignored_errors: untyped, ?tables: untyped, ?table_start_rid: untyped, ?legacy_drawing_rid: untyped, ?sparkline_groups: untyped, ?phonetic_pr: untyped, ?sheet_calc_pr: untyped) -> untyped
40
40
 
41
41
  private
42
42
 
@@ -3,6 +3,8 @@
3
3
  module Xlsxrb
4
4
  module Ooxml
5
5
  # Writes spreadsheet data into an XLSX file.
6
+ #
7
+ # @api private
6
8
  class Writer
7
9
  include DrawingXml
8
10
 
@@ -220,6 +222,7 @@ module Xlsxrb
220
222
  # : (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
221
223
  def default_font: (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
222
224
 
225
+ # @deprecated Use {#default_font} instead. Will be removed in 0.2.0.
223
226
  alias set_default_font default_font
224
227
 
225
228
  # Sets the indexed colors palette (array of ARGB hex strings, e.g. ["FF000000", "FFFFFFFF"]).
@@ -3,6 +3,8 @@
3
3
  module Xlsxrb
4
4
  module Ooxml
5
5
  # Generates a simple ZIP file using only the standard library.
6
+ #
7
+ # @api private
6
8
  class ZipGenerator
7
9
  def initialize: (untyped filepath) -> untyped
8
10
 
@@ -70,8 +70,8 @@ module Xlsxrb
70
70
  # : (untyped source, ?max_uncompressed_size: Integer) ?{ (ZipReader) -> untyped } -> (ZipReader | untyped)
71
71
  def self.open: (untyped source, ?max_uncompressed_size: Integer) ?{ (ZipReader) -> untyped } -> (ZipReader | untyped)
72
72
 
73
- # : (untyped io, ?max_uncompressed_size: Integer, ?should_close_io: bool) -> void
74
- def initialize: (untyped io, ?max_uncompressed_size: Integer, ?should_close_io: bool) -> void
73
+ # : (untyped io, ?max_uncompressed_size: Integer, ?should_close_io: bool, ?filepath: String?) -> void
74
+ def initialize: (untyped io, ?max_uncompressed_size: Integer, ?should_close_io: bool, ?filepath: String?) -> void
75
75
 
76
76
  # Returns a Hash { entry_name => raw_bytes } for all entries.
77
77
  # : () -> Hash[String, String?]