xlsxrb 0.1.5 → 0.1.7

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 (103) hide show
  1. checksums.yaml +4 -4
  2. data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +9 -0
  3. data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +2332 -0
  4. data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +4 -0
  5. data/.gem_rbs_collection/rubyzip/3.2/.rbs_meta.yaml +9 -0
  6. data/.gem_rbs_collection/rubyzip/3.2/manifest.yaml +8 -0
  7. data/.gem_rbs_collection/rubyzip/3.2/zip/central_directory.rbs +42 -0
  8. data/.gem_rbs_collection/rubyzip/3.2/zip/compressor.rbs +5 -0
  9. data/.gem_rbs_collection/rubyzip/3.2/zip/constants.rbs +47 -0
  10. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/aes_encryption.rbs +30 -0
  11. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/decrypted_io.rbs +9 -0
  12. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/encryption.rbs +7 -0
  13. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/null_encryption.rbs +19 -0
  14. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/traditional_encryption.rbs +31 -0
  15. data/.gem_rbs_collection/rubyzip/3.2/zip/decompressor.rbs +18 -0
  16. data/.gem_rbs_collection/rubyzip/3.2/zip/deflater.rbs +12 -0
  17. data/.gem_rbs_collection/rubyzip/3.2/zip/dirtyable.rbs +11 -0
  18. data/.gem_rbs_collection/rubyzip/3.2/zip/dos_time.rbs +13 -0
  19. data/.gem_rbs_collection/rubyzip/3.2/zip/entry.rbs +95 -0
  20. data/.gem_rbs_collection/rubyzip/3.2/zip/entry_set.rbs +31 -0
  21. data/.gem_rbs_collection/rubyzip/3.2/zip/errors.rbs +58 -0
  22. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/aes.rbs +24 -0
  23. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/generic.rbs +17 -0
  24. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/ntfs.rbs +23 -0
  25. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/old_unix.rbs +22 -0
  26. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/universal_time.rbs +30 -0
  27. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unix.rbs +20 -0
  28. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unknown.rbs +15 -0
  29. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/zip64.rbs +26 -0
  30. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field.rbs +21 -0
  31. data/.gem_rbs_collection/rubyzip/3.2/zip/file.rbs +131 -0
  32. data/.gem_rbs_collection/rubyzip/3.2/zip/file_split.rbs +14 -0
  33. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/dir.rbs +33 -0
  34. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/directory_iterator.rbs +21 -0
  35. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file.rbs +63 -0
  36. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file_stat.rbs +55 -0
  37. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/zip_file_name_mapper.rbs +35 -0
  38. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem.rbs +7 -0
  39. data/.gem_rbs_collection/rubyzip/3.2/zip/inflater.rbs +10 -0
  40. data/.gem_rbs_collection/rubyzip/3.2/zip/input_stream.rbs +22 -0
  41. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_input_stream.rbs +29 -0
  42. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_output_stream.rbs +17 -0
  43. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras.rbs +13 -0
  44. data/.gem_rbs_collection/rubyzip/3.2/zip/null_compressor.rbs +10 -0
  45. data/.gem_rbs_collection/rubyzip/3.2/zip/null_decompressor.rbs +8 -0
  46. data/.gem_rbs_collection/rubyzip/3.2/zip/null_input_stream.rbs +6 -0
  47. data/.gem_rbs_collection/rubyzip/3.2/zip/output_stream.rbs +30 -0
  48. data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_compressor.rbs +10 -0
  49. data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_decompressor.rbs +10 -0
  50. data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_directory.rbs +5 -0
  51. data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_stream.rbs +15 -0
  52. data/.gem_rbs_collection/rubyzip/3.2/zip/version.rbs +3 -0
  53. data/.gem_rbs_collection/rubyzip/3.2/zip.rbs +40 -0
  54. data/CHANGELOG.md +28 -0
  55. data/README.md +66 -44
  56. data/Rakefile +2 -1
  57. data/Steepfile +1 -2
  58. data/benchmark.rb +376 -0
  59. data/docs/ARCHITECTURE.md +12 -5
  60. data/docs/visual/VisualGallery.md +8 -0
  61. data/docs/wasm/ruby.wasm +0 -0
  62. data/lib/ruby_lsp/xlsxrb/addon.rb +43 -0
  63. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +769 -0
  64. data/lib/xlsxrb/elements/cell.rb +137 -11
  65. data/lib/xlsxrb/elements/column.rb +22 -0
  66. data/lib/xlsxrb/elements/row.rb +98 -5
  67. data/lib/xlsxrb/elements/types.rb +40 -5
  68. data/lib/xlsxrb/elements/workbook.rb +73 -5
  69. data/lib/xlsxrb/elements/worksheet.rb +110 -1
  70. data/lib/xlsxrb/ooxml/shared_strings_parser.rb +104 -40
  71. data/lib/xlsxrb/ooxml/worksheet_parser.rb +144 -23
  72. data/lib/xlsxrb/ooxml/worksheet_writer.rb +160 -145
  73. data/lib/xlsxrb/ooxml/xml_builder.rb +16 -10
  74. data/lib/xlsxrb/ooxml/zip_reader.rb +104 -18
  75. data/lib/xlsxrb/ooxml/zip_writer.rb +63 -25
  76. data/lib/xlsxrb/style_builder.rb +158 -30
  77. data/lib/xlsxrb/version.rb +1 -1
  78. data/lib/xlsxrb.rb +892 -336
  79. data/rbs_collection.lock.yaml +28 -0
  80. data/sig/generated/xlsxrb/elements/cell.rbs +39 -0
  81. data/sig/generated/xlsxrb/elements/column.rbs +35 -0
  82. data/sig/generated/xlsxrb/elements/row.rbs +39 -0
  83. data/sig/generated/xlsxrb/elements/types.rbs +82 -0
  84. data/sig/generated/xlsxrb/elements/workbook.rbs +32 -0
  85. data/sig/generated/xlsxrb/elements/worksheet.rbs +34 -0
  86. data/sig/generated/xlsxrb/ooxml/reader.rbs +1412 -0
  87. data/sig/generated/xlsxrb/ooxml/shared_strings_parser.rbs +21 -0
  88. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +44 -0
  89. data/sig/generated/xlsxrb/ooxml/utils.rbs +40 -0
  90. data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +46 -0
  91. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +66 -0
  92. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +67 -0
  93. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +92 -0
  94. data/sig/generated/xlsxrb/ooxml/writer.rbs +880 -0
  95. data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +45 -0
  96. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +30 -0
  97. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +38 -0
  98. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +45 -0
  99. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +45 -0
  100. data/sig/generated/xlsxrb/style_builder.rbs +212 -50
  101. data/sig/generated/xlsxrb.rbs +1646 -0
  102. data/sig/rexml.rbs +4 -0
  103. metadata +78 -1
@@ -0,0 +1,1646 @@
1
+ # Generated from lib/xlsxrb.rb with RBS::Inline
2
+
3
+ # Ruby XLSX read/write library.
4
+ module Xlsxrb
5
+ class Error < StandardError
6
+ DIV0: untyped
7
+
8
+ NA: untyped
9
+
10
+ NAME: untyped
11
+
12
+ NULL: untyped
13
+
14
+ NUM: untyped
15
+
16
+ REF: untyped
17
+
18
+ VALUE: untyped
19
+ end
20
+
21
+ class ParseError < Error
22
+ end
23
+
24
+ class ValidationError < Error
25
+ end
26
+
27
+ class ZipError < Error
28
+ end
29
+
30
+ TRACER: untyped
31
+
32
+ def self.in_span: (untyped name, ?attributes: untyped) ?{ (?) -> untyped } -> untyped
33
+
34
+ # Helper to easily create RichText objects.
35
+ # Supports both `Xlsxrb.rich_text({ text: "A" }, { text: "B" })`
36
+ # and `Xlsxrb.rich_text(text: "Hi", bold: true)`
37
+ #
38
+ # @param runs [Array<Hash>] Optional rich text runs.
39
+ # @param text [String, nil] Simple text.
40
+ # @param font_props [Hash] Font styling options (e.g., bold: true).
41
+ # @return [Elements::RichText] The resulting rich text.
42
+ # @api public
43
+ # : (*untyped runs, ?text: String?, **untyped font_props) -> untyped
44
+ def self.rich_text: (*untyped runs, ?text: String?, **untyped font_props) -> untyped
45
+
46
+ # Builder for block-style chart definitions.
47
+ # @api public
48
+ class ChartBuilder
49
+ # : () -> void
50
+ def initialize: () -> void
51
+
52
+ # : Hash[Symbol, untyped]
53
+ attr_reader options: untyped
54
+
55
+ # @api public
56
+ # : (untyped value) -> untyped
57
+ def type: (untyped value) -> untyped
58
+
59
+ # @api public
60
+ # : (untyped value) -> untyped
61
+ def title: (untyped value) -> untyped
62
+
63
+ # @api public
64
+ # : (?Hash[Symbol, untyped]? value) ?{ (SeriesBuilder) -> void } -> Array[Hash[Symbol, untyped]]
65
+ def series: (?Hash[Symbol, untyped]? value) ?{ (SeriesBuilder) -> void } -> Array[Hash[Symbol, untyped]]
66
+
67
+ # Configures the legend property for this chart.
68
+ # @param args [Array] Positional arguments.
69
+ # @param kwargs [Hash] Keyword arguments.
70
+ # @return [Object] the configured property
71
+ # @api public
72
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
73
+ def legend: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
74
+
75
+ # Configures the plot_area property for this chart.
76
+ # @param args [Array] Positional arguments.
77
+ # @param kwargs [Hash] Keyword arguments.
78
+ # @return [Object] the configured property
79
+ # @api public
80
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
81
+ def plot_area: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
82
+
83
+ # Configures the chart_space property for this chart.
84
+ # @param args [Array] Positional arguments.
85
+ # @param kwargs [Hash] Keyword arguments.
86
+ # @return [Object] the configured property
87
+ # @api public
88
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
89
+ def chart_space: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
90
+
91
+ # Configures the style property for this chart.
92
+ # @param args [Array] Positional arguments.
93
+ # @param kwargs [Hash] Keyword arguments.
94
+ # @return [Object] the configured property
95
+ # @api public
96
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String | Integer) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
97
+ def style: (*Hash[Symbol, String | Integer | bool | nil] | String | Integer args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
98
+
99
+ # Configures the data_labels property for this chart.
100
+ # @param args [Array] Positional arguments.
101
+ # @param kwargs [Hash] Keyword arguments.
102
+ # @return [Object] the configured property
103
+ # @api public
104
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
105
+ def data_labels: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
106
+
107
+ # Configures the plot_visible_only property for this chart.
108
+ # @param args [Array] Positional arguments.
109
+ # @param kwargs [Hash] Keyword arguments.
110
+ # @return [Object] the configured property
111
+ # @api public
112
+ # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
113
+ def plot_visible_only: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
114
+
115
+ # Configures the display_blanks_as property for this chart.
116
+ # @param args [Array] Positional arguments.
117
+ # @param kwargs [Hash] Keyword arguments.
118
+ # @return [Object] the configured property
119
+ # @api public
120
+ # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
121
+ def display_blanks_as: (*String args, **String | Integer | bool | nil kwargs) -> String
122
+
123
+ # Configures the view3d property for this chart.
124
+ # @param args [Array] Positional arguments.
125
+ # @param kwargs [Hash] Keyword arguments.
126
+ # @return [Object] the configured property
127
+ # @api public
128
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
129
+ def view3d: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
130
+
131
+ # Configures the category_axis property for this chart.
132
+ # @param args [Array] Positional arguments.
133
+ # @param kwargs [Hash] Keyword arguments.
134
+ # @return [Object] the configured property
135
+ # @api public
136
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
137
+ def category_axis: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
138
+
139
+ # Configures the value_axis property for this chart.
140
+ # @param args [Array] Positional arguments.
141
+ # @param kwargs [Hash] Keyword arguments.
142
+ # @return [Object] the configured property
143
+ # @api public
144
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
145
+ def value_axis: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
146
+
147
+ # Configures the show_legend_key property for this chart.
148
+ # @param args [Array] Positional arguments.
149
+ # @param kwargs [Hash] Keyword arguments.
150
+ # @return [Object] the configured property
151
+ # @api public
152
+ # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
153
+ def show_legend_key: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
154
+
155
+ # Builder for a single series entry in block-style chart definitions.
156
+ # @api public
157
+ class SeriesBuilder
158
+ # : () -> void
159
+ def initialize: () -> void
160
+
161
+ # : Hash[Symbol, untyped]
162
+ attr_reader options: untyped
163
+
164
+ # Configures the categories property for this series.
165
+ # @param args [Array] Positional arguments.
166
+ # @param kwargs [Hash] Keyword arguments.
167
+ # @return [Object] the configured property
168
+ # @api public
169
+ # : (*untyped args, **untyped kwargs) -> untyped
170
+ def categories: (*untyped args, **untyped kwargs) -> untyped
171
+
172
+ # Configures the values property for this series.
173
+ # @param args [Array] Positional arguments.
174
+ # @param kwargs [Hash] Keyword arguments.
175
+ # @return [Object] the configured property
176
+ # @api public
177
+ # : (*untyped args, **untyped kwargs) -> untyped
178
+ def values: (*untyped args, **untyped kwargs) -> untyped
179
+
180
+ # Configures the name property for this series.
181
+ # @param args [Array] Positional arguments.
182
+ # @param kwargs [Hash] Keyword arguments.
183
+ # @return [Object] the configured property
184
+ # @api public
185
+ # : (*untyped args, **untyped kwargs) -> untyped
186
+ def name: (*untyped args, **untyped kwargs) -> untyped
187
+
188
+ # Configures the marker property for this series.
189
+ # @param args [Array] Positional arguments.
190
+ # @param kwargs [Hash] Keyword arguments.
191
+ # @return [Object] the configured property
192
+ # @api public
193
+ # : (*untyped args, **untyped kwargs) -> untyped
194
+ def marker: (*untyped args, **untyped kwargs) -> untyped
195
+
196
+ # Configures the fill property for this series.
197
+ # @param args [Array] Positional arguments.
198
+ # @param kwargs [Hash] Keyword arguments.
199
+ # @return [Object] the configured property
200
+ # @api public
201
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
202
+ def fill: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
203
+
204
+ # Configures the line property for this series.
205
+ # @param args [Array] Positional arguments.
206
+ # @param kwargs [Hash] Keyword arguments.
207
+ # @return [Object] the configured property
208
+ # @api public
209
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
210
+ def line: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
211
+
212
+ # Configures the trendline property for this series.
213
+ # @param args [Array] Positional arguments.
214
+ # @param kwargs [Hash] Keyword arguments.
215
+ # @return [Object] the configured property
216
+ # @api public
217
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
218
+ def trendline: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
219
+
220
+ # Configures the data_labels property for this series.
221
+ # @param args [Array] Positional arguments.
222
+ # @param kwargs [Hash] Keyword arguments.
223
+ # @return [Object] the configured property
224
+ # @api public
225
+ # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
226
+ def data_labels: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
227
+
228
+ # Configures the smooth property for this series.
229
+ # @param args [Array] Positional arguments.
230
+ # @param kwargs [Hash] Keyword arguments.
231
+ # @return [Object] the configured property
232
+ # @api public
233
+ # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
234
+ def smooth: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
235
+
236
+ # Configures the shape property for this series.
237
+ # @param args [Array] Positional arguments.
238
+ # @param kwargs [Hash] Keyword arguments.
239
+ # @return [Object] the configured property
240
+ # @api public
241
+ # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
242
+ def shape: (*String args, **String | Integer | bool | nil kwargs) -> String
243
+
244
+ # Configures the type property for this series.
245
+ # @param args [Array] Positional arguments.
246
+ # @param kwargs [Hash] Keyword arguments.
247
+ # @return [Object] the configured property
248
+ # @api public
249
+ # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
250
+ def type: (*String args, **String | Integer | bool | nil kwargs) -> String
251
+ end
252
+ end
253
+
254
+ # Creates a Formula object for use in row values.
255
+ #
256
+ # @example Create a basic sum formula
257
+ # formula = Xlsxrb.formula("SUM(A1:A10)")
258
+ #
259
+ # @example Create a formula with precomputed cached value
260
+ # formula = Xlsxrb.formula("A1+B1", cached_value: 42)
261
+ #
262
+ # @param expression [String] The formula text without '=' (e.g. "SUM(A1:A10)").
263
+ # @param cached_value [Object, nil] Optional cached result. If nil, Excel will calculate on open.
264
+ # @return [Elements::Formula]
265
+ # @api public
266
+ # : (String expression, ?cached_value: String | Numeric | bool | nil) -> Elements::Formula
267
+ def self.formula: (String expression, ?cached_value: String | Numeric | bool | nil) -> Elements::Formula
268
+
269
+ # Reads an XLSX file into an in-memory Elements::Workbook.
270
+ #
271
+ # @example Read from file path
272
+ # workbook = Xlsxrb.read("data.xlsx")
273
+ # sheet = workbook["Sheet1"]
274
+ # puts sheet["A1"].value
275
+ #
276
+ # @example Read from IO stream
277
+ # workbook = File.open("data.xlsx", "rb") { |io| Xlsxrb.read(io) }
278
+ #
279
+ # @param source [String, IO] File path or IO object.
280
+ # @return [Elements::Workbook] The parsed workbook.
281
+ # @api public
282
+ # : (untyped source) -> Elements::Workbook
283
+ def self.read: (untyped source) -> Elements::Workbook
284
+
285
+ # Writes an Elements::Workbook to an XLSX file or IO stream.
286
+ #
287
+ # @example Write to file
288
+ # Xlsxrb.write("output.xlsx", workbook)
289
+ #
290
+ # @param target [String, IO] File path or IO object.
291
+ # @param workbook [Elements::Workbook] The workbook to write.
292
+ # @return [void]
293
+ # @api public
294
+ # : (untyped target, untyped workbook) -> void
295
+ def self.write: (untyped target, untyped workbook) -> void
296
+
297
+ # Modifies an existing XLSX file.
298
+ # Reads the workbook, passes it to the block, and writes the result.
299
+ # The block receives an Elements::Workbook and must return a modified one (e.g. via `update_sheet`).
300
+ # If no target is given, the source is overwritten.
301
+ #
302
+ # @example Modify a template and save to new file
303
+ # Xlsxrb.modify("template.xlsx", "output.xlsx") do |workbook|
304
+ # workbook.update_sheet("Sheet1") do |sheet|
305
+ # sheet.update_cell("B1", value: "Updated Title")
306
+ # .update_cell("B2", value: 100)
307
+ # end
308
+ # end
309
+ #
310
+ # @param source [String, IO] The source file path or IO object.
311
+ # @param target [String, IO, nil] The target file path or IO object. If nil, overwrites source.
312
+ # @yield [workbook] Yields the parsed workbook.
313
+ # @yieldparam workbook [Elements::Workbook] The parsed workbook.
314
+ # @yieldreturn [Elements::Workbook] The modified workbook.
315
+ # @return [void]
316
+ # @api public
317
+ # : (untyped source, ?untyped target) ?{ (Elements::Workbook) -> untyped } -> void
318
+ def self.modify: (untyped source, ?untyped target) ?{ (Elements::Workbook) -> untyped } -> void
319
+
320
+ # Represents a sheet being streamed sequentially from an XLSX file.
321
+ #
322
+ # @example Iterate rows in streaming mode
323
+ # Xlsxrb.foreach("large_data.xlsx") do |sheet|
324
+ # puts "Processing sheet: #{sheet.name}"
325
+ # sheet.each_row do |row|
326
+ # puts row.to_a.inspect
327
+ # end
328
+ # end
329
+ #
330
+ # @api public
331
+ class StreamSheet
332
+ attr_reader name: untyped
333
+
334
+ # @param name [String] The sheet name.
335
+ # @param sheet_xml [String] Raw XML content of the sheet.
336
+ # @param shared_strings [Array<String>] Shared strings table.
337
+ # : (String name, String sheet_xml, Array[String] shared_strings) -> void
338
+ def initialize: (String name, String sheet_xml, Array[String] shared_strings) -> void
339
+
340
+ # Iterate over rows in this streaming sheet.
341
+ #
342
+ # @yield [row]
343
+ # @yieldparam row [Elements::Row]
344
+ # @return [Enumerator, void]
345
+ # @api public
346
+ # : () { (Elements::Row) -> void } -> void
347
+ # : | () -> Enumerator[Elements::Row, void]
348
+ def each_row: () { (Elements::Row) -> void } -> void
349
+
350
+ # Iterate over rows in this streaming sheet.
351
+ #
352
+ # @yield [row]
353
+ # @yieldparam row [Elements::Row]
354
+ # @return [Enumerator, void]
355
+ # @api public
356
+ # : () { (Elements::Row) -> void } -> void
357
+ # : | () -> Enumerator[Elements::Row, void]
358
+ def each: () { (Elements::Row) -> void } -> void
359
+ end
360
+
361
+ # Streaming read: yields StreamSheet objects one at a time for each sheet in the workbook.
362
+ # Keeps memory usage minimal even for multi-gigabyte XLSX files.
363
+ #
364
+ # @example
365
+ # Xlsxrb.foreach("large.xlsx") do |sheet|
366
+ # puts "Sheet: #{sheet.name}"
367
+ # sheet.each_row { |row| process(row) }
368
+ # end
369
+ #
370
+ # @param source [String, IO] File path or IO object.
371
+ # @yield [sheet] Yields each sheet.
372
+ # @yieldparam sheet [StreamSheet] The streaming sheet object.
373
+ # @return [Enumerator, void]
374
+ # @api public
375
+ # : (untyped source) ?{ (StreamSheet) -> void } -> untyped
376
+ def self.foreach: (untyped source) ?{ (StreamSheet) -> void } -> untyped
377
+
378
+ # Streaming write: yields a StreamWriter context for high-speed, zero-allocation XLSX generation.
379
+ #
380
+ # @example Generate an Excel file with styles and multiple sheets
381
+ # Xlsxrb.generate("sales.xlsx") do |stream_writer|
382
+ # stream_writer.sheet("Q1") do |sheet|
383
+ # sheet.row(["Product", "Revenue"], styles: :bold)
384
+ # sheet.row(["Widget", 15000])
385
+ # end
386
+ # end
387
+ #
388
+ # @param target [String, IO] File path or IO stream (e.g. pipe, socket, Rails response buffer).
389
+ # @param strict_excel_mode [Boolean] Whether to enforce Excel specifications (max rows/cols/length).
390
+ # @yield [stream_writer]
391
+ # @yieldparam stream_writer [Xlsxrb::StreamWriter]
392
+ # @return [void]
393
+ # @api public
394
+ # : (untyped target, ?strict_excel_mode: bool) ?{ (StreamWriter) -> void } -> void
395
+ def self.generate: (untyped target, ?strict_excel_mode: bool) ?{ (StreamWriter) -> void } -> void
396
+
397
+ # Builds an in-memory Elements::Workbook using a declarative DSL.
398
+ #
399
+ # @example Build in-memory workbook
400
+ # workbook = Xlsxrb.build do |builder|
401
+ # builder.sheet("Overview") do |sheet|
402
+ # sheet.row(["Title", "Date"])
403
+ # sheet.row(["Report", Date.today])
404
+ # end
405
+ # end
406
+ #
407
+ # @param strict_excel_mode [Boolean] Whether to enforce Excel specifications.
408
+ # @yield [builder]
409
+ # @yieldparam builder [Xlsxrb::WorkbookBuilder]
410
+ # @return [Elements::Workbook]
411
+ # @api public
412
+ # : (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
413
+ def self.build: (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
414
+
415
+ # DSL context for Xlsxrb.build.
416
+ # @api public
417
+ class WorkbookBuilder
418
+ # : (?strict_excel_mode: bool) -> void
419
+ def initialize: (?strict_excel_mode: bool) -> void
420
+
421
+ # Set a workbook property.
422
+ #
423
+ # @note **SECURITY WARNING:** If you set `:update_links` to anything other than `"never"`,
424
+ # you may expose end-users to malicious external reference vulnerabilities (e.g., CSV/DDE Injection)
425
+ # when they open the generated Excel file. Ensure you fully trust the exported data.
426
+ #
427
+ # @param name [Symbol] The property name (e.g. :update_links).
428
+ # @param value [String, Integer, Boolean] The property value.
429
+ # @return [void]
430
+ # @api public
431
+ # : (Symbol name, String | Integer | bool value) -> (String | Integer | bool)
432
+ def workbook_property: (Symbol name, String | Integer | bool value) -> (String | Integer | bool)
433
+
434
+ # Add a new sheet.
435
+ #
436
+ # @param name [String, nil] The name of the sheet.
437
+ # @param opts [Hash] Sheet properties.
438
+ # @yield [sheet_builder]
439
+ # @yieldparam sheet_builder [Xlsxrb::WorksheetBuilder]
440
+ # @return [void]
441
+ # @api public
442
+ # : (?String? name, **untyped opts) ?{ (WorksheetBuilder) -> void } -> untyped
443
+ def sheet: (?String? name, **untyped opts) ?{ (WorksheetBuilder) -> void } -> untyped
444
+
445
+ alias [] sheet
446
+
447
+ # Add a defined name.
448
+ #
449
+ # @param name [String] The defined name.
450
+ # @param value [String] The formula or value.
451
+ # @param sheet [String, nil] Local sheet name.
452
+ # @param hidden [Boolean] Whether the defined name is hidden.
453
+ # @return [void]
454
+ # @api public
455
+ # : (String name, String value, ?sheet: String?, ?hidden: bool) -> void
456
+ def defined_name: (String name, String value, ?sheet: String?, ?hidden: bool) -> void
457
+
458
+ # Set the print area for a sheet.
459
+ #
460
+ # @param range [String] The range string (e.g. "A1:B10").
461
+ # @param sheet [String, nil] The sheet name.
462
+ # @return [void]
463
+ # @api public
464
+ # : (String range, ?sheet: String?) -> void
465
+ def print_area: (String range, ?sheet: String?) -> void
466
+
467
+ # Set print titles for a sheet.
468
+ #
469
+ # @param rows [String, nil] Rows to repeat (e.g. "1:2").
470
+ # @param cols [String, nil] Columns to repeat (e.g. "A:B").
471
+ # @param sheet [String, nil] The sheet name.
472
+ # @return [void]
473
+ # @api public
474
+ # : (?rows: String?, ?cols: String?, ?sheet: String?) -> void
475
+ def print_titles: (?rows: String?, ?cols: String?, ?sheet: String?) -> void
476
+
477
+ # Set workbook protection.
478
+ #
479
+ # @param opts [Hash] Protection options.
480
+ # @return [void]
481
+ # @api public
482
+ # : (**String | Integer | bool | nil opts) -> void
483
+ def protect_workbook: (**String | Integer | bool | nil opts) -> void
484
+
485
+ # Set a core document property.
486
+ #
487
+ # @param name [Symbol] The property name.
488
+ # @param value [String, Integer, Time] The property value.
489
+ # @return [void]
490
+ # @api public
491
+ # : (Symbol name, String | Integer | Time value) -> void
492
+ def core_property: (Symbol name, String | Integer | Time value) -> void
493
+
494
+ # Set an app document property.
495
+ #
496
+ # @param name [Symbol] The property name.
497
+ # @param value [String, Integer, Time] The property value.
498
+ # @return [void]
499
+ # @api public
500
+ # : (Symbol name, String | Integer | Time value) -> void
501
+ def app_property: (Symbol name, String | Integer | Time value) -> void
502
+
503
+ # Set multiple core and/or app properties.
504
+ #
505
+ # @param core [Hash, nil] Core properties.
506
+ # @param app [Hash, nil] App properties.
507
+ # @return [void]
508
+ # @api public
509
+ # : (?core: Hash[Symbol, String | Integer | Time]?, ?app: Hash[Symbol, String | Integer | Time]?) -> void
510
+ def properties: (?core: Hash[Symbol, String | Integer | Time]?, ?app: Hash[Symbol, String | Integer | Time]?) -> void
511
+
512
+ # Add a custom document property.
513
+ #
514
+ # @param name [String] The property name.
515
+ # @param value [String, Integer, Float, Boolean, Time] The property value.
516
+ # @param type [Symbol] The type of property (:string, :number, :bool, :date).
517
+ # @return [void]
518
+ # @api public
519
+ # : (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
520
+ def custom_property: (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
521
+
522
+ # Builds and returns the in-memory Elements::Workbook.
523
+ #
524
+ # @return [Elements::Workbook]
525
+ # @api public
526
+ # : () -> Elements::Workbook
527
+ def build: () -> Elements::Workbook
528
+
529
+ private
530
+
531
+ # : (untyped range) -> untyped
532
+ def absolute_range: (untyped range) -> untyped
533
+
534
+ # : (untyped names, untyped sheets) -> untyped
535
+ def resolve_defined_names: (untyped names, untyped sheets) -> untyped
536
+
537
+ # : (untyped sheets) -> (::Array[untyped | ::Hash[untyped, untyped]] | ::Array[untyped])
538
+ def process_styles: (untyped sheets) -> (::Array[untyped | ::Hash[untyped, untyped]] | ::Array[untyped])
539
+
540
+ # : (untyped writer) -> { fonts: untyped, fills: untyped, borders: untyped, xf_entries: untyped, num_fmts: untyped }
541
+ def extract_styles_from_writer: (untyped writer) -> { fonts: untyped, fills: untyped, borders: untyped, xf_entries: untyped, num_fmts: untyped }
542
+ end
543
+
544
+ # DSL context for a single worksheet in Xlsxrb.build.
545
+ # @api public
546
+ class WorksheetBuilder
547
+ # : (untyped name, ?strict_excel_mode: bool) -> void
548
+ def initialize: (untyped name, ?strict_excel_mode: bool) -> void
549
+
550
+ # Define a named style that can be applied to cells.
551
+ #
552
+ # @param name [String] The name of the style.
553
+ # @param opts [Hash] Style options (e.g. bold: true).
554
+ # @yield [style_builder]
555
+ # @yieldparam style_builder [Xlsxrb::StyleBuilder]
556
+ # @return [StyleBuilder]
557
+ # @api public
558
+ # : (String name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
559
+ def style: (String name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
560
+
561
+ # Add a row to the sheet.
562
+ #
563
+ # @param values [Array, Hash] The cell values.
564
+ # @param styles [String, Array<String>, nil] Styles to apply to cells.
565
+ # @param height [Float, nil] The row height.
566
+ # @param hidden [Boolean] Whether the row is hidden.
567
+ # @param custom_height [Boolean] Whether it's a custom height.
568
+ # @param outline_level [Integer, nil] The outline level.
569
+ # @note Excel's column limit is 16,384, row limit is 1,048,576, string max length is 32,767.
570
+ # @return [void]
571
+ # @api public
572
+ # : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
573
+ def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
574
+
575
+ # Add a column or multiple columns to the sheet.
576
+ #
577
+ # @param index [Integer, String, Range, Array] The column index (0-based), letter, or a collection of them.
578
+ # @param width [Float, nil] The column width.
579
+ # @param hidden [Boolean] Whether the column is hidden.
580
+ # @param custom_width [Boolean] Whether it's a custom width.
581
+ # @param outline_level [Integer, nil] The outline level.
582
+ # @note Excel's column width max is 255.
583
+ # @return [void]
584
+ # @api public
585
+ # : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil) -> void
586
+ def column: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil) -> void
587
+
588
+ # Add a chart to the sheet.
589
+ #
590
+ # @param options [Hash] Chart options.
591
+ # @yield [builder]
592
+ # @yieldparam builder [Xlsxrb::ChartBuilder]
593
+ # @return [void]
594
+ # @api public
595
+ # : (**untyped options) ?{ (ChartBuilder) -> void } -> void
596
+ def chart: (**untyped options) ?{ (ChartBuilder) -> void } -> void
597
+
598
+ # Add a hyperlink on a cell.
599
+ #
600
+ # @param cell [String] The cell reference (e.g. "A1").
601
+ # @param url [String, nil] The URL.
602
+ # @param display [String, nil] The display text.
603
+ # @param tooltip [String, nil] The tooltip.
604
+ # @param location [String, nil] The internal location reference.
605
+ # @return [void]
606
+ # @api public
607
+ # : (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
608
+ def hyperlink: (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
609
+
610
+ # Set an auto filter range (e.g. "A1:D10").
611
+ #
612
+ # @param range [String] The filter range.
613
+ # @return [void]
614
+ # @api public
615
+ # : (untyped range) -> untyped
616
+ def auto_filter: (untyped range) -> untyped
617
+
618
+ # Add a filter column to the auto filter.
619
+ #
620
+ # @param col_id [Integer] 0-based column index within the filter range.
621
+ # @param filter [Hash] The filter options.
622
+ # @return [void]
623
+ # @api public
624
+ # : (untyped col_id, untyped filter) -> untyped
625
+ def filter_column: (untyped col_id, untyped filter) -> untyped
626
+
627
+ # Set sort state.
628
+ #
629
+ # @param ref [String] The sort range.
630
+ # @param sort_conditions [Array<Hash>] Sort conditions.
631
+ # @param opts [Hash] Additional options.
632
+ # @return [void]
633
+ # @api public
634
+ # : (untyped ref, untyped sort_conditions, **untyped opts) -> untyped
635
+ def sort_state: (untyped ref, untyped sort_conditions, **untyped opts) -> untyped
636
+
637
+ # Add a data validation rule.
638
+ #
639
+ # @param sqref [String] The cell range (e.g. "A1:A100").
640
+ # @param opts [Hash] Data validation options.
641
+ # @return [void]
642
+ # @api public
643
+ # : (untyped sqref, **untyped opts) -> untyped
644
+ def validate_data: (untyped sqref, **untyped opts) -> untyped
645
+
646
+ # Add a conditional formatting rule.
647
+ #
648
+ # @param sqref [String] The cell range.
649
+ # @param opts [Hash] Conditional format options.
650
+ # @return [void]
651
+ # @api public
652
+ # : (untyped sqref, **untyped opts) -> untyped
653
+ def conditional_format: (untyped sqref, **untyped opts) -> untyped
654
+
655
+ # Add a table to the sheet.
656
+ #
657
+ # @param ref [String] The table range.
658
+ # @param columns [Array<String>] The column names.
659
+ # @param name [String, nil] The table name.
660
+ # @param display_name [String, nil] The display name.
661
+ # @param style [String, nil] The table style.
662
+ # @param opts [Hash] Additional options.
663
+ # @return [void]
664
+ # @api public
665
+ # : (untyped ref, columns: untyped, ?name: untyped?, ?display_name: untyped?, ?style: untyped?, **untyped opts) -> untyped
666
+ def table: (untyped ref, columns: untyped, ?name: untyped?, ?display_name: untyped?, ?style: untyped?, **untyped opts) -> untyped
667
+
668
+ # Add a pivot table to the sheet.
669
+ #
670
+ # @param source_ref [String] data source range (e.g. "Sheet1!A1:C10").
671
+ # @param row_fields [Array<Integer>] array of 0-based field indices for row axis.
672
+ # @param data_fields [Array<Hash>] array of { fld:, name:, subtotal: } hashes.
673
+ # @param col_fields [Array<Integer>] array of 0-based field indices for column axis.
674
+ # @param dest_ref [String] top-left cell for the pivot table (default "E1").
675
+ # @param name [String, nil] Pivot table name.
676
+ # @param field_names [Array<String>, nil] Override field names.
677
+ # @param items [Array, nil] Items configuration.
678
+ # @return [void]
679
+ # @api public
680
+ # : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
681
+ def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
682
+
683
+ # Add a comment on a cell.
684
+ #
685
+ # @param cell [String] The cell reference.
686
+ # @param text [String] The comment text.
687
+ # @param author [String] The author name.
688
+ # @return [void]
689
+ # @api public
690
+ # : (String | Integer cell, String text, ?author: ::String) -> void
691
+ def comment: (String | Integer cell, String text, ?author: ::String) -> void
692
+
693
+ # Add a sparkline group to the sheet.
694
+ #
695
+ # @param sparklines [Array<Hash>] Array of { data_ref:, location_ref: } hashes.
696
+ # @param type [String, nil] "line" (default), "column", or "stacked".
697
+ # @param opts [Hash] Additional options.
698
+ # @return [void]
699
+ # @api public
700
+ # : (sparklines: untyped, ?type: untyped, **untyped opts) -> void
701
+ def sparkline_group: (sparklines: untyped, ?type: untyped, **untyped opts) -> void
702
+
703
+ # Merge a range of cells (e.g. "A1:B2"), or by coordinate indices.
704
+ #
705
+ # @param range [String, nil] The string range.
706
+ # @param row [Integer, nil] Single row index.
707
+ # @param col_start [Integer, nil] Starting column index.
708
+ # @param col_end [Integer, nil] Ending column index.
709
+ # @param row_start [Integer, nil] Starting row index.
710
+ # @param row_end [Integer, nil] Ending row index.
711
+ # @return [void]
712
+ # @api public
713
+ # : (?(String | Hash[Symbol, Integer | String])? range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?) -> void
714
+ def merge: (?(String | Hash[Symbol, Integer | String])? range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?) -> void
715
+
716
+ # Freeze panes at the given row and column.
717
+ #
718
+ # @param row [Integer] The row index to freeze at (0-based).
719
+ # @param col [Integer, String] The column index to freeze at (0-based or letter).
720
+ # @return [void]
721
+ # @api public
722
+ # : (?row: Integer, ?col: (Integer | String)) -> void
723
+ def freeze_pane: (?row: Integer, ?col: Integer | String) -> void
724
+
725
+ # Split panes (non-frozen).
726
+ #
727
+ # @param x_split [Integer] X coordinate.
728
+ # @param y_split [Integer] Y coordinate.
729
+ # @param top_left_cell [String, nil] Top left cell reference.
730
+ # @return [void]
731
+ # @api public
732
+ # : (?x_split: ::Integer, ?y_split: ::Integer, ?top_left_cell: String?) -> void
733
+ def split_pane: (?x_split: ::Integer, ?y_split: ::Integer, ?top_left_cell: String?) -> void
734
+
735
+ # Set active cell selection.
736
+ #
737
+ # @param active_cell [String] The active cell reference.
738
+ # @param sqref [String, nil] The selected range.
739
+ # @param pane [String, nil] The pane to select in.
740
+ # @return [void]
741
+ # @api public
742
+ # : (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
743
+ def select_cell: (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
744
+
745
+ # Set page margins (in inches).
746
+ #
747
+ # @param left [Float, nil] Left margin.
748
+ # @param right [Float, nil] Right margin.
749
+ # @param top [Float, nil] Top margin.
750
+ # @param bottom [Float, nil] Bottom margin.
751
+ # @param header [Float, nil] Header margin.
752
+ # @param footer [Float, nil] Footer margin.
753
+ # @return [void]
754
+ # @api public
755
+ # : (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
756
+ def page_margins: (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
757
+
758
+ # Set page setup properties.
759
+ #
760
+ # @param opts [Hash] Page setup options.
761
+ # @return [void]
762
+ # @api public
763
+ # : (**untyped opts) -> void
764
+ def page_setup: (**untyped opts) -> void
765
+
766
+ # Set header/footer text.
767
+ #
768
+ # @param opts [Hash] Header and footer options.
769
+ # @return [void]
770
+ # @api public
771
+ # : (**untyped opts) -> void
772
+ def header_footer: (**untyped opts) -> void
773
+
774
+ # Set a print option.
775
+ #
776
+ # @param name [Symbol] Option name.
777
+ # @param value [Object] Option value.
778
+ # @return [void]
779
+ # @api public
780
+ # : (Symbol name, untyped value) -> void
781
+ def print_options: (Symbol name, untyped value) -> void
782
+
783
+ # Set sheet protection options.
784
+ #
785
+ # @param opts [Hash] Sheet protection options.
786
+ # @return [void]
787
+ # @api public
788
+ # : (**untyped opts) -> void
789
+ def protect_sheet: (**untyped opts) -> void
790
+
791
+ # Insert an image from raw file data.
792
+ # @api public
793
+ # : (String file_data, ?ext: ::String, ?from_col: ::Integer, ?from_row: ::Integer, ?to_col: ::Integer, ?to_row: ::Integer, **untyped opts) -> void
794
+ def image: (String file_data, ?ext: ::String, ?from_col: ::Integer, ?from_row: ::Integer, ?to_col: ::Integer, ?to_row: ::Integer, **untyped opts) -> void
795
+
796
+ # Add a shape to the sheet.
797
+ # @api public
798
+ # : (**untyped opts) -> void
799
+ def shape: (**untyped opts) -> void
800
+
801
+ # Set a sheet-level property (e.g. :tab_color).
802
+ # @api public
803
+ # : (Symbol name, untyped value) -> void
804
+ def sheet_properties: (Symbol name, untyped value) -> void
805
+
806
+ # Set a sheet view property (e.g. :show_grid_lines, :zoom_scale).
807
+ # @api public
808
+ # : (Symbol name, untyped value) -> void
809
+ def sheet_view: (Symbol name, untyped value) -> void
810
+
811
+ # Add a page break before a row.
812
+ # @api public
813
+ # : (Integer row_num) -> void
814
+ def page_break_row: (Integer row_num) -> void
815
+
816
+ # Add a page break before a column.
817
+ # @api public
818
+ # : (Integer | String col_index) -> void
819
+ def page_break_col: (Integer | String col_index) -> void
820
+
821
+ # Builds and returns the in-memory Elements::Worksheet.
822
+ #
823
+ # @return [Elements::Worksheet]
824
+ # @api public
825
+ # : () -> Elements::Worksheet
826
+ def build: () -> Elements::Worksheet
827
+
828
+ # Internal: returns styles for later processing by WorkbookBuilder
829
+ # : untyped
830
+ attr_reader styles: untyped
831
+ end
832
+
833
+ # DSL context for Xlsxrb.generate streaming writes.
834
+ # @api public
835
+ class StreamWriter
836
+ attr_reader current_sheet: untyped
837
+
838
+ # : (untyped target, ?strict_excel_mode: bool) -> void
839
+ def initialize: (untyped target, ?strict_excel_mode: bool) -> void
840
+
841
+ # Set a workbook property.
842
+ #
843
+ # @note **SECURITY WARNING:** If you set `:update_links` to anything other than `"never"`,
844
+ # you may expose end-users to malicious external reference vulnerabilities (e.g., CSV/DDE Injection)
845
+ # when they open the generated Excel file. Ensure you fully trust the exported data.
846
+ #
847
+ # @param name [Symbol] The property name (e.g. :update_links).
848
+ # @param value [String, Integer, Boolean] The property value.
849
+ # @return [void]
850
+ # : (Symbol name, String | Integer | bool value) -> void
851
+ def workbook_property: (Symbol name, String | Integer | bool value) -> void
852
+
853
+ # Define a named style that can be applied to cells.
854
+ #
855
+ # @param name [String] The name of the style.
856
+ # @param opts [Hash] Style options (e.g. bold: true).
857
+ # @yield [style_builder]
858
+ # @yieldparam style_builder [Xlsxrb::StyleBuilder]
859
+ # @return [StyleBuilder]
860
+ # : (String name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
861
+ def style: (String name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
862
+
863
+ # Proxy object yielded by the `sheet` method to prevent writing to inactive sheets.
864
+ # @api public
865
+ class WorksheetProxy
866
+ def initialize: (untyped writer, untyped sheet_name) -> untyped
867
+
868
+ # Define or configure a named cell style.
869
+ #
870
+ # @example
871
+ # s.style(:header, bold: true, fill_color: "4F81BD", font_color: "FFFFFF")
872
+ #
873
+ # @param name [String, Symbol] The name of the style.
874
+ # @param opts [Hash] Style options (e.g. bold: true, fill_color: "FF0000").
875
+ # @yield [style_builder]
876
+ # @yieldparam style_builder [Xlsxrb::StyleBuilder]
877
+ # @return [Xlsxrb::StyleBuilder]
878
+ # @api public
879
+ # : (String | Symbol name, **untyped opts) ?{ (Xlsxrb::StyleBuilder) -> void } -> Xlsxrb::StyleBuilder
880
+ def style: (String | Symbol name, **untyped opts) ?{ (Xlsxrb::StyleBuilder) -> void } -> Xlsxrb::StyleBuilder
881
+
882
+ # Merge a range of cells.
883
+ #
884
+ # @example Merge with cell reference string
885
+ # s.merge("A1:C1")
886
+ #
887
+ # @example Merge with coordinates
888
+ # s.merge(row: 0, col_start: 0, col_end: 2)
889
+ #
890
+ # @param range [String, nil] The cell range (e.g. "A1:B2").
891
+ # @param row [Integer, nil] 0-based row index.
892
+ # @param col_start [Integer, String, nil] 0-based start column index or letter.
893
+ # @param col_end [Integer, String, nil] 0-based end column index or letter.
894
+ # @param row_start [Integer, nil] 0-based start row index.
895
+ # @param row_end [Integer, nil] 0-based end row index.
896
+ # @return [void]
897
+ # @api public
898
+ # : (?String? range, ?row: Integer | nil, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer | nil, ?row_end: Integer | nil) -> void
899
+ def merge: (?String? range, ?row: Integer | nil, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer | nil, ?row_end: Integer | nil) -> void
900
+
901
+ # Add a drawing shape to the sheet.
902
+ #
903
+ # @example
904
+ # s.shape(preset: "ellipse", text: "Circle", from_col: 1, from_row: 1, to_col: 4, to_row: 5)
905
+ #
906
+ # @param preset [String] Preset shape type (e.g. "rect", "ellipse").
907
+ # @param text [String, nil] Shape label text.
908
+ # @param from_col [Integer] Starting column index (0-based).
909
+ # @param from_row [Integer] Starting row index (0-based).
910
+ # @param to_col [Integer] Ending column index (0-based).
911
+ # @param to_row [Integer] Ending row index (0-based).
912
+ # @param opts [Hash] Additional shape formatting options.
913
+ # @return [void]
914
+ # @api public
915
+ # : (?preset: String, ?text: String?, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
916
+ def shape: (?preset: String, ?text: String?, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
917
+
918
+ # simplecov:disable
919
+ # Edge case / untested delegation block
920
+ # : (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
921
+ def internal_sheet_setup: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
922
+
923
+ # Add a row to the active sheet.
924
+ #
925
+ # @example Write an array of values
926
+ # s.row(["Name", "Age", "City"])
927
+ #
928
+ # @example Write with explicit column keys and styles
929
+ # s.row({ A: "Header", C: 100 }, styles: { A: :bold })
930
+ #
931
+ # @param values [Array, Hash] The cell values (e.g. `[1, 2, 3]` or `{ A: 1, C: 3 }`).
932
+ # @param styles [String, Symbol, Array, Hash, nil] Style names or hashes to apply.
933
+ # @param height [Float, Integer, nil] The row height in points (0 - 409).
934
+ # @param hidden [Boolean] Whether the row is hidden.
935
+ # @param custom_height [Boolean] Whether to flag as custom height.
936
+ # @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
937
+ # @return [void]
938
+ # @api public
939
+ # : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
940
+ def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
941
+
942
+ # Configure column width and properties.
943
+ #
944
+ # @example Set column A width
945
+ # s.column(0, width: 25.0)
946
+ #
947
+ # @param col_index [Integer, String, Symbol] 0-based column index or letter (e.g. 0 or "A" or :A).
948
+ # @param width [Float, Integer, nil] Column width in characters.
949
+ # @param hidden [Boolean] Whether the column is hidden.
950
+ # @param best_fit [Boolean] Whether the column automatically fits content.
951
+ # @param custom_width [Boolean] Whether to flag as custom width.
952
+ # @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
953
+ # @param collapsed [Boolean] Whether the outline group is collapsed.
954
+ # @return [void]
955
+ # @api public
956
+ # : (Integer | String | Symbol col_index, ?width: Float | Integer | nil, ?hidden: bool, ?best_fit: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool) -> void
957
+ def column: (Integer | String | Symbol col_index, ?width: Float | Integer | nil, ?hidden: bool, ?best_fit: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool) -> void
958
+
959
+ # Add a chart to the sheet.
960
+ #
961
+ # @example
962
+ # s.chart(:bar) do |chart_builder|
963
+ # chart_builder.title("Quarterly Sales")
964
+ # chart_builder.series(values: "Sheet1!$B$2:$B$5", categories: "Sheet1!$A$2:$A$5", name: "Revenue")
965
+ # end
966
+ #
967
+ # @param type [Symbol, String, nil] The chart type (:bar, :col, :line, :pie, :scatter, :area, :doughnut, :radar).
968
+ # @param opts [Hash] Additional chart options.
969
+ # @yield [chart_builder]
970
+ # @yieldparam chart_builder [Xlsxrb::ChartBuilder]
971
+ # @return [void]
972
+ # @api public
973
+ # : (?Symbol | String? type, **untyped opts) ?{ (Xlsxrb::ChartBuilder) -> void } -> void
974
+ def chart: (?Symbol | String? type, **untyped opts) ?{ (Xlsxrb::ChartBuilder) -> void } -> void
975
+
976
+ # Add a hyperlink to a cell.
977
+ #
978
+ # @example Positional URL
979
+ # s.hyperlink("A1", "https://example.com", display: "Example")
980
+ #
981
+ # @example Keyword location
982
+ # s.hyperlink("A1", location: "https://example.com", tooltip: "Go to Example")
983
+ #
984
+ # @param cell [String] The cell reference (e.g. "A1").
985
+ # @param url [String, nil] The target URL or URI.
986
+ # @param display [String, nil] Display text for the link.
987
+ # @param tooltip [String, nil] Tooltip text when hovering.
988
+ # @param location [String, nil] Destination location / URL (keyword alternative).
989
+ # @return [void]
990
+ # @api public
991
+ # : (String cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
992
+ def hyperlink: (String cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
993
+
994
+ # Set the auto-filter range on the sheet.
995
+ #
996
+ # @example
997
+ # s.auto_filter("A1:D100")
998
+ #
999
+ # @param ref [String] The cell range (e.g. "A1:D10").
1000
+ # @return [void]
1001
+ # @api public
1002
+ # : (String ref) -> void
1003
+ def auto_filter: (String ref) -> void
1004
+
1005
+ # Set filter criteria for a column in the auto-filter.
1006
+ #
1007
+ # @example Simple values filter
1008
+ # s.filter_column(0, ["Active", "Pending"])
1009
+ #
1010
+ # @example Custom filter specification
1011
+ # s.filter_column(0, { type: :filters, values: ["Data"] })
1012
+ #
1013
+ # @param col_id [Integer] 0-based column index relative to auto-filter range.
1014
+ # @param filter_values [Array<String>, Hash] Values or filter specification hash.
1015
+ # @return [void]
1016
+ # @api public
1017
+ # : (Integer col_id, Array[String] | Hash[Symbol, untyped] filter_values) -> void
1018
+ def filter_column: (Integer col_id, Array[String] | Hash[Symbol, untyped] filter_values) -> void
1019
+
1020
+ # Configure sort state on a range.
1021
+ #
1022
+ # @example
1023
+ # s.sort_state("A1:A10", [{ ref: "A1:A10", descending: true }])
1024
+ #
1025
+ # @param ref [String] The range to sort.
1026
+ # @param sort_conditions [Array<Hash>, Hash] Sort conditions array or options hash.
1027
+ # @param opts [Hash] Additional sort options.
1028
+ # @return [void]
1029
+ # @api public
1030
+ # : (String ref, Array[Hash[Symbol, untyped]] | Hash[Symbol, untyped] sort_conditions, **untyped opts) -> void
1031
+ def sort_state: (String ref, Array[Hash[Symbol, untyped]] | Hash[Symbol, untyped] sort_conditions, **untyped opts) -> void
1032
+
1033
+ # Add data validation rules to a range.
1034
+ #
1035
+ # @example Dropdown list validation
1036
+ # s.validate_data("B2:B100", type: "list", formula1: '"High,Medium,Low"')
1037
+ #
1038
+ # @example Integer range validation
1039
+ # s.validate_data("C2:C100", type: "whole", operator: "between", formula1: 1, formula2: 100)
1040
+ #
1041
+ # @param range [String] The cell range (e.g. "B2:B10").
1042
+ # @param type [String, Symbol] Validation type ("list", "whole", "decimal", "date", "time", "textLength", "custom").
1043
+ # @param opts [Hash] Validation options.
1044
+ # @return [void]
1045
+ # @api public
1046
+ # : (String range, ?type: String | Symbol, **untyped opts) -> void
1047
+ def validate_data: (String range, ?type: String | Symbol, **untyped opts) -> void
1048
+
1049
+ # Add conditional formatting to a range.
1050
+ #
1051
+ # @example Highlight values greater than 100
1052
+ # s.conditional_format("A1:A10", type: "cellIs", operator: "greaterThan", formula: 100, style: :highlight)
1053
+ #
1054
+ # @param range [String] The cell range (e.g. "A1:A10").
1055
+ # @param type [String, Symbol] Rule type ("cellIs", "colorScale", "dataBar", "expression").
1056
+ # @param opts [Hash] Rule options.
1057
+ # @return [void]
1058
+ # @api public
1059
+ # : (String range, ?type: String | Symbol, **untyped opts) -> void
1060
+ def conditional_format: (String range, ?type: String | Symbol, **untyped opts) -> void
1061
+
1062
+ # Add a formatted Excel Table to the sheet.
1063
+ #
1064
+ # @example
1065
+ # s.table("A1:C10", columns: ["ID", "Name", "Total"], name: "SalesTable", style: "TableStyleMedium9")
1066
+ #
1067
+ # @param ref [String] The cell range for the table (e.g. "A1:D10").
1068
+ # @param columns [Array<String>, Array<Hash>] Column names or definitions.
1069
+ # @param name [String, nil] Table name.
1070
+ # @param display_name [String, nil] Display name.
1071
+ # @param style [String, nil] Table style name.
1072
+ # @param opts [Hash] Additional options.
1073
+ # @return [void]
1074
+ # @api public
1075
+ # : (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
1076
+ def table: (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
1077
+
1078
+ # simplecov:disable
1079
+ # Edge case / untested delegation block
1080
+ # : () -> void
1081
+ def cleanup!: () -> void
1082
+
1083
+ # Add a comment to a cell.
1084
+ #
1085
+ # @example
1086
+ # s.comment("A1", "Reviewed and approved", author: "Auditor")
1087
+ #
1088
+ # @param cell [String, Integer] The cell reference (e.g. "A1").
1089
+ # @param text [String] The comment text.
1090
+ # @param author [String] The author name.
1091
+ # @return [void]
1092
+ # @api public
1093
+ # : (String | Integer cell, String text, ?author: String) -> void
1094
+ def comment: (String | Integer cell, String text, ?author: String) -> void
1095
+
1096
+ # Add a Pivot Table to the sheet.
1097
+ #
1098
+ # @example
1099
+ # s.pivot_table("Sheet1!A1:D100", row_fields: ["Category"], data_fields: ["Amount"], dest_ref: "F1")
1100
+ #
1101
+ # @param source_ref [String] Source data range reference (e.g. "Sheet1!A1:D100").
1102
+ # @param row_fields [Array<String>] Field names for rows.
1103
+ # @param data_fields [Array<String>] Field names for data values.
1104
+ # @param col_fields [Array<String>] Field names for columns.
1105
+ # @param dest_ref [String] Target top-left cell reference (default: "E1").
1106
+ # @param name [String, nil] Pivot table name.
1107
+ # @param field_names [Array<String>, nil] Override field names.
1108
+ # @param items [Array, nil] Items configuration.
1109
+ # @param opts [Hash] Additional options.
1110
+ # @return [void]
1111
+ # @api public
1112
+ # : (String source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: String, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
1113
+ def pivot_table: (String source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: String, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
1114
+
1115
+ # Add sparklines to the sheet.
1116
+ #
1117
+ # @example
1118
+ # s.sparkline_group(sparklines: [{ data_ref: "A1:E1", location_ref: "F1" }], type: "line")
1119
+ #
1120
+ # @param sparklines [Array<Hash>] Array of { data_ref:, location_ref: } hashes.
1121
+ # @param type [String, nil] "line" (default), "column", or "stacked".
1122
+ # @param opts [Hash] Additional sparkline options.
1123
+ # @return [void]
1124
+ # @api public
1125
+ # : (sparklines: Array[Hash[Symbol, untyped]], ?type: String?, **untyped opts) -> void
1126
+ def sparkline_group: (sparklines: Array[Hash[Symbol, untyped]], ?type: String?, **untyped opts) -> void
1127
+
1128
+ # Set workbook-level properties.
1129
+ #
1130
+ # @param opts [Hash] Workbook property options.
1131
+ # @return [void]
1132
+ # @api public
1133
+ # : (**untyped opts) -> void
1134
+ def workbook_property: (**untyped opts) -> void
1135
+
1136
+ # Set sheet properties (e.g. tab color, page setup flags).
1137
+ #
1138
+ # @example
1139
+ # s.sheet_properties(:tab_color, "FF0000")
1140
+ #
1141
+ # @param name [Symbol, String] Property name.
1142
+ # @param value [Object] Property value.
1143
+ # @return [void]
1144
+ # @api public
1145
+ # : (Symbol | String name, untyped value) -> void
1146
+ def sheet_properties: (Symbol | String name, untyped value) -> void
1147
+
1148
+ # Add a defined named range or formula.
1149
+ #
1150
+ # @example
1151
+ # s.defined_name("TaxRate", "0.10")
1152
+ #
1153
+ # @param name [String] The name.
1154
+ # @param formula [String] The formula or range expression.
1155
+ # @param sheet_id [Integer, nil] Optional sheet scope.
1156
+ # @param hidden [Boolean] Whether the name is hidden.
1157
+ # @return [void]
1158
+ # @api public
1159
+ # : (String name, String formula, ?sheet_id: Integer | nil, ?hidden: bool) -> void
1160
+ def defined_name: (String name, String formula, ?sheet_id: Integer | nil, ?hidden: bool) -> void
1161
+
1162
+ # Freeze rows and/or columns for scrolling.
1163
+ #
1164
+ # @example Freeze top row
1165
+ # s.freeze_pane(row: 1)
1166
+ #
1167
+ # @example Freeze first column and top 2 rows
1168
+ # s.freeze_pane(row: 2, col: 1)
1169
+ #
1170
+ # @param row [Integer, nil] Number of rows to freeze.
1171
+ # @param col [Integer, nil] Number of columns to freeze.
1172
+ # @return [void]
1173
+ # @api public
1174
+ # : (?row: Integer | nil, ?col: Integer | nil) -> void
1175
+ def freeze_pane: (?row: Integer | nil, ?col: Integer | nil) -> void
1176
+
1177
+ # simplecov:disable
1178
+ # Edge case / untested delegation block
1179
+ # Set the print area range for the sheet.
1180
+ #
1181
+ # @example
1182
+ # s.print_area("A1:G50")
1183
+ #
1184
+ # @param ref [String] Range reference.
1185
+ # @return [void]
1186
+ # @api public
1187
+ # : (String ref) -> void
1188
+ def print_area: (String ref) -> void
1189
+
1190
+ # simplecov:disable
1191
+ # Edge case / untested delegation block
1192
+ # Configure repeating title rows and columns for printing.
1193
+ #
1194
+ # @example Repeat top 2 rows on every page
1195
+ # s.print_titles(rows: "1:2")
1196
+ #
1197
+ # @param rows [String, nil] Row range to repeat (e.g. "1:2").
1198
+ # @param cols [String, nil] Column range to repeat (e.g. "A:B").
1199
+ # @return [void]
1200
+ # @api public
1201
+ # : (?rows: String?, ?cols: String?) -> void
1202
+ def print_titles: (?rows: String?, ?cols: String?) -> void
1203
+
1204
+ # Split sheet view into panes.
1205
+ #
1206
+ # @param x_split [Numeric, nil] Horizontal split position.
1207
+ # @param y_split [Numeric, nil] Vertical split position.
1208
+ # @param top_left_cell [String, nil] Top-left visible cell in bottom-right pane.
1209
+ # @param active_pane [String, nil] Active pane identifier.
1210
+ # @param state [String, nil] Split state.
1211
+ # @return [void]
1212
+ # @api public
1213
+ # : (?x_split: Numeric | nil, ?y_split: Numeric | nil, ?top_left_cell: String?, ?active_pane: String?, ?state: String?) -> void
1214
+ def split_pane: (?x_split: Numeric | nil, ?y_split: Numeric | nil, ?top_left_cell: String?, ?active_pane: String?, ?state: String?) -> void
1215
+
1216
+ # simplecov:disable
1217
+ # Edge case / untested delegation block
1218
+ # Protect the workbook structure.
1219
+ #
1220
+ # @param opts [Hash] Protection options.
1221
+ # @return [void]
1222
+ # @api public
1223
+ # : (**untyped opts) -> void
1224
+ def protect_workbook: (**untyped opts) -> void
1225
+
1226
+ # simplecov:disable
1227
+ # Edge case / untested delegation block
1228
+ # Set core metadata property.
1229
+ #
1230
+ # @param name [String, Symbol] Property name.
1231
+ # @param value [Object] Property value.
1232
+ # @return [void]
1233
+ # @api public
1234
+ # : (String | Symbol name, untyped value) -> void
1235
+ def core_property: (String | Symbol name, untyped value) -> void
1236
+
1237
+ # Set the active/selected cell on the sheet.
1238
+ #
1239
+ # @example
1240
+ # s.select_cell("B5")
1241
+ # s.select_cell("A1", sqref: "A1:A2", pane: "topRight")
1242
+ #
1243
+ # @param active_cell [String] Cell reference (e.g. "A1").
1244
+ # @param sqref [String, nil] Selection range.
1245
+ # @param pane [String, Symbol, nil] Pane identifier.
1246
+ # @return [void]
1247
+ # @api public
1248
+ # : (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
1249
+ def select_cell: (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
1250
+
1251
+ # Configure page margins for printing.
1252
+ #
1253
+ # @example
1254
+ # s.page_margins(left: 0.7, right: 0.7, top: 0.75, bottom: 0.75)
1255
+ #
1256
+ # @param left [Float, nil] Left margin in inches.
1257
+ # @param right [Float, nil] Right margin in inches.
1258
+ # @param top [Float, nil] Top margin in inches.
1259
+ # @param bottom [Float, nil] Bottom margin in inches.
1260
+ # @param header [Float, nil] Header margin in inches.
1261
+ # @param footer [Float, nil] Footer margin in inches.
1262
+ # @return [void]
1263
+ # @api public
1264
+ # : (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
1265
+ def page_margins: (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
1266
+
1267
+ # Configure page orientation, paper size, and print setup.
1268
+ #
1269
+ # @example Landscape A4
1270
+ # s.page_setup(orientation: "landscape", paper_size: 9)
1271
+ #
1272
+ # @param orientation [String, Symbol, nil] "portrait" or "landscape" (or :portrait, :landscape).
1273
+ # @param paper_size [Integer, nil] Paper size index (e.g. 9 for A4, 1 for Letter).
1274
+ # @param opts [Hash] Additional options (scale, fit_to_width, fit_to_height).
1275
+ # @return [void]
1276
+ # @api public
1277
+ # : (?orientation: (String | Symbol)?, ?paper_size: Integer | nil, **untyped opts) -> void
1278
+ def page_setup: (?orientation: (String | Symbol)?, ?paper_size: Integer | nil, **untyped opts) -> void
1279
+
1280
+ # Configure header and footer text for printing.
1281
+ #
1282
+ # @example
1283
+ # s.header_footer(odd_header: "&CConfidential", odd_footer: "&RPage &P of &N")
1284
+ #
1285
+ # @param opts [Hash] Header and footer specifications.
1286
+ # @return [void]
1287
+ # @api public
1288
+ # : (**untyped opts) -> void
1289
+ def header_footer: (**untyped opts) -> void
1290
+
1291
+ # Configure print options (e.g. gridlines, headings).
1292
+ #
1293
+ # @example
1294
+ # s.print_options(:grid_lines, true)
1295
+ #
1296
+ # @param name [Symbol, String] Print option name.
1297
+ # @param value [Object] Print option value.
1298
+ # @return [void]
1299
+ # @api public
1300
+ # : (Symbol | String name, untyped value) -> void
1301
+ def print_options: (Symbol | String name, untyped value) -> void
1302
+
1303
+ # simplecov:disable
1304
+ # Edge case / untested delegation block
1305
+ # Set document metadata properties (core, app, custom).
1306
+ #
1307
+ # @example
1308
+ # s.properties(core: { title: "Report", creator: "App" })
1309
+ #
1310
+ # @param core [Hash, nil] Core properties (title, creator, subject, etc.).
1311
+ # @param app [Hash, nil] App properties (company, manager).
1312
+ # @param custom [Hash, nil] Custom properties.
1313
+ # @return [void]
1314
+ # @api public
1315
+ # : (?core: Hash[untyped, untyped]?, ?app: Hash[untyped, untyped]?, ?custom: Hash[untyped, untyped]?) -> void
1316
+ def properties: (?core: Hash[untyped, untyped]?, ?app: Hash[untyped, untyped]?, ?custom: Hash[untyped, untyped]?) -> void
1317
+
1318
+ # simplecov:disable
1319
+ # Edge case / untested delegation block
1320
+ # Set app metadata property.
1321
+ #
1322
+ # @param name [String, Symbol] Property name.
1323
+ # @param value [Object] Property value.
1324
+ # @return [void]
1325
+ # @api public
1326
+ # : (String | Symbol name, untyped value) -> void
1327
+ def app_property: (String | Symbol name, untyped value) -> void
1328
+
1329
+ # Protect the worksheet against modifications.
1330
+ #
1331
+ # @example
1332
+ # s.protect_sheet(password: "secret", select_locked_cells: true)
1333
+ #
1334
+ # @param opts [Hash] Protection options.
1335
+ # @return [void]
1336
+ # @api public
1337
+ # : (**untyped opts) -> void
1338
+ def protect_sheet: (**untyped opts) -> void
1339
+
1340
+ # simplecov:disable
1341
+ # Edge case / untested delegation block
1342
+ # Set custom metadata property.
1343
+ #
1344
+ # @param name [String, Symbol] Property name.
1345
+ # @param value [Object] Property value.
1346
+ # @return [void]
1347
+ # @api public
1348
+ # : (String | Symbol name, untyped value) -> void
1349
+ def custom_property: (String | Symbol name, untyped value) -> void
1350
+
1351
+ # Insert an image into the sheet.
1352
+ #
1353
+ # @example
1354
+ # s.image(File.read("logo.png"), ext: "png", from_col: 0, from_row: 0, to_col: 2, to_row: 3)
1355
+ #
1356
+ # @param file_data [String] Binary image data or file content.
1357
+ # @param ext [String] Image extension ("png", "jpeg", etc.).
1358
+ # @param from_col [Integer] Starting column index (0-based).
1359
+ # @param from_row [Integer] Starting row index (0-based).
1360
+ # @param to_col [Integer] Ending column index (0-based).
1361
+ # @param to_row [Integer] Ending row index (0-based).
1362
+ # @param opts [Hash] Additional anchor and sizing options.
1363
+ # @return [void]
1364
+ # @api public
1365
+ # : (String file_data, ?ext: String, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
1366
+ def image: (String file_data, ?ext: String, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
1367
+
1368
+ # Configure sheet view settings (zoom scale, grid lines visibility).
1369
+ #
1370
+ # @example
1371
+ # s.sheet_view(:show_grid_lines, false)
1372
+ # s.sheet_view(:zoom_scale, 120)
1373
+ #
1374
+ # @param name [Symbol, String] View setting name.
1375
+ # @param value [Object] View setting value.
1376
+ # @return [void]
1377
+ # @api public
1378
+ # : (Symbol | String name, untyped value) -> void
1379
+ def sheet_view: (Symbol | String name, untyped value) -> void
1380
+
1381
+ # simplecov:disable
1382
+ # Edge case / untested delegation block
1383
+ # Add a horizontal page break after the given row index.
1384
+ #
1385
+ # @example
1386
+ # s.page_break_row(25)
1387
+ #
1388
+ # @param row_index [Integer] 0-based row index.
1389
+ # @return [void]
1390
+ # @api public
1391
+ # : (Integer row_index) -> void
1392
+ def page_break_row: (Integer row_index) -> void
1393
+
1394
+ # simplecov:disable
1395
+ # Edge case / untested delegation block
1396
+ # Add a vertical page break after the given column index.
1397
+ #
1398
+ # @example
1399
+ # s.page_break_col(5)
1400
+ #
1401
+ # @param col_index [Integer] 0-based column index.
1402
+ # @return [void]
1403
+ # @api public
1404
+ # : (Integer col_index) -> void
1405
+ def page_break_col: (Integer col_index) -> void
1406
+ end
1407
+
1408
+ # Add a new sheet.
1409
+ #
1410
+ # @param name [String, nil] The name of the sheet.
1411
+ # @param opts [Hash] Sheet properties.
1412
+ # @yield [sheet_builder]
1413
+ # @yieldparam sheet_builder [Xlsxrb::WorksheetBuilder]
1414
+ # @return [void]
1415
+ # : (?String? name, **untyped opts) ?{ (WorksheetProxy) -> void } -> untyped
1416
+ def sheet: (?String? name, **untyped opts) ?{ (WorksheetProxy) -> void } -> untyped
1417
+
1418
+ # Internal: Start or switch to a named sheet (internal helper).
1419
+ # : (?String? name) ?{ (WorksheetProxy) -> void } -> (WorksheetProxy | nil)
1420
+ def internal_sheet_setup: (?String? name) ?{ (WorksheetProxy) -> void } -> (WorksheetProxy | nil)
1421
+
1422
+ # Add a row of values. values is an Array.
1423
+ # styles:: Hash mapping column indices to style names, or Array of style names for each column
1424
+ # Add a row to the sheet.
1425
+ #
1426
+ # @param values [Array, Hash] The cell values.
1427
+ # @param styles [String, Array<String>, nil] Styles to apply to cells.
1428
+ # @param height [Float, nil] The row height.
1429
+ # @param hidden [Boolean] Whether the row is hidden.
1430
+ # @param custom_height [Boolean] Whether it's a custom height.
1431
+ # @param outline_level [Integer, nil] The outline level.
1432
+ # @note Excel's column limit is 16,384, row limit is 1,048,576, string max length is 32,767.
1433
+ # @return [void]
1434
+ # : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
1435
+ def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
1436
+
1437
+ # Set column width for a 0-based column index.
1438
+ # Add a column to the sheet.
1439
+ #
1440
+ # @param index [Integer, String] The column index (0-based) or letter.
1441
+ # @param width [Float, nil] The column width.
1442
+ # @param hidden [Boolean] Whether the column is hidden.
1443
+ # @param custom_width [Boolean] Whether it's a custom width.
1444
+ # @param outline_level [Integer, nil] The outline level.
1445
+ # @note Excel's column width max is 255.
1446
+ # @return [void]
1447
+ # : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil) -> void
1448
+ def column: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil) -> void
1449
+
1450
+ # Add a chart to the current sheet.
1451
+ # : (**untyped options) ?{ (ChartBuilder) -> void } -> void
1452
+ def chart: (**untyped options) ?{ (ChartBuilder) -> void } -> void
1453
+
1454
+ # --- Hyperlinks ---
1455
+ # : (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
1456
+ def hyperlink: (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
1457
+
1458
+ # --- Auto Filter / Sort ---
1459
+ # : (String range) -> void
1460
+ def auto_filter: (String range) -> void
1461
+
1462
+ # : (untyped col_id, untyped filter) -> untyped
1463
+ def filter_column: (untyped col_id, untyped filter) -> untyped
1464
+
1465
+ # : (untyped ref, untyped sort_conditions, **untyped opts) -> untyped
1466
+ def sort_state: (untyped ref, untyped sort_conditions, **untyped opts) -> untyped
1467
+
1468
+ # --- Data Validation ---
1469
+ # : (untyped sqref, **untyped opts) -> void
1470
+ def validate_data: (untyped sqref, **untyped opts) -> void
1471
+
1472
+ # --- Conditional Formatting ---
1473
+ # : (untyped sqref, **untyped opts) -> void
1474
+ def conditional_format: (untyped sqref, **untyped opts) -> void
1475
+
1476
+ # --- Tables ---
1477
+ # : (untyped ref, columns: untyped, ?name: untyped, ?display_name: untyped, ?style: untyped, **untyped opts) -> void
1478
+ def table: (untyped ref, columns: untyped, ?name: untyped, ?display_name: untyped, ?style: untyped, **untyped opts) -> void
1479
+
1480
+ # --- Pivot Tables ---
1481
+ # : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
1482
+ def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
1483
+
1484
+ # --- Comments ---
1485
+ # : (String | Integer cell, String text, ?author: ::String) -> void
1486
+ def comment: (String | Integer cell, String text, ?author: ::String) -> void
1487
+
1488
+ # --- Sparklines ---
1489
+ # : (sparklines: untyped, ?type: untyped, **untyped opts) -> void
1490
+ def sparkline_group: (sparklines: untyped, ?type: untyped, **untyped opts) -> void
1491
+
1492
+ # Merge a range of cells (e.g. "A1:B2"), or by coordinate indices.
1493
+ #
1494
+ # @param range [String, nil] The string range.
1495
+ # @param row [Integer, nil] Single row index.
1496
+ # @param col_start [Integer, nil] Starting column index.
1497
+ # @param col_end [Integer, nil] Ending column index.
1498
+ # @param row_start [Integer, nil] Starting row index.
1499
+ # @param row_end [Integer, nil] Ending row index.
1500
+ # @return [void]
1501
+ # : (?(String | Hash[Symbol, Integer | String])? range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?) -> void
1502
+ def merge: (?(String | Hash[Symbol, Integer | String])? range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?) -> void
1503
+
1504
+ # Freeze panes at the given row and column.
1505
+ #
1506
+ # @param row [Integer] The row index to freeze at (0-based).
1507
+ # @param col [Integer, String] The column index to freeze at (0-based or letter).
1508
+ # @return [void]
1509
+ # : (?row: Integer, ?col: (Integer | String)) -> void
1510
+ def freeze_pane: (?row: Integer, ?col: Integer | String) -> void
1511
+
1512
+ # : (?x_split: ::Integer, ?y_split: ::Integer, ?top_left_cell: String?) -> void
1513
+ def split_pane: (?x_split: ::Integer, ?y_split: ::Integer, ?top_left_cell: String?) -> void
1514
+
1515
+ # : (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
1516
+ def select_cell: (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
1517
+
1518
+ # --- Page Setup / Margins / Print ---
1519
+ # : (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
1520
+ def page_margins: (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
1521
+
1522
+ # : (**untyped opts) -> void
1523
+ def page_setup: (**untyped opts) -> void
1524
+
1525
+ # : (**untyped opts) -> void
1526
+ def header_footer: (**untyped opts) -> void
1527
+
1528
+ # : (Symbol name, untyped value) -> void
1529
+ def print_options: (Symbol name, untyped value) -> void
1530
+
1531
+ # --- Sheet Protection ---
1532
+ # : (**untyped opts) -> void
1533
+ def protect_sheet: (**untyped opts) -> void
1534
+
1535
+ # --- Images ---
1536
+ # : (String file_data, ?ext: ::String, ?from_col: ::Integer, ?from_row: ::Integer, ?to_col: ::Integer, ?to_row: ::Integer, **untyped opts) -> void
1537
+ def image: (String file_data, ?ext: ::String, ?from_col: ::Integer, ?from_row: ::Integer, ?to_col: ::Integer, ?to_row: ::Integer, **untyped opts) -> void
1538
+
1539
+ # --- Shapes ---
1540
+ # : (**untyped opts) -> void
1541
+ def shape: (**untyped opts) -> void
1542
+
1543
+ # --- Sheet Properties ---
1544
+ # : (Symbol name, untyped value) -> void
1545
+ def sheet_properties: (Symbol name, untyped value) -> void
1546
+
1547
+ # : (Symbol name, untyped value) -> void
1548
+ def sheet_view: (Symbol name, untyped value) -> void
1549
+
1550
+ # --- Row / Column Breaks ---
1551
+ # : (Integer row_num) -> void
1552
+ def page_break_row: (Integer row_num) -> void
1553
+
1554
+ # : (Integer col_index) -> void
1555
+ def page_break_col: (Integer col_index) -> void
1556
+
1557
+ # Add a defined name.
1558
+ #
1559
+ # @param name [String] The defined name.
1560
+ # @param value [String] The formula or value.
1561
+ # @param sheet [String, nil] Local sheet name.
1562
+ # @param hidden [Boolean] Whether the defined name is hidden.
1563
+ # @return [void]
1564
+ # : (String name, String value, ?sheet: String?, ?hidden: bool) -> void
1565
+ def defined_name: (String name, String value, ?sheet: String?, ?hidden: bool) -> void
1566
+
1567
+ # Set the print area for the current or named sheet.
1568
+ # : (String range, ?sheet: String?) -> void
1569
+ def print_area: (String range, ?sheet: String?) -> void
1570
+
1571
+ # Set print titles for the current or named sheet.
1572
+ # : (?rows: String?, ?cols: String?, ?sheet: String?) -> void
1573
+ def print_titles: (?rows: String?, ?cols: String?, ?sheet: String?) -> void
1574
+
1575
+ # Set workbook protection.
1576
+ #
1577
+ # @param opts [Hash] Protection options.
1578
+ # @return [void]
1579
+ # : (**String | Integer | bool | nil opts) -> void
1580
+ def protect_workbook: (**String | Integer | bool | nil opts) -> void
1581
+
1582
+ # Set a core document property.
1583
+ #
1584
+ # @param name [Symbol] The property name.
1585
+ # @param value [String, Integer, Time] The property value.
1586
+ # @return [void]
1587
+ # : (Symbol name, String | Integer | Time value) -> void
1588
+ def core_property: (Symbol name, String | Integer | Time value) -> void
1589
+
1590
+ # Set an app document property.
1591
+ #
1592
+ # @param name [Symbol] The property name.
1593
+ # @param value [String, Integer, Time] The property value.
1594
+ # @return [void]
1595
+ # : (Symbol name, String | Integer | Time value) -> void
1596
+ def app_property: (Symbol name, String | Integer | Time value) -> void
1597
+
1598
+ # Set multiple core and/or app properties.
1599
+ #
1600
+ # @param core [Hash, nil] Core properties.
1601
+ # @param app [Hash, nil] App properties.
1602
+ # @return [void]
1603
+ # : (?core: Hash[Symbol, String | Integer | Time]?, ?app: Hash[Symbol, String | Integer | Time]?) -> void
1604
+ def properties: (?core: Hash[Symbol, String | Integer | Time]?, ?app: Hash[Symbol, String | Integer | Time]?) -> void
1605
+
1606
+ # Add a custom document property.
1607
+ #
1608
+ # @param name [String] The property name.
1609
+ # @param value [String, Integer, Float, Boolean, Time] The property value.
1610
+ # @param type [Symbol] The type of property (:string, :number, :bool, :date).
1611
+ # @return [void]
1612
+ # : (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
1613
+ def custom_property: (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
1614
+
1615
+ # : () -> untyped
1616
+ def close: () -> untyped
1617
+
1618
+ # Explicitly remove any remaining tempfiles. Called via ensure block.
1619
+ # : () -> void
1620
+ def cleanup!: () -> void
1621
+
1622
+ private
1623
+
1624
+ # : (untyped range) -> untyped
1625
+ def absolute_range: (untyped range) -> untyped
1626
+
1627
+ # : (untyped names, untyped sheets) -> untyped
1628
+ def resolve_defined_names: (untyped names, untyped sheets) -> untyped
1629
+
1630
+ # : () -> (nil | untyped)
1631
+ def flush_current_sheet: () -> (nil | untyped)
1632
+ end
1633
+
1634
+ private def self.build_worksheet: (untyped name, untyped sheet_xml, untyped shared_strings, untyped _styles) -> untyped
1635
+
1636
+ private def self.build_row_from_raw: (untyped raw_row) -> untyped
1637
+
1638
+ private def self.build_raw_cell: (untyped cell, untyped sst, untyped sst_index) -> untyped
1639
+
1640
+ private def self.build_row_attrs: (untyped row) -> untyped
1641
+
1642
+ # Builds a raw cell hash from a value for streaming writes.
1643
+ # @api public
1644
+ # : (untyped row_index, untyped col_index, untyped value, untyped sst, untyped sst_index) -> untyped
1645
+ def self.build_raw_cell_from_value: (untyped row_index, untyped col_index, untyped value, untyped sst, untyped sst_index) -> untyped
1646
+ end