xlsxrb 0.1.17 → 0.2.0

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +256 -1
  3. data/README.md +111 -28
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +439 -139
  5. data/lib/xlsxrb/chart_builder.rb +540 -193
  6. data/lib/xlsxrb/dsl_helpers.rb +178 -73
  7. data/lib/xlsxrb/elements/cell.rb +197 -130
  8. data/lib/xlsxrb/elements/column.rb +88 -7
  9. data/lib/xlsxrb/elements/coordinate_access.rb +86 -59
  10. data/lib/xlsxrb/elements/image.rb +18 -19
  11. data/lib/xlsxrb/elements/metadata.rb +2379 -0
  12. data/lib/xlsxrb/elements/row.rb +84 -118
  13. data/lib/xlsxrb/elements/styles.rb +140 -90
  14. data/lib/xlsxrb/elements/types.rb +164 -22
  15. data/lib/xlsxrb/elements/workbook.rb +122 -140
  16. data/lib/xlsxrb/elements/worksheet.rb +451 -226
  17. data/lib/xlsxrb/elements.rb +1 -0
  18. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +16 -5
  19. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +14 -9
  20. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +296 -34
  21. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
  22. data/lib/xlsxrb/ooxml/reader.rb +52 -50
  23. data/lib/xlsxrb/ooxml/styles_parser.rb +36 -5
  24. data/lib/xlsxrb/ooxml/utils.rb +2 -2
  25. data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
  26. data/lib/xlsxrb/ooxml/workbook_writer.rb +242 -109
  27. data/lib/xlsxrb/ooxml/worksheet_parser.rb +63 -31
  28. data/lib/xlsxrb/ooxml/worksheet_writer.rb +119 -56
  29. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +33 -13
  30. data/lib/xlsxrb/ooxml/writer/features_xml.rb +75 -15
  31. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +18 -8
  32. data/lib/xlsxrb/ooxml/writer.rb +124 -44
  33. data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
  34. data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
  35. data/lib/xlsxrb/ooxml/zip_reader.rb +112 -25
  36. data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
  37. data/lib/xlsxrb/stream_row.rb +56 -81
  38. data/lib/xlsxrb/stream_sheet.rb +542 -273
  39. data/lib/xlsxrb/stream_writer.rb +1536 -870
  40. data/lib/xlsxrb/style_builder.rb +667 -221
  41. data/lib/xlsxrb/version.rb +1 -1
  42. data/lib/xlsxrb/workbook_builder.rb +406 -143
  43. data/lib/xlsxrb/worksheet_builder.rb +1009 -900
  44. data/lib/xlsxrb.rb +1179 -1056
  45. data/sig/generated/xlsxrb/chart_builder.rbs +385 -159
  46. data/sig/generated/xlsxrb/dsl_helpers.rbs +81 -15
  47. data/sig/generated/xlsxrb/elements/cell.rbs +78 -70
  48. data/sig/generated/xlsxrb/elements/column.rbs +55 -3
  49. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +35 -29
  50. data/sig/generated/xlsxrb/elements/image.rbs +7 -11
  51. data/sig/generated/xlsxrb/elements/metadata.rbs +1574 -0
  52. data/sig/generated/xlsxrb/elements/row.rbs +39 -42
  53. data/sig/generated/xlsxrb/elements/styles.rbs +66 -66
  54. data/sig/generated/xlsxrb/elements/types.rbs +27 -0
  55. data/sig/generated/xlsxrb/elements/workbook.rbs +46 -99
  56. data/sig/generated/xlsxrb/elements/worksheet.rbs +121 -96
  57. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -4
  58. data/sig/generated/xlsxrb/ooxml/reader.rbs +2 -2
  59. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
  60. data/sig/generated/xlsxrb/ooxml/utils.rbs +3 -3
  61. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +13 -1
  62. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
  63. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +6 -4
  64. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +7 -0
  65. data/sig/generated/xlsxrb/ooxml/writer.rbs +22 -13
  66. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
  67. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
  68. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +24 -9
  69. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
  70. data/sig/generated/xlsxrb/stream_row.rbs +32 -33
  71. data/sig/generated/xlsxrb/stream_sheet.rbs +233 -181
  72. data/sig/generated/xlsxrb/stream_writer.rbs +961 -667
  73. data/sig/generated/xlsxrb/style_builder.rbs +402 -128
  74. data/sig/generated/xlsxrb/workbook_builder.rbs +223 -71
  75. data/sig/generated/xlsxrb/worksheet_builder.rbs +579 -453
  76. data/sig/generated/xlsxrb.rbs +205 -144
  77. data/sig/rexml.rbs +8 -0
  78. metadata +5 -5
  79. data/lib/xlsxrb/utils.rb +0 -291
  80. data/sig/generated/xlsxrb/utils.rbs +0 -184
@@ -9,11 +9,13 @@ module Xlsxrb
9
9
  # sheet.row(["Product", "Revenue"])
10
10
  # sheet.row(["Widget", 1000])
11
11
  # end
12
- # builder.core_property(:creator, "Reporting System")
12
+ # builder.core_properties(creator: "Reporting System")
13
13
  # end
14
14
  #
15
15
  # @api public
16
16
  class WorkbookBuilder
17
+ OMITTED: untyped
18
+
17
19
  # @param strict_excel_mode [Boolean] Whether to enforce Microsoft Excel specifications.
18
20
  # @param default_font [Hash, nil] Optional default font options (e.g. `{ name: "Arial", size: 12 }`).
19
21
  # : (?strict_excel_mode: bool, ?default_font: untyped?) -> void
@@ -29,74 +31,148 @@ module Xlsxrb
29
31
  # : (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
30
32
  def default_font: (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
31
33
 
32
- alias set_default_font default_font
34
+ # @return [Hash{String => StyleBuilder}]
35
+ # : Hash[String, StyleBuilder]
36
+ attr_reader styles: untyped
33
37
 
34
- # Gets or sets the active worksheet tab in the workbook window.
38
+ # Defines or configures a named cell style at the workbook level.
35
39
  #
36
- # @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
37
- # @return [String, Symbol, Integer, nil]
40
+ # @example
41
+ # workbook.style(:header, bold: true, fill_color: "4F81BD", font_color: "FFFFFF")
42
+ #
43
+ # @param name [String, Symbol] The name of the style.
44
+ # @param opts [Hash] Style options (e.g. bold: true, fill_color: "FF0000").
45
+ # @yield [style_builder]
46
+ # @yieldparam style_builder [Xlsxrb::StyleBuilder]
47
+ # @return [StyleBuilder]
38
48
  # @api public
39
- # : (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
40
- def active_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
49
+ # : (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
50
+ def style: (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
41
51
 
42
- alias active_sheet= active_sheet
52
+ # Creates an {Elements::Formula} object.
53
+ #
54
+ # @param expression [String] The formula expression without leading '='.
55
+ # @param cached_value [Object, nil] Optional precomputed value.
56
+ # @param type [Symbol, String, nil] Formula type (:shared, :array, etc.).
57
+ # @param ref [String, nil] Target cell or range reference.
58
+ # @param shared_index [Integer, nil] Shared formula group index (0-based).
59
+ # @return [Elements::Formula]
60
+ # @api public
61
+ # : (String expression, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
62
+ def formula: (String expression, ?cached_value: String | Numeric | bool | Elements::CellError | nil, ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
43
63
 
44
- alias active_tab active_sheet
64
+ # Creates an array or dynamic array {Elements::Formula} object.
65
+ #
66
+ # @param expression [String] The formula expression without leading '='.
67
+ # @param ref [String, nil] Target cell or range reference (keyword).
68
+ # @param cached_value [Object, nil] Optional precomputed value.
69
+ # @return [Elements::Formula]
70
+ # @api public
71
+ # : (String expression, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), **untyped attrs) -> Elements::Formula
72
+ def array_formula: (String expression, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil, **untyped attrs) -> Elements::Formula
45
73
 
46
- alias active_tab= active_sheet
74
+ # Creates a shared formula {Elements::Formula} object.
75
+ #
76
+ # @param expression [String, nil] The formula expression.
77
+ # @param shared_index [Integer, nil] Shared formula group index (0-based).
78
+ # @param ref [String, nil] Target range for master cell.
79
+ # @param cached_value [Object, nil] Optional precomputed value.
80
+ # @return [Elements::Formula]
81
+ # @api public
82
+ # : (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil)) -> Elements::Formula
83
+ def shared_formula: (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil) -> Elements::Formula
47
84
 
48
- # Gets or sets the first sheet tab visible in the sheet tab scroll area.
85
+ # Creates an {Elements::RichText} object.
86
+ #
87
+ # @param runs [Array] Text runs or styling options.
88
+ # @return [Elements::RichText]
89
+ # @api public
90
+ # : (*(Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped) runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
91
+ def rich_text: (*Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
92
+
93
+ # Creates or returns an {Elements::CellError} object.
94
+ #
95
+ # @param code [String, Symbol, Elements::CellError] Error code or symbol.
96
+ # @return [Elements::CellError]
97
+ # @api public
98
+ # : (String | Symbol | Elements::CellError code) -> Elements::CellError
99
+ def cell_error: (String | Symbol | Elements::CellError code) -> Elements::CellError
100
+
101
+ # Gets or sets the active worksheet tab in the workbook window.
49
102
  #
50
- # @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
51
103
  # @return [String, Symbol, Integer, nil]
52
104
  # @api public
53
- # : (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
54
- def first_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
105
+ # : (String | Symbol | Integer | nil)
106
+ attr_accessor active_sheet: untyped
55
107
 
56
- alias first_sheet= first_sheet
108
+ # Gets or sets the first sheet tab visible in the sheet tab scroll area.
109
+ #
110
+ # @return [String, Symbol, Integer, nil]
111
+ # @api public
112
+ # : (String | Symbol | Integer | nil)
113
+ attr_accessor first_sheet: untyped
57
114
 
58
- # Gets or sets whether sheet tabs are visible in the workbook window.
115
+ # Sets whether sheet tabs are visible in the workbook window.
59
116
  #
60
117
  # @param visible [Boolean, nil]
61
118
  # @return [Boolean, nil]
62
119
  # @api public
63
- # : (?bool? visible) -> bool?
64
- def show_sheet_tabs: (?bool? visible) -> bool?
120
+ # : (bool? visible) -> bool?
121
+ attr_writer show_sheet_tabs: untyped
65
122
 
66
- alias show_sheet_tabs= show_sheet_tabs
123
+ # Returns whether sheet tabs are visible in the workbook window.
124
+ #
125
+ # @return [Boolean]
126
+ # @api public
127
+ # : () -> bool
128
+ def show_sheet_tabs?: () -> bool
67
129
 
68
130
  # Gets or sets the ratio between the sheet tabs bar and the horizontal scroll bar (0-1000).
69
131
  #
70
- # @param ratio [Integer, nil]
71
132
  # @return [Integer, nil]
72
133
  # @api public
73
- # : (?Integer? ratio) -> Integer?
74
- def tab_ratio: (?Integer? ratio) -> Integer?
134
+ # : Integer?
135
+ attr_accessor tab_ratio: untyped
75
136
 
76
- alias tab_ratio= tab_ratio
137
+ # Gets the internal code name of the workbook.
138
+ #
139
+ # @return [String, nil]
140
+ # @api public
141
+ # : () -> String?
142
+ def code_name: () -> String?
77
143
 
78
- # Gets or sets the internal code name of the workbook.
144
+ # Sets the internal code name of the workbook.
79
145
  #
80
146
  # @param name [String, Symbol, nil] The code name.
81
147
  # @return [String, nil]
82
148
  # @api public
83
- # : (?String | Symbol | nil name) -> String?
84
- def code_name: (?String | Symbol | nil name) -> String?
149
+ # : (String | Symbol | nil name) -> String?
150
+ def code_name=: (String | Symbol | nil name) -> String?
85
151
 
86
- alias code_name= code_name
87
-
88
- # Sets a workbook-level property.
152
+ # Configures or queries workbook-level properties.
153
+ #
154
+ # When called with no arguments, returns the {Elements::WorkbookProperties} value object.
155
+ # When called with keyword options, configures properties and returns nil.
89
156
  #
90
157
  # @note **SECURITY WARNING:** If you set `:update_links` to anything other than `"never"`,
91
158
  # you may expose end-users to malicious external reference vulnerabilities (e.g., CSV/DDE Injection)
92
159
  # when they open the generated Excel file. Ensure you fully trust the exported data.
93
160
  #
94
- # @param name [Symbol] Property name (e.g. :update_links).
95
- # @param value [String, Integer, Boolean] Property value.
161
+ # @param opts [Hash] Workbook properties map.
162
+ # @return [Elements::WorkbookProperties, void]
163
+ # @api public
164
+ # : () -> Elements::WorkbookProperties
165
+ # : (**untyped opts) -> void
166
+ def workbook_properties: () -> Elements::WorkbookProperties
167
+ | (**untyped opts) -> void
168
+
169
+ # Sets workbook-level properties.
170
+ #
171
+ # @param props [Hash, Elements::MetadataRecord]
96
172
  # @return [void]
97
173
  # @api public
98
- # : (Symbol name, String | Integer | bool value) -> (String | Integer | bool)
99
- def workbook_property: (Symbol name, String | Integer | bool value) -> (String | Integer | bool)
174
+ # : (untyped props) -> void
175
+ def workbook_properties=: (untyped props) -> void
100
176
 
101
177
  # Returns the list of worksheet names added to this workbook so far.
102
178
  #
@@ -108,54 +184,88 @@ module Xlsxrb
108
184
  # Adds a new worksheet to the workbook.
109
185
  #
110
186
  # @param name [String, nil] Sheet name (max 31 chars, no forbidden chars `[ ] * ? / \ :`).
111
- # @param opts [Hash] Sheet properties.
187
+ # @param state [Symbol, String, nil] Sheet visibility state (:visible, :hidden, :very_hidden).
188
+ # @param tab_color [String, Hash, Symbol, nil] Tab color hex string (e.g. "FF0000") or hash options.
189
+ # @param code_name [String, Symbol, nil] Internal VBA code name of the sheet.
190
+ # @param opts [Hash] Additional sheet properties.
112
191
  # @yield [sheet_builder]
113
192
  # @yieldparam sheet_builder [Xlsxrb::WorksheetBuilder]
114
193
  # @return [Elements::Worksheet]
115
194
  # @raise [ArgumentError] If sheet name violates Excel limits in strict mode.
116
195
  # @api public
117
- # : (?String? name, **untyped opts) ?{ (WorksheetBuilder) -> void } -> untyped
118
- def sheet: (?String? name, **untyped opts) ?{ (WorksheetBuilder) -> void } -> untyped
119
-
120
- alias [] sheet
196
+ # : (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } -> Elements::Worksheet
197
+ def sheet: (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } -> Elements::Worksheet
121
198
 
122
- # Adds a defined name (named range or formula constant) to the workbook.
199
+ # Accesses or defines a worksheet by name.
123
200
  #
124
- # @param name [String] Defined name (e.g. "TaxRate").
125
- # @param value [String] Formula expression or range reference (e.g. "Sheet1!$B$2").
201
+ # @param name_or_index [String, Symbol, Integer, nil]
202
+ # @yield [sheet_builder]
203
+ # @return [Elements::Worksheet]
204
+ # @api public
205
+ # : (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } -> Elements::Worksheet
206
+ def []: (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } -> Elements::Worksheet
207
+
126
208
  # Adds a defined name (named range or formula) to the workbook.
127
209
  # Bare cell references and coordinate keywords are automatically formatted with sheet quotes and absolute $ references.
128
210
  #
129
211
  # @param name [String] Defined name identifier.
130
212
  # @param value [Object, nil] Value or formula expression.
131
- # @param sheet [String, nil] Optional sheet name for sheet-scoped defined names.
213
+ # @param sheet [String, nil] Reference sheet name for coordinates/formula.
214
+ # @param scope [String, Symbol, nil] Optional sheet name or :workbook for scope (defaults to workbook).
132
215
  # @param hidden [Boolean] Whether the defined name is hidden from Excel's UI.
133
- # @param col [Integer, String, nil] Column index or letter for coordinate-based reference.
134
- # @param rows [Integer, Range, nil] Row or row range (1-based) for coordinate-based reference.
216
+ # @param columns [Integer, String, nil] Column index or letter for coordinate-based reference.
217
+ # @param rows [Integer, Range, nil] Row or row range (0-based) for coordinate-based reference.
135
218
  # @param range [String, nil] Cell range reference.
136
219
  # @return [void]
137
220
  # @api public
138
- # : (String name, ?untyped value, ?sheet: String?, ?hidden: bool, ?col: untyped, ?rows: untyped, ?range: untyped, ?ref_sheet: String?, ?local: bool) -> void
139
- def defined_name: (String name, ?untyped value, ?sheet: String?, ?hidden: bool, ?col: untyped, ?rows: untyped, ?range: untyped, ?ref_sheet: String?, ?local: bool) -> void
221
+ # : (String name, ?untyped value, ?sheet: String?, ?scope: (String | Symbol)?, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped) -> void
222
+ def defined_name: (String name, ?untyped value, ?sheet: String?, ?scope: (String | Symbol)?, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped) -> void
140
223
 
141
- # Sets the print area for a sheet.
224
+ # Returns workbook-level defined names.
225
+ #
226
+ # @return [Array<Elements::DefinedName>]
227
+ # @api public
228
+ # : () -> Array[Elements::DefinedName]
229
+ def defined_names: () -> Array[Elements::DefinedName]
230
+
231
+ # Returns the print area range for the sheet, or nil if none.
142
232
  #
143
- # @param range [String] Cell range (e.g. "A1:G50").
144
233
  # @param sheet [String, nil] Target sheet name (defaults to latest or "Sheet1").
145
- # @return [void]
234
+ # @return [String, nil]
146
235
  # @api public
147
- # : (String range, ?sheet: String?) -> void
148
- def print_area: (String range, ?sheet: String?) -> void
236
+ # : (?sheet: String?) -> String?
237
+ def print_area: (?sheet: String?) -> String?
149
238
 
150
- # Sets repeating print titles (rows and/or columns) for pagination.
239
+ # Sets the print area for the current worksheet.
240
+ #
241
+ # @param range [String, nil] Cell range (e.g. "A1:G50").
242
+ # @return [String, nil]
243
+ # @api public
244
+ # : (String? range) -> String?
245
+ def print_area=: (String? range) -> String?
246
+
247
+ # Sets or gets repeating print titles (rows and/or columns) for pagination.
248
+ #
249
+ # When called with no row/column arguments, returns the {Elements::PrintTitles} value object or nil.
250
+ # When called with row/column arguments, sets repeating print titles and returns nil.
151
251
  #
152
252
  # @param rows [String, nil] Repeating row range (e.g. "1:2").
153
- # @param cols [String, nil] Repeating column range (e.g. "A:B").
253
+ # @param columns [String, nil] Repeating column range (e.g. "A:B").
154
254
  # @param sheet [String, nil] Target sheet name.
155
- # @return [void]
255
+ # @return [Elements::PrintTitles, nil, void]
156
256
  # @api public
157
- # : (?rows: String?, ?cols: String?, ?sheet: String?) -> void
158
- def print_titles: (?rows: String?, ?cols: String?, ?sheet: String?) -> void
257
+ # : () -> Elements::PrintTitles?
258
+ # : (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?, ?sheet: String?) -> void
259
+ def print_titles: () -> Elements::PrintTitles?
260
+ | (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?, ?sheet: String?) -> void
261
+
262
+ # Sets repeating print titles.
263
+ #
264
+ # @param opts [Elements::PrintTitles, Hash, nil] Options with :rows and/or :columns.
265
+ # @return [Elements::PrintTitles, Hash, nil]
266
+ # @api public
267
+ # : (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
268
+ def print_titles=: (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
159
269
 
160
270
  # Sets repeating title rows for pagination on the target or active sheet.
161
271
  #
@@ -183,31 +293,63 @@ module Xlsxrb
183
293
  # : (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
184
294
  def repeat_columns: (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
185
295
 
186
- # Sets workbook structure and window protection.
296
+ # Sets or returns workbook structure and window protection.
187
297
  #
188
298
  # @param opts [Hash] Protection options (e.g. lock_structure: true, password: "secret").
299
+ # @return [Elements::WorkbookProtection, nil, void]
300
+ # @api public
301
+ # : (**String | Integer | bool | nil opts) -> (Elements::WorkbookProtection | nil)
302
+ def workbook_protection: (**String | Integer | bool | nil opts) -> (Elements::WorkbookProtection | nil)
303
+
304
+ # Sets workbook protection settings.
305
+ #
306
+ # @param opts [Hash, Elements::MetadataRecord, nil]
189
307
  # @return [void]
190
308
  # @api public
191
- # : (**String | Integer | bool | nil opts) -> void
192
- def protect_workbook: (**String | Integer | bool | nil opts) -> void
309
+ # : (untyped opts) -> void
310
+ def workbook_protection=: (untyped opts) -> void
311
+
312
+ # Configures or queries Dublin Core document metadata properties.
313
+ #
314
+ # When called with no arguments, returns the {Elements::CoreProperties} value object.
315
+ # When called with keyword options, configures properties and returns nil.
316
+ #
317
+ # @param opts [Hash] Core properties map (:creator, :title, :subject, :description, etc.).
318
+ # @return [Elements::CoreProperties, void]
319
+ # @api public
320
+ # : () -> Elements::CoreProperties
321
+ # : (**untyped opts) -> void
322
+ def core_properties: () -> Elements::CoreProperties
323
+ | (**untyped opts) -> void
193
324
 
194
- # Sets a Dublin Core document metadata property.
325
+ # Replaces core document properties.
195
326
  #
196
- # @param name [Symbol] Core property name (:creator, :title, :subject, :description, etc.).
197
- # @param value [String, Integer, Time] Property value.
327
+ # @param props [Hash, Elements::CoreProperties]
198
328
  # @return [void]
199
329
  # @api public
200
- # : (Symbol name, String | Integer | Time value) -> void
201
- def core_property: (Symbol name, String | Integer | Time value) -> void
330
+ # : (Hash[Symbol, untyped] | Elements::CoreProperties props) -> void
331
+ def core_properties=: (Hash[Symbol, untyped] | Elements::CoreProperties props) -> void
202
332
 
203
- # Sets an extended application metadata property.
333
+ # Configures or queries extended application metadata properties.
204
334
  #
205
- # @param name [Symbol] Application property name (:company, :manager, :app_version, etc.).
206
- # @param value [String, Integer, Time] Property value.
335
+ # When called with no arguments, returns the {Elements::AppProperties} value object.
336
+ # When called with keyword options, configures properties and returns nil.
337
+ #
338
+ # @param opts [Hash] Application properties map (:company, :manager, :app_version, etc.).
339
+ # @return [Elements::AppProperties, void]
340
+ # @api public
341
+ # : () -> Elements::AppProperties
342
+ # : (**untyped opts) -> void
343
+ def app_properties: () -> Elements::AppProperties
344
+ | (**untyped opts) -> void
345
+
346
+ # Replaces application document properties.
347
+ #
348
+ # @param props [Hash, Elements::AppProperties]
207
349
  # @return [void]
208
350
  # @api public
209
- # : (Symbol name, String | Integer | Time value) -> void
210
- def app_property: (Symbol name, String | Integer | Time value) -> void
351
+ # : (Hash[Symbol, untyped] | Elements::AppProperties props) -> void
352
+ def app_properties=: (Hash[Symbol, untyped] | Elements::AppProperties props) -> void
211
353
 
212
354
  # Sets multiple core, app, and/or custom properties simultaneously.
213
355
  #
@@ -229,6 +371,13 @@ module Xlsxrb
229
371
  # : (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
230
372
  def custom_property: (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
231
373
 
374
+ # Returns custom document properties.
375
+ #
376
+ # @return [Hash<String, Elements::CustomProperty>]
377
+ # @api public
378
+ # : () -> Hash[String, Elements::CustomProperty]
379
+ def custom_properties: () -> Hash[String, Elements::CustomProperty]
380
+
232
381
  # Builds and returns the compiled {Elements::Workbook}.
233
382
  #
234
383
  # @return [Elements::Workbook]
@@ -239,6 +388,9 @@ module Xlsxrb
239
388
 
240
389
  private
241
390
 
391
+ # : (String? range, ?sheet: String?) -> String?
392
+ def set_print_area: (String? range, ?sheet: String?) -> String?
393
+
242
394
  # : (untyped range) -> untyped
243
395
  def absolute_range: (untyped range) -> untyped
244
396
 
@@ -248,7 +400,7 @@ module Xlsxrb
248
400
  # : (untyped sheets) -> (::Array[untyped | ::Hash[untyped, untyped]] | ::Array[untyped])
249
401
  def process_styles: (untyped sheets) -> (::Array[untyped | ::Hash[untyped, untyped]] | ::Array[untyped])
250
402
 
251
- # : (untyped writer) -> { fonts: untyped, fills: untyped, borders: untyped, xf_entries: untyped, num_fmts: untyped }
252
- def extract_styles_from_writer: (untyped writer) -> { fonts: untyped, fills: untyped, borders: untyped, xf_entries: untyped, num_fmts: untyped }
403
+ # : (untyped writer) -> Hash[Symbol, untyped]
404
+ def extract_styles_from_writer: (untyped writer) -> Hash[Symbol, untyped]
253
405
  end
254
406
  end