xlsxrb 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +157 -1
- data/README.md +81 -21
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
- data/lib/xlsxrb/chart_builder.rb +619 -98
- data/lib/xlsxrb/dsl_helpers.rb +583 -15
- data/lib/xlsxrb/elements/cell.rb +265 -53
- data/lib/xlsxrb/elements/column.rb +95 -6
- data/lib/xlsxrb/elements/coordinate_access.rb +108 -10
- data/lib/xlsxrb/elements/image.rb +81 -15
- data/lib/xlsxrb/elements/metadata.rb +2733 -0
- data/lib/xlsxrb/elements/row.rb +130 -46
- data/lib/xlsxrb/elements/styles.rb +184 -76
- data/lib/xlsxrb/elements/types.rb +243 -7
- data/lib/xlsxrb/elements/workbook.rb +202 -65
- data/lib/xlsxrb/elements/worksheet.rb +728 -85
- data/lib/xlsxrb/elements.rb +1 -0
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +32 -3
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +194 -26
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +372 -18
- data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +33 -14
- data/lib/xlsxrb/ooxml/reader.rb +92 -0
- data/lib/xlsxrb/ooxml/styles_parser.rb +29 -14
- data/lib/xlsxrb/ooxml/workbook_parser.rb +18 -3
- data/lib/xlsxrb/ooxml/workbook_writer.rb +351 -77
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +18 -4
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +349 -103
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +584 -443
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +52 -14
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +42 -18
- data/lib/xlsxrb/ooxml/writer.rb +288 -35
- data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
- data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
- data/lib/xlsxrb/ooxml/zip_writer.rb +15 -5
- data/lib/xlsxrb/stream_row.rb +97 -18
- data/lib/xlsxrb/stream_sheet.rb +827 -157
- data/lib/xlsxrb/stream_writer.rb +2766 -375
- data/lib/xlsxrb/style_builder.rb +821 -105
- data/lib/xlsxrb/utils.rb +82 -57
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +542 -62
- data/lib/xlsxrb/worksheet_builder.rb +2279 -209
- data/lib/xlsxrb.rb +1539 -344
- data/sig/generated/xlsxrb/chart_builder.rbs +336 -79
- data/sig/generated/xlsxrb/dsl_helpers.rbs +137 -4
- data/sig/generated/xlsxrb/elements/cell.rbs +104 -15
- data/sig/generated/xlsxrb/elements/column.rbs +62 -3
- data/sig/generated/xlsxrb/elements/coordinate_access.rbs +49 -7
- data/sig/generated/xlsxrb/elements/image.rbs +30 -8
- data/sig/generated/xlsxrb/elements/metadata.rbs +1587 -0
- data/sig/generated/xlsxrb/elements/row.rbs +61 -21
- data/sig/generated/xlsxrb/elements/styles.rbs +96 -58
- data/sig/generated/xlsxrb/elements/types.rbs +29 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +92 -44
- data/sig/generated/xlsxrb/elements/worksheet.rbs +259 -38
- data/sig/generated/xlsxrb/ooxml/reader/listeners/core_listeners.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/reader/listeners/drawing_listeners.rbs +74 -2
- data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +97 -0
- data/sig/generated/xlsxrb/ooxml/reader/listeners/style_listeners.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +20 -0
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +8 -0
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +8 -4
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +12 -1
- data/sig/generated/xlsxrb/ooxml/writer/drawing_xml.rbs +16 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +45 -8
- data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +8 -2
- data/sig/generated/xlsxrb/stream_row.rbs +48 -14
- data/sig/generated/xlsxrb/stream_sheet.rbs +398 -89
- data/sig/generated/xlsxrb/stream_writer.rbs +1601 -219
- data/sig/generated/xlsxrb/style_builder.rbs +403 -75
- data/sig/generated/xlsxrb/utils.rbs +49 -13
- data/sig/generated/xlsxrb/workbook_builder.rbs +308 -26
- data/sig/generated/xlsxrb/worksheet_builder.rbs +1142 -96
- data/sig/generated/xlsxrb.rbs +321 -52
- metadata +3 -1
data/sig/generated/xlsxrb.rbs
CHANGED
|
@@ -2,11 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
# Modern, streaming-capable, low-memory XLSX reading and writing library for Ruby.
|
|
4
4
|
#
|
|
5
|
-
# Provides high-level facade methods ({Xlsxrb.read}, {Xlsxrb.write}, {Xlsxrb.build}, {Xlsxrb.
|
|
5
|
+
# Provides high-level facade methods ({Xlsxrb.read}, {Xlsxrb.write}, {Xlsxrb.build}, {Xlsxrb.load})
|
|
6
6
|
# with full ECMA-376 OpenXML compliance, MS-OFFCRYPTO password protection, and zero core dependencies.
|
|
7
7
|
#
|
|
8
8
|
# @api public
|
|
9
9
|
module Xlsxrb
|
|
10
|
+
# Maximum number of rows supported by Excel / OpenXML.
|
|
11
|
+
MAX_ROW: ::Integer
|
|
12
|
+
|
|
13
|
+
# Maximum number of columns supported by Excel / OpenXML.
|
|
14
|
+
MAX_COLUMN: ::Integer
|
|
15
|
+
|
|
16
|
+
# @deprecated Use {MAX_COLUMN} instead. Will be removed in 0.2.0.
|
|
17
|
+
MAX_COL: untyped
|
|
18
|
+
|
|
19
|
+
# Maximum number of individual cell/range references allowed in a single data validation element by Excel.
|
|
20
|
+
MAX_REFS_PER_VALIDATION: ::Integer
|
|
21
|
+
|
|
22
|
+
# @api private
|
|
23
|
+
module Deprecation
|
|
24
|
+
def self.warn: (untyped message, ?uplevel: untyped) -> untyped
|
|
25
|
+
end
|
|
26
|
+
|
|
10
27
|
# Base class for all exceptions raised by Xlsxrb.
|
|
11
28
|
# Predefined cell error constants are exposed on this class for convenience.
|
|
12
29
|
class Error < StandardError
|
|
@@ -23,6 +40,8 @@ module Xlsxrb
|
|
|
23
40
|
REF: untyped
|
|
24
41
|
|
|
25
42
|
VALUE: untyped
|
|
43
|
+
|
|
44
|
+
GETTING_DATA: untyped
|
|
26
45
|
end
|
|
27
46
|
|
|
28
47
|
# Raised when parsing malformed or invalid XML structures.
|
|
@@ -31,6 +50,8 @@ module Xlsxrb
|
|
|
31
50
|
|
|
32
51
|
OMITTED_TARGET: untyped
|
|
33
52
|
|
|
53
|
+
VALID_SHEET_STATES: untyped
|
|
54
|
+
|
|
34
55
|
OFFICE_DOC_REL_TYPES: untyped
|
|
35
56
|
|
|
36
57
|
NON_WORKSHEET_REL_SUFFIXES: untyped
|
|
@@ -77,11 +98,12 @@ module Xlsxrb
|
|
|
77
98
|
#
|
|
78
99
|
# @param runs [Array<Hash, String, Array, Elements::RichTextRun, Object>] Optional array of rich text run items.
|
|
79
100
|
# @param text [String, nil] Plain text string (convenience parameter).
|
|
101
|
+
# @param base_font [Hash, Object, nil] Base font properties to merge into all runs.
|
|
80
102
|
# @param font_props [Hash] Inline font styling options (e.g. bold: true, color: "FF0000").
|
|
81
103
|
# @return [Elements::RichText] The compiled rich text element.
|
|
82
104
|
# @api public
|
|
83
|
-
# : (*(Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped) runs, ?text: String?, **untyped font_props) -> Elements::RichText
|
|
84
|
-
def self.rich_text: (*Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped runs, ?text: String?, **untyped font_props) -> Elements::RichText
|
|
105
|
+
# : (*(Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped) runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
106
|
+
def self.rich_text: (*Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
85
107
|
|
|
86
108
|
# Creates an {Elements::Formula} object for use in cell values.
|
|
87
109
|
#
|
|
@@ -95,26 +117,49 @@ module Xlsxrb
|
|
|
95
117
|
# @param cached_value [Object, nil] Optional precomputed value for readers that do not evaluate formulas.
|
|
96
118
|
# @param type [Symbol, String, nil] Formula type (:shared, :array, etc.).
|
|
97
119
|
# @param ref [String, nil] Target cell or range reference (e.g. "A1:C1").
|
|
120
|
+
# @param shared_index [Integer, nil] Shared formula group index (0-based).
|
|
121
|
+
# @param si [Integer, nil] Alias for shared_index.
|
|
122
|
+
# @return [Elements::Formula]
|
|
123
|
+
# @api public
|
|
124
|
+
# rubocop:disable Naming/MethodParameterName
|
|
125
|
+
# : (String expression, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?, ?si: Integer?) -> Elements::Formula
|
|
126
|
+
def self.formula: (String expression, ?cached_value: String | Numeric | bool | Elements::CellError | nil, ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?, ?si: Integer?) -> Elements::Formula
|
|
127
|
+
|
|
128
|
+
# Creates a shared formula {Elements::Formula} object for master or follower cell.
|
|
129
|
+
#
|
|
130
|
+
# @example Create a shared formula master
|
|
131
|
+
# formula = Xlsxrb.shared_formula("A2*2", shared_index: 0, ref: "B2:B10")
|
|
132
|
+
#
|
|
133
|
+
# @example Create a shared formula follower
|
|
134
|
+
# formula = Xlsxrb.shared_formula(shared_index: 0)
|
|
135
|
+
#
|
|
136
|
+
# @param expression [String, nil] The formula expression (nil for follower cells).
|
|
137
|
+
# @param shared_index [Integer, nil] Shared formula group index (0-based).
|
|
138
|
+
# @param si [Integer, nil] Legacy alias for shared_index.
|
|
139
|
+
# @param ref [String, nil] Target range for master cell (e.g. "B2:B10").
|
|
140
|
+
# @param cached_value [Object, nil] Optional precomputed value.
|
|
98
141
|
# @return [Elements::Formula]
|
|
99
142
|
# @api public
|
|
100
|
-
# : (String expression, ?cached_value: (String | Numeric | bool | Elements::CellError | nil)
|
|
101
|
-
def self.
|
|
143
|
+
# : (?String? expression, ?shared_index: Integer?, ?si: Integer?, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil)) -> Elements::Formula
|
|
144
|
+
def self.shared_formula: (?String? expression, ?shared_index: Integer?, ?si: Integer?, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil) -> Elements::Formula
|
|
102
145
|
|
|
103
146
|
# Creates an array or dynamic array {Elements::Formula} object.
|
|
104
147
|
#
|
|
105
148
|
# @example Create a multi-cell array formula
|
|
106
149
|
# formula = Xlsxrb.array_formula("SUM(B1:B10*C1:C10)", "A1:C1", cached_value: 0)
|
|
150
|
+
# formula = Xlsxrb.array_formula("SUM(B1:B10*C1:C10)", ref: "A1:C1", cached_value: 0)
|
|
107
151
|
#
|
|
108
152
|
# @example Create a dynamic array formula
|
|
109
153
|
# formula = Xlsxrb.array_formula("SORT(UNIQUE(A1:A10))", "D1")
|
|
110
154
|
#
|
|
111
155
|
# @param expression [String] The formula expression without leading '='.
|
|
112
|
-
# @param
|
|
156
|
+
# @param pos_ref [String, nil] Target cell or range reference (positional).
|
|
157
|
+
# @param ref [String, nil] Target cell or range reference (keyword).
|
|
113
158
|
# @param cached_value [Object, nil] Optional precomputed value.
|
|
114
159
|
# @return [Elements::Formula]
|
|
115
160
|
# @api public
|
|
116
|
-
# : (String expression, ?String?
|
|
117
|
-
def self.array_formula: (String expression, ?String?
|
|
161
|
+
# : (String expression, ?String? pos_ref, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), **untyped attrs) -> Elements::Formula
|
|
162
|
+
def self.array_formula: (String expression, ?String? pos_ref, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil, **untyped attrs) -> Elements::Formula
|
|
118
163
|
|
|
119
164
|
# Creates an {Elements::Hyperlink} object for use in cell hyperlinks.
|
|
120
165
|
#
|
|
@@ -133,6 +178,32 @@ module Xlsxrb
|
|
|
133
178
|
# : (?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> Elements::Hyperlink
|
|
134
179
|
def self.hyperlink: (?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> Elements::Hyperlink
|
|
135
180
|
|
|
181
|
+
# Creates an {Elements::Comment} object for use in cell comments.
|
|
182
|
+
#
|
|
183
|
+
# @example Create a cell comment
|
|
184
|
+
# comment = Xlsxrb.comment("Review this value", author: "Auditor")
|
|
185
|
+
#
|
|
186
|
+
# @param text [String, nil] Comment body text.
|
|
187
|
+
# @param author [String] Comment author.
|
|
188
|
+
# @param visible [Boolean] Whether comment is visible by default.
|
|
189
|
+
# @param ref [String, nil] Cell coordinate (e.g. "A1").
|
|
190
|
+
# @return [Elements::Comment]
|
|
191
|
+
# @api public
|
|
192
|
+
# : (?String? text, ?author: String, ?visible: bool, ?ref: String?, **untyped extra) -> Elements::Comment
|
|
193
|
+
def self.comment: (?String? text, ?author: String, ?visible: bool, ?ref: String?, **untyped extra) -> Elements::Comment
|
|
194
|
+
|
|
195
|
+
# Creates or returns an {Elements::CellError} object.
|
|
196
|
+
#
|
|
197
|
+
# @example
|
|
198
|
+
# err = Xlsxrb.cell_error("#VALUE!")
|
|
199
|
+
# err = Xlsxrb.cell_error(:value)
|
|
200
|
+
#
|
|
201
|
+
# @param code [String, Symbol, Elements::CellError] Error code or symbol.
|
|
202
|
+
# @return [Elements::CellError]
|
|
203
|
+
# @api public
|
|
204
|
+
# : (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
205
|
+
def self.cell_error: (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
206
|
+
|
|
136
207
|
# Formats a cell value according to an Excel format code string.
|
|
137
208
|
#
|
|
138
209
|
# @param value [Object, nil] Value to format.
|
|
@@ -141,6 +212,10 @@ module Xlsxrb
|
|
|
141
212
|
# @return [String] Formatted string representation.
|
|
142
213
|
# @api public
|
|
143
214
|
# : (untyped value, ?String? format_code, ?date1904: bool) -> String
|
|
215
|
+
def self.format_value: (untyped value, ?String? format_code, ?date1904: bool) -> String
|
|
216
|
+
|
|
217
|
+
# @deprecated Use {.format_value} instead. Will be removed in 0.2.0.
|
|
218
|
+
# : (untyped value, ?String? format_code, ?date1904: bool) -> String
|
|
144
219
|
def self.format: (untyped value, ?String? format_code, ?date1904: bool) -> String
|
|
145
220
|
|
|
146
221
|
# Converts a Date or Time to an Excel numeric serial number (1900 or 1904 system).
|
|
@@ -183,13 +258,17 @@ module Xlsxrb
|
|
|
183
258
|
# Converts a Time or Date to a fractional Excel serial number.
|
|
184
259
|
#
|
|
185
260
|
# @example
|
|
186
|
-
# Xlsxrb.
|
|
261
|
+
# Xlsxrb.time_to_serial(Time.utc(2026, 1, 1, 12, 0, 0)) #=> 46023.5
|
|
187
262
|
#
|
|
188
263
|
# @param time [Time, Date] Time or Date instance.
|
|
189
264
|
# @param date1904 [Boolean] Whether to use the 1904 date system.
|
|
190
265
|
# @return [Float] Fractional serial number.
|
|
191
266
|
# @api public
|
|
192
267
|
# : (Time | Date time, ?date1904: bool) -> Float
|
|
268
|
+
def self.time_to_serial: (Time | Date time, ?date1904: bool) -> Float
|
|
269
|
+
|
|
270
|
+
# @deprecated Use {.time_to_serial} instead. Will be removed in 0.2.0.
|
|
271
|
+
# : (Time | Date time, ?date1904: bool) -> Float
|
|
193
272
|
def self.datetime_to_serial: (Time | Date time, ?date1904: bool) -> Float
|
|
194
273
|
|
|
195
274
|
# Converts an Excel serial number to a Time (UTC).
|
|
@@ -204,7 +283,58 @@ module Xlsxrb
|
|
|
204
283
|
# : (Numeric serial, ?date1904: bool) -> Time
|
|
205
284
|
def self.serial_to_time: (Numeric serial, ?date1904: bool) -> Time
|
|
206
285
|
|
|
207
|
-
|
|
286
|
+
# @deprecated Use {.serial_to_time} instead. Will be removed in 0.2.0.
|
|
287
|
+
# : (Numeric serial, ?date1904: bool) -> Time
|
|
288
|
+
def self.serial_to_datetime: (Numeric serial, ?date1904: bool) -> Time
|
|
289
|
+
|
|
290
|
+
# Converts a cell reference string (e.g. "A1", "BC100") to 0-based [row, col] coordinates.
|
|
291
|
+
#
|
|
292
|
+
# @example
|
|
293
|
+
# Xlsxrb.parse_ref("A1") #=> [0, 0]
|
|
294
|
+
# Xlsxrb.parse_ref("BC100") #=> [99, 54]
|
|
295
|
+
#
|
|
296
|
+
# @param ref [String, nil] Excel cell reference string.
|
|
297
|
+
# @return [Array(Integer, Integer), nil] 0-based [row, col] tuple, or nil if invalid.
|
|
298
|
+
# @api public
|
|
299
|
+
# : (String? ref) -> [Integer, Integer]?
|
|
300
|
+
def self.parse_ref: (String? ref) -> [ Integer, Integer ]?
|
|
301
|
+
|
|
302
|
+
# Converts 0-based [row, col] coordinates to an A1-style reference string.
|
|
303
|
+
#
|
|
304
|
+
# @example
|
|
305
|
+
# Xlsxrb.cell_to_ref(0, 0) #=> "A1"
|
|
306
|
+
# Xlsxrb.cell_to_ref(99, 54) #=> "BC100"
|
|
307
|
+
#
|
|
308
|
+
# @param row [Integer] 0-based row index.
|
|
309
|
+
# @param column [Integer] 0-based column index.
|
|
310
|
+
# @return [String] A1-style reference string.
|
|
311
|
+
# @api public
|
|
312
|
+
# : (Integer row, Integer column) -> String
|
|
313
|
+
def self.cell_to_ref: (Integer row, Integer column) -> String
|
|
314
|
+
|
|
315
|
+
# Converts a column letter (e.g. "A", :AA) to a 0-based column index.
|
|
316
|
+
#
|
|
317
|
+
# @example
|
|
318
|
+
# Xlsxrb.column_index("A") #=> 0
|
|
319
|
+
# Xlsxrb.column_index(:AA) #=> 26
|
|
320
|
+
#
|
|
321
|
+
# @param col [String, Symbol, Integer] Column letter or integer index.
|
|
322
|
+
# @return [Integer] 0-based column index.
|
|
323
|
+
# @api public
|
|
324
|
+
# : (String | Symbol | Integer col) -> Integer
|
|
325
|
+
def self.column_index: (String | Symbol | Integer col) -> Integer
|
|
326
|
+
|
|
327
|
+
# Converts a 0-based column index to an Excel letter (0 -> "A", 25 -> "Z", 26 -> "AA").
|
|
328
|
+
#
|
|
329
|
+
# @example
|
|
330
|
+
# Xlsxrb.column_letter(0) #=> "A"
|
|
331
|
+
# Xlsxrb.column_letter(26) #=> "AA"
|
|
332
|
+
#
|
|
333
|
+
# @param index [Integer] 0-based column index.
|
|
334
|
+
# @return [String] Excel column letter.
|
|
335
|
+
# @api public
|
|
336
|
+
# : (Integer index) -> String
|
|
337
|
+
def self.column_letter: (Integer index) -> String
|
|
208
338
|
|
|
209
339
|
# Converts a cell range reference string (e.g. "A1:C10", "A1") to 0-based [[top_row, left_col], [bottom_row, right_col]].
|
|
210
340
|
#
|
|
@@ -218,18 +348,59 @@ module Xlsxrb
|
|
|
218
348
|
def self.parse_range: (String? range_ref) -> [ [ Integer, Integer ], [ Integer, Integer ] ]?
|
|
219
349
|
|
|
220
350
|
# Converts 0-based bounding coordinates to an A1-style range reference string.
|
|
351
|
+
# Accepts either 4 flat integers (top_row, left_column, bottom_row, right_column)
|
|
352
|
+
# or a nested pair ([[top_row, left_column], [bottom_row, right_column]]) as returned by parse_range.
|
|
221
353
|
#
|
|
222
|
-
# @example
|
|
354
|
+
# @example 4 flat integers
|
|
223
355
|
# Xlsxrb.range_to_ref(0, 0, 9, 2) #=> "A1:C10"
|
|
224
356
|
#
|
|
225
|
-
# @
|
|
226
|
-
#
|
|
227
|
-
#
|
|
228
|
-
# @param
|
|
229
|
-
# @
|
|
357
|
+
# @example Nested pair from parse_range
|
|
358
|
+
# Xlsxrb.range_to_ref([[0, 0], [9, 2]]) #=> "A1:C10"
|
|
359
|
+
#
|
|
360
|
+
# @param top_row_or_bounds [Integer, Array] 0-based start row index or nested bounding coordinates.
|
|
361
|
+
# @param left_column [Integer, nil] 0-based start column index.
|
|
362
|
+
# @param bottom_row [Integer, nil] 0-based end row index.
|
|
363
|
+
# @param right_column [Integer, nil] 0-based end column index.
|
|
364
|
+
# @return [String] A1-style range reference string.
|
|
365
|
+
# @api public
|
|
366
|
+
# : (Integer | [[Integer, Integer], [Integer, Integer]] top_row_or_bounds, ?Integer? left_column, ?Integer? bottom_row, ?Integer? right_column) -> String
|
|
367
|
+
def self.range_to_ref: (Integer | [ [ Integer, Integer ], [ Integer, Integer ] ] top_row_or_bounds, ?Integer? left_column, ?Integer? bottom_row, ?Integer? right_column) -> String
|
|
368
|
+
|
|
369
|
+
# Splits an A1-style cell reference into its column name and 1-based row number.
|
|
370
|
+
#
|
|
371
|
+
# @example
|
|
372
|
+
# Xlsxrb.split_coordinate("A1") #=> ["A", 1]
|
|
373
|
+
# Xlsxrb.split_coordinate("BC100") #=> ["BC", 100]
|
|
374
|
+
#
|
|
375
|
+
# @param cell_ref [String, nil] Excel cell reference string.
|
|
376
|
+
# @return [Array(String, Integer), nil] [col_name, row_number] tuple (1-based row), or nil if invalid.
|
|
377
|
+
# @api public
|
|
378
|
+
# : (String? cell_ref) -> [String, Integer]?
|
|
379
|
+
def self.split_coordinate: (String? cell_ref) -> [ String, Integer ]?
|
|
380
|
+
|
|
381
|
+
FORMULA_TOKEN_RE: ::Regexp
|
|
382
|
+
|
|
383
|
+
# Expands a formula by shifting relative cell references from a master cell to a target cell or by offset amounts.
|
|
384
|
+
#
|
|
385
|
+
# @example Shift formula down one row
|
|
386
|
+
# Xlsxrb.expand_formula("A2*2", 1, 0) #=> "A3*2"
|
|
387
|
+
# Xlsxrb.expand_formula("A2*2", from_ref: "B2", to_ref: "B3") #=> "A3*2"
|
|
388
|
+
#
|
|
389
|
+
# @example Shift formula with absolute references
|
|
390
|
+
# Xlsxrb.expand_formula("$A$1+A2", 2, 0) #=> "$A$1+A4"
|
|
391
|
+
#
|
|
392
|
+
# @param formula [String, nil] Formula expression to expand.
|
|
393
|
+
# @param offset_row [Integer, nil] Optional row shift amount (positive = down, negative = up).
|
|
394
|
+
# @param offset_col [Integer, nil] Optional column shift amount (positive = right, negative = left).
|
|
395
|
+
# @param from_ref [String, nil] Master cell reference (e.g. "B2").
|
|
396
|
+
# @param to_ref [String, nil] Target cell reference (e.g. "B3").
|
|
397
|
+
# @param row_delta [Integer, nil] Row shift amount (positive = down, negative = up).
|
|
398
|
+
# @param column_delta [Integer, nil] Column shift amount (positive = right, negative = left).
|
|
399
|
+
# @param col_delta [Integer, nil] Deprecated alias for column_delta.
|
|
400
|
+
# @return [String, nil] Expanded formula expression.
|
|
230
401
|
# @api public
|
|
231
|
-
# : (
|
|
232
|
-
def self.
|
|
402
|
+
# : (String? formula, ?Integer? offset_row, ?Integer? offset_col, ?from_ref: String?, ?to_ref: String?, ?row_delta: Integer?, ?column_delta: Integer?, ?col_delta: Integer?) -> String?
|
|
403
|
+
def self.expand_formula: (String? formula, ?Integer? offset_row, ?Integer? offset_col, ?from_ref: String?, ?to_ref: String?, ?row_delta: Integer?, ?column_delta: Integer?, ?col_delta: Integer?) -> String?
|
|
233
404
|
|
|
234
405
|
# Resolves an ECMA-376 indexed color palette index (0..63) to an RRGGBB hex string (or AARRGGBB if alpha: true).
|
|
235
406
|
#
|
|
@@ -259,7 +430,28 @@ module Xlsxrb
|
|
|
259
430
|
# : (Integer | String | Symbol | nil color, ?alpha: bool) -> String?
|
|
260
431
|
def self.to_hex_color: (Integer | String | Symbol | nil color, ?alpha: bool) -> String?
|
|
261
432
|
|
|
262
|
-
|
|
433
|
+
# @deprecated Use {.to_hex_color} instead. Will be removed in 0.2.0.
|
|
434
|
+
# : (Integer | String | Symbol | nil color, ?alpha: bool) -> String?
|
|
435
|
+
def self.color_to_hex: (Integer | String | Symbol | nil color, ?alpha: bool) -> String?
|
|
436
|
+
|
|
437
|
+
# Sanitizes a worksheet name to ensure it conforms to Excel constraints within 31 characters.
|
|
438
|
+
# Replaces forbidden characters (\ / ? * [ ] : and control characters),
|
|
439
|
+
# replaces leading/trailing apostrophes, and replaces reserved 'History' with 'History_'.
|
|
440
|
+
#
|
|
441
|
+
# @example
|
|
442
|
+
# Xlsxrb.sanitize_sheet_name("Sales: 2026") #=> "Sales_ 2026"
|
|
443
|
+
# Xlsxrb.sanitize_sheet_name("'Report'") #=> "_Report_"
|
|
444
|
+
#
|
|
445
|
+
# @param name [Object] Desired worksheet name.
|
|
446
|
+
# @param replace_char [String] Replacement character for invalid characters.
|
|
447
|
+
# @return [String] Excel-compliant worksheet name.
|
|
448
|
+
# @api public
|
|
449
|
+
# : (untyped name, ?replace_char: String) -> String
|
|
450
|
+
def self.sanitize_sheet_name: (untyped name, ?replace_char: String) -> String
|
|
451
|
+
|
|
452
|
+
# @deprecated Use {.sanitize_sheet_name} instead. Will be removed in 0.2.0.
|
|
453
|
+
# : (untyped name, ?replace_char: String) -> String
|
|
454
|
+
def self.sheet_name: (untyped name, ?replace_char: String) -> String
|
|
263
455
|
|
|
264
456
|
# Reads an XLSX file (streaming and lazy-loaded by default) from a file path, IO stream, or binary String.
|
|
265
457
|
#
|
|
@@ -301,6 +493,11 @@ module Xlsxrb
|
|
|
301
493
|
# doc_sheet = sheet.load # explicitly load into memory
|
|
302
494
|
# puts doc_sheet["A1"].value # coordinate random access
|
|
303
495
|
#
|
|
496
|
+
# Reads an XLSX file or IO stream. When called with a block, yields each {StreamSheet}
|
|
497
|
+
# for low-memory streaming iteration. When called without a block, returns an {Elements::Workbook}
|
|
498
|
+
# containing {StreamSheet} instances.
|
|
499
|
+
#
|
|
500
|
+
# @deprecated Calling {Xlsxrb.read} without a block is deprecated; use {Xlsxrb.load} for in-memory random access. Will be removed in 0.2.0.
|
|
304
501
|
# @param max_uncompressed_size [Integer, nil] Maximum allowed uncompressed size in bytes per entry (ZIP bomb defense).
|
|
305
502
|
# @raise [ZipBombError] If an uncompressed entry exceeds max_uncompressed_size.
|
|
306
503
|
# @raise [EncryptedFileError] If the file is encrypted and no password was supplied.
|
|
@@ -312,7 +509,33 @@ module Xlsxrb
|
|
|
312
509
|
def self.read: (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) { (StreamSheet) -> void } -> void
|
|
313
510
|
| (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) -> Elements::Workbook
|
|
314
511
|
|
|
315
|
-
|
|
512
|
+
# Loads all sheets into memory, returning an {Elements::Workbook} where every
|
|
513
|
+
# worksheet is a fully-parsed {Elements::Worksheet} supporting coordinate random access.
|
|
514
|
+
# The underlying zip resources are closed immediately.
|
|
515
|
+
#
|
|
516
|
+
# @example
|
|
517
|
+
# wb = Xlsxrb.load("report.xlsx")
|
|
518
|
+
# puts wb["Sheet1"]["A1"].value
|
|
519
|
+
#
|
|
520
|
+
# @param source [String, IO, StringIO] Path to the .xlsx file or an IO-like stream.
|
|
521
|
+
# @param password [String, nil] Password for decrypting password-protected (ECMA-376 Standard/Agile) workbooks.
|
|
522
|
+
# @param trim_empty_rows [Boolean] Whether to omit trailing empty rows from worksheet data.
|
|
523
|
+
# @param pad_empty_rows [Boolean] Whether to pad missing rows with empty row objects.
|
|
524
|
+
# @param pad_empty_cells [Boolean] Whether to pad missing cells within rows with nil cells.
|
|
525
|
+
# @param max_uncompressed_size [Integer, nil] Maximum uncompressed file size threshold in bytes for zip bomb protection.
|
|
526
|
+
# @return [Elements::Workbook] The fully loaded in-memory workbook.
|
|
527
|
+
# @api public
|
|
528
|
+
# : (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) -> Elements::Workbook
|
|
529
|
+
def self.load: (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) -> Elements::Workbook
|
|
530
|
+
|
|
531
|
+
# Internal reader helper returning a Workbook with StreamSheet instances without deprecation warning.
|
|
532
|
+
# @api private
|
|
533
|
+
# : (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) -> Elements::Workbook
|
|
534
|
+
def self._read_workbook: (untyped source, ?password: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?max_uncompressed_size: Integer?) -> Elements::Workbook
|
|
535
|
+
|
|
536
|
+
# @deprecated Use {.read} instead. Will be removed in 0.2.0.
|
|
537
|
+
# : (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
538
|
+
def self.stream: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
316
539
|
|
|
317
540
|
# Writes an XLSX file or IO stream (streaming or in-memory), or returns a binary string.
|
|
318
541
|
#
|
|
@@ -361,12 +584,42 @@ module Xlsxrb
|
|
|
361
584
|
# binary_data = Xlsxrb.write(workbook)
|
|
362
585
|
#
|
|
363
586
|
# @api public
|
|
364
|
-
#
|
|
365
|
-
#
|
|
366
|
-
#
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
587
|
+
# @param shared_strings [Boolean] Whether to intern strings in a shared strings table (`xl/sharedStrings.xml`).
|
|
588
|
+
# When set to `false`, strings are emitted directly as inline strings (`<c t="inlineStr">`), providing flat
|
|
589
|
+
# $O(1)$ constant memory during streaming write. Disabling shared strings is recommended when streaming
|
|
590
|
+
# large datasets where cells contain unique text (e.g. log exports, transaction details).
|
|
591
|
+
# @param compression_level [Integer, nil] ZIP deflate compression level (0..9, or Zlib::DEFAULT_COMPRESSION).
|
|
592
|
+
# Level 6 is standard. Level 4 accelerates compression by 20-40% with an ~10% size tradeoff,
|
|
593
|
+
# recommended for high-throughput streaming exports. Level 0 disables compression (store only).
|
|
594
|
+
# : (?untyped target_or_workbook, ?Elements::Workbook | untyped workbook_or_nil, ?password: String?, ?encryption_mode: Symbol, ?strict_excel_mode: bool, ?escape_formulas: bool, ?default_font: untyped?, ?shared_strings: bool, ?compression_level: Integer | nil) ?{ (StreamWriter) -> void } -> untyped
|
|
595
|
+
def self.write: (?untyped target_or_workbook, ?Elements::Workbook | untyped workbook_or_nil, ?password: String?, ?encryption_mode: Symbol, ?strict_excel_mode: bool, ?escape_formulas: bool, ?default_font: untyped?, ?shared_strings: bool, ?compression_level: Integer | nil) ?{ (StreamWriter) -> void } -> untyped
|
|
596
|
+
|
|
597
|
+
# Serializes an in-memory workbook to a destination target (path or IO).
|
|
598
|
+
#
|
|
599
|
+
# @deprecated Use {.write} instead. Will be removed in 0.2.0.
|
|
600
|
+
# @param target [String, IO, StringIO] Target destination.
|
|
601
|
+
# @param workbook [Elements::Workbook] The workbook instance to write.
|
|
602
|
+
# @param shared_strings [Boolean] Whether to intern strings into sharedStrings.xml.
|
|
603
|
+
# @param compression_level [Integer, nil] ZIP deflate compression level (0..9).
|
|
604
|
+
# @param password [String, nil] Optional encryption password.
|
|
605
|
+
# @param encryption_mode [Symbol] Encryption algorithm (:standard or :agile).
|
|
606
|
+
# @return [void]
|
|
607
|
+
# @api public
|
|
608
|
+
# : (String | IO | StringIO target, Elements::Workbook workbook, ?shared_strings: bool, ?compression_level: Integer?, ?password: String?, ?encryption_mode: Symbol) -> void
|
|
609
|
+
def self.write_workbook: (String | IO | StringIO target, Elements::Workbook workbook, ?shared_strings: bool, ?compression_level: Integer?, ?password: String?, ?encryption_mode: Symbol) -> void
|
|
610
|
+
|
|
611
|
+
# Serializes an in-memory workbook to a binary XLSX data string.
|
|
612
|
+
#
|
|
613
|
+
# @deprecated Use {.write} instead. Will be removed in 0.2.0.
|
|
614
|
+
# @param workbook [Elements::Workbook] The workbook instance to serialize.
|
|
615
|
+
# @param shared_strings [Boolean] Whether to intern strings into sharedStrings.xml.
|
|
616
|
+
# @param compression_level [Integer, nil] ZIP deflate compression level (0..9).
|
|
617
|
+
# @param password [String, nil] Optional encryption password.
|
|
618
|
+
# @param encryption_mode [Symbol] Encryption algorithm (:standard or :agile).
|
|
619
|
+
# @return [String] Binary XLSX data.
|
|
620
|
+
# @api public
|
|
621
|
+
# : (Elements::Workbook workbook, ?shared_strings: bool, ?compression_level: Integer?, ?password: String?, ?encryption_mode: Symbol) -> String
|
|
622
|
+
def self.workbook_to_data: (Elements::Workbook workbook, ?shared_strings: bool, ?compression_level: Integer?, ?password: String?, ?encryption_mode: Symbol) -> String
|
|
370
623
|
|
|
371
624
|
# Modifies an existing XLSX file in-memory using an immutable transformation block.
|
|
372
625
|
#
|
|
@@ -383,14 +636,16 @@ module Xlsxrb
|
|
|
383
636
|
#
|
|
384
637
|
# @param source [String, IO, StringIO] The source file path or IO object.
|
|
385
638
|
# @param target [String, IO, StringIO, nil] Target file path or IO object (overwrites source if nil).
|
|
386
|
-
# @param password [String, nil] Optional password for encrypted files.
|
|
639
|
+
# @param password [String, nil] Optional password for decrypting encrypted source files.
|
|
640
|
+
# @deprecated Use {Xlsxrb.read} + {Xlsxrb.write} for streaming transformations or {Xlsxrb.write} DSL for report generation. Will be removed in 0.2.0.
|
|
641
|
+
# @param new_password [String, nil] Optional password for encrypting the output file (defaults to password).
|
|
387
642
|
# @yield [workbook]
|
|
388
643
|
# @yieldparam workbook [Elements::Workbook] The loaded workbook.
|
|
389
644
|
# @yieldreturn [Elements::Workbook] The modified workbook.
|
|
390
|
-
# @return [
|
|
645
|
+
# @return [Elements::Workbook] The modified workbook returned by the block.
|
|
391
646
|
# @api public
|
|
392
|
-
# : (untyped source, ?untyped target, ?password: String?) ?{ (Elements::Workbook) -> untyped } ->
|
|
393
|
-
def self.modify: (untyped source, ?untyped target, ?password: String?) ?{ (Elements::Workbook) -> untyped } ->
|
|
647
|
+
# : (untyped source, ?untyped target, ?password: String?, ?new_password: String?, **untyped opts) ?{ (Elements::Workbook) -> untyped } -> untyped
|
|
648
|
+
def self.modify: (untyped source, ?untyped target, ?password: String?, ?new_password: String?, **untyped opts) ?{ (Elements::Workbook) -> untyped } -> untyped
|
|
394
649
|
|
|
395
650
|
# Builds an in-memory {Elements::Workbook} using a declarative DSL.
|
|
396
651
|
#
|
|
@@ -403,12 +658,14 @@ module Xlsxrb
|
|
|
403
658
|
# end
|
|
404
659
|
#
|
|
405
660
|
# @param strict_excel_mode [Boolean] Whether to enforce Microsoft Excel specification limits.
|
|
661
|
+
# @param escape_formulas [Boolean] Whether to treat strings starting with formula prefixes as plain text.
|
|
662
|
+
# @param default_font [Hash, nil] Optional default font options.
|
|
406
663
|
# @yield [builder]
|
|
407
664
|
# @yieldparam builder [Xlsxrb::WorkbookBuilder]
|
|
408
665
|
# @return [Elements::Workbook] The compiled in-memory workbook.
|
|
409
666
|
# @api public
|
|
410
|
-
# : (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
411
|
-
def self.build: (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
667
|
+
# : (?strict_excel_mode: bool, ?escape_formulas: bool, ?default_font: untyped?) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
668
|
+
def self.build: (?strict_excel_mode: bool, ?escape_formulas: bool, ?default_font: untyped?) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
412
669
|
|
|
413
670
|
private def self.resolve_workbook_entry: (untyped zip_reader) -> untyped
|
|
414
671
|
|
|
@@ -422,8 +679,8 @@ module Xlsxrb
|
|
|
422
679
|
|
|
423
680
|
private def self.resolve_part_entry: (untyped zip_reader, untyped rels, untyped rel_type_sub, untyped fallback_name, untyped wb_dir) -> untyped
|
|
424
681
|
|
|
425
|
-
# : (String name, String? sheet_xml, Array[String] shared_strings, untyped styles, ?state: Symbol, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?hyperlinks: Hash[String, untyped]?, ?comments: Array[Hash[Symbol, untyped]]?, ?images: Array[Elements::Image]?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?merged_cells: Array[String]?, ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]]?, ?shapes: Array[Hash[Symbol, untyped]]?, ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped]?, ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped]?, ?print_options: Hash[Symbol, untyped]?, ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped]?, ?sheet_properties: Hash[Symbol, untyped]?, ?sheet_format: Hash[Symbol, untyped]?, ?row_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[Hash[Symbol, untyped]]?, ?cell_watches: Array[String]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?) -> Elements::Worksheet
|
|
426
|
-
private def self.build_worksheet: (String name, String? sheet_xml, Array[String] shared_strings, untyped styles, ?state: Symbol, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?hyperlinks: Hash[String, untyped]?, ?comments: Array[Hash[Symbol, untyped]]?, ?images: Array[Elements::Image]?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?merged_cells: Array[String]?, ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]]?, ?shapes: Array[Hash[Symbol, untyped]]?, ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped]?, ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped]?, ?print_options: Hash[Symbol, untyped]?, ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped]?, ?sheet_properties: Hash[Symbol, untyped]?, ?sheet_format: Hash[Symbol, untyped]?, ?row_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[Hash[Symbol, untyped]]?, ?cell_watches: Array[String]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?) -> Elements::Worksheet
|
|
682
|
+
# : (String name, String? sheet_xml, Array[String] shared_strings, untyped styles, ?state: Symbol, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?hyperlinks: Hash[String, untyped]?, ?comments: Array[Hash[Symbol, untyped]]?, ?images: Array[Elements::Image]?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?merged_cells: Array[String]?, ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]]?, ?shapes: Array[Hash[Symbol, untyped]]?, ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped]?, ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped]?, ?print_options: Hash[Symbol, untyped]?, ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped]?, ?sheet_properties: Hash[Symbol, untyped]?, ?sheet_format: Hash[Symbol, untyped]?, ?row_breaks: Array[untyped]?, ?column_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[Hash[Symbol, untyped]]?, ?cell_watches: Array[String]?, ?ignored_errors: Array[Hash[Symbol, untyped]]?, ?phonetic_properties: Hash[Symbol, untyped]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?, ?sheet_calc_properties: Hash[Symbol, untyped]?, ?sheet_calc_pr: Hash[Symbol, untyped]?, ?background_image: Hash[Symbol, untyped]?, ?threaded_comments: Array[Hash[Symbol, untyped]]?, ?columns: Array[Elements::Column]?, ?pivot_tables: Array[Hash[Symbol, untyped]]?, ?split_pane: Hash[Symbol, untyped]?, ?filter_columns: Hash[Integer, Hash[Symbol, untyped]]?, ?sort_state: Hash[Symbol, untyped]?, ?header_footer_images: (Array[Elements::HeaderFooterImage] | Array[Hash[Symbol, untyped]])?, ?charts: (Array[Elements::Chart] | Array[Hash[Symbol, untyped]])?, ?sparkline_groups: (Array[Elements::SparklineGroup] | Array[Hash[Symbol, untyped]])?, ?print_area: String?, ?print_titles: (Elements::PrintTitles | Hash[Symbol, untyped])?) -> Elements::Worksheet
|
|
683
|
+
private def self.build_worksheet: (String name, String? sheet_xml, Array[String] shared_strings, untyped styles, ?state: Symbol, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?hyperlinks: Hash[String, untyped]?, ?comments: Array[Hash[Symbol, untyped]]?, ?images: Array[Elements::Image]?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?merged_cells: Array[String]?, ?auto_filter: String?, ?tables: Array[Hash[Symbol, untyped]]?, ?shapes: Array[Hash[Symbol, untyped]]?, ?freeze_pane: Hash[Symbol, untyped]?, ?page_setup: Hash[Symbol, untyped]?, ?page_margins: Hash[Symbol, untyped]?, ?header_footer: Hash[Symbol, untyped]?, ?print_options: Hash[Symbol, untyped]?, ?sheet_protection: Hash[Symbol, untyped]?, ?sheet_view: Hash[Symbol, untyped]?, ?sheet_properties: Hash[Symbol, untyped]?, ?sheet_format: Hash[Symbol, untyped]?, ?row_breaks: Array[untyped]?, ?column_breaks: Array[untyped]?, ?col_breaks: Array[untyped]?, ?protected_ranges: Array[Hash[Symbol, untyped]]?, ?cell_watches: Array[String]?, ?ignored_errors: Array[Hash[Symbol, untyped]]?, ?phonetic_properties: Hash[Symbol, untyped]?, ?selection: (Hash[Symbol, untyped] | Array[Hash[Symbol, untyped]])?, ?sheet_calc_properties: Hash[Symbol, untyped]?, ?sheet_calc_pr: Hash[Symbol, untyped]?, ?background_image: Hash[Symbol, untyped]?, ?threaded_comments: Array[Hash[Symbol, untyped]]?, ?columns: Array[Elements::Column]?, ?pivot_tables: Array[Hash[Symbol, untyped]]?, ?split_pane: Hash[Symbol, untyped]?, ?filter_columns: Hash[Integer, Hash[Symbol, untyped]]?, ?sort_state: Hash[Symbol, untyped]?, ?header_footer_images: (Array[Elements::HeaderFooterImage] | Array[Hash[Symbol, untyped]])?, ?charts: (Array[Elements::Chart] | Array[Hash[Symbol, untyped]])?, ?sparkline_groups: (Array[Elements::SparklineGroup] | Array[Hash[Symbol, untyped]])?, ?print_area: String?, ?print_titles: (Elements::PrintTitles | Hash[Symbol, untyped])?) -> Elements::Worksheet
|
|
427
684
|
|
|
428
685
|
# : (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?rels_xml: String?) -> Hash[String, Hash[Symbol, untyped]]
|
|
429
686
|
private def self.resolve_hyperlinks: (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?, ?rels_xml: String?) -> Hash[String, Hash[Symbol, untyped]]
|
|
@@ -434,23 +691,47 @@ module Xlsxrb
|
|
|
434
691
|
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
435
692
|
private def self.resolve_comments: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
436
693
|
|
|
694
|
+
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
695
|
+
private def self.resolve_threaded_comments: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
696
|
+
|
|
697
|
+
# : (?zip_reader: Ooxml::ZipReader?) -> Hash[String, String]
|
|
698
|
+
private def self.resolve_persons_map: (?zip_reader: Ooxml::ZipReader?) -> Hash[String, String]
|
|
699
|
+
|
|
437
700
|
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::Image]
|
|
438
701
|
private def self.resolve_images: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::Image]
|
|
439
702
|
|
|
703
|
+
# : (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Hash[Symbol, untyped]?
|
|
704
|
+
private def self.resolve_background_image: (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Hash[Symbol, untyped]?
|
|
705
|
+
|
|
440
706
|
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
441
707
|
private def self.resolve_tables: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
442
708
|
|
|
443
709
|
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
444
710
|
private def self.resolve_shapes: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
445
711
|
|
|
446
|
-
# : (
|
|
447
|
-
private def self.
|
|
712
|
+
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
713
|
+
private def self.resolve_pivot_tables: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Hash[Symbol, untyped]]
|
|
714
|
+
|
|
715
|
+
# : (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::Chart]
|
|
716
|
+
private def self.resolve_charts: (?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::Chart]
|
|
717
|
+
|
|
718
|
+
# : (String? sheet_xml) -> Array[Elements::SparklineGroup]
|
|
719
|
+
private def self.resolve_sparkline_groups: (String? sheet_xml) -> Array[Elements::SparklineGroup]
|
|
720
|
+
|
|
721
|
+
# : (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::HeaderFooterImage]
|
|
722
|
+
private def self.resolve_header_footer_images: (String? sheet_xml, ?zip_reader: Ooxml::ZipReader?, ?entry_name: String?) -> Array[Elements::HeaderFooterImage]
|
|
448
723
|
|
|
449
|
-
# : (
|
|
450
|
-
private def self.
|
|
724
|
+
# : (Array[untyped]? defined_names, String? sheet_name, Integer? sheet_index) -> String?
|
|
725
|
+
private def self.extract_sheet_print_area: (Array[untyped]? defined_names, String? sheet_name, Integer? sheet_index) -> String?
|
|
451
726
|
|
|
452
|
-
# : (
|
|
453
|
-
private def self.
|
|
727
|
+
# : (Array[untyped]? defined_names, String? sheet_name, Integer? sheet_index) -> Elements::PrintTitles?
|
|
728
|
+
private def self.extract_sheet_print_titles: (Array[untyped]? defined_names, String? sheet_name, Integer? sheet_index) -> Elements::PrintTitles?
|
|
729
|
+
|
|
730
|
+
# : (untyped defined_name, String? sheet_name, Integer? sheet_index) -> bool
|
|
731
|
+
private def self.match_sheet_defined_name?: (untyped defined_name, String? sheet_name, Integer? sheet_index) -> bool
|
|
732
|
+
|
|
733
|
+
# : (untyped raw_row, ?Hash[String, untyped] hyperlinks, ?(Array[untyped] | Hash[String, untyped]) comments, ?Hash[untyped, untyped]? styles, ?date1904: bool, ?threaded_comments: (Array[untyped] | Hash[String, untyped])) -> (Elements::Row | untyped)
|
|
734
|
+
private def self.build_row_from_raw: (untyped raw_row, ?Hash[String, untyped] hyperlinks, ?Array[untyped] | Hash[String, untyped] comments, ?Hash[untyped, untyped]? styles, ?date1904: bool, ?threaded_comments: Array[untyped] | Hash[String, untyped]) -> (Elements::Row | untyped)
|
|
454
735
|
|
|
455
736
|
# : (untyped source, String? password) -> untyped
|
|
456
737
|
private def self.prepare_source_io: (untyped source, String? password) -> untyped
|
|
@@ -475,16 +756,4 @@ module Xlsxrb
|
|
|
475
756
|
|
|
476
757
|
# : (Array[Elements::Row] rows, Array[untyped] shared_strings, Hash[untyped, Integer] sst_index, ?use_sst: bool, ?date1904: bool) -> String
|
|
477
758
|
private def self.serialize_sheet_data_xml: (Array[Elements::Row] rows, Array[untyped] shared_strings, Hash[untyped, Integer] sst_index, ?use_sst: bool, ?date1904: bool) -> String
|
|
478
|
-
|
|
479
|
-
# Builds a raw cell hash from a value for streaming writes.
|
|
480
|
-
#
|
|
481
|
-
# @param row_index [Integer] 0-based row index.
|
|
482
|
-
# @param col_index [Integer] 0-based column index.
|
|
483
|
-
# @param value [Object] Cell value.
|
|
484
|
-
# @param sst [Array<String>] Shared strings array.
|
|
485
|
-
# @param sst_index [Hash{String => Integer}] Shared strings index mapping.
|
|
486
|
-
# @return [Hash{Symbol => Object}] Raw cell hash.
|
|
487
|
-
# @api public
|
|
488
|
-
# : (Integer row_index, Integer col_index, untyped value, Array[String] sst, Hash[String, Integer] sst_index, ?date1904: bool) -> Hash[Symbol, untyped]
|
|
489
|
-
def self.build_raw_cell_from_value: (Integer row_index, Integer col_index, untyped value, Array[String] sst, Hash[String, Integer] sst_index, ?date1904: bool) -> Hash[Symbol, untyped]
|
|
490
759
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xlsxrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- niku
|
|
@@ -61,6 +61,7 @@ files:
|
|
|
61
61
|
- lib/xlsxrb/elements/column.rb
|
|
62
62
|
- lib/xlsxrb/elements/coordinate_access.rb
|
|
63
63
|
- lib/xlsxrb/elements/image.rb
|
|
64
|
+
- lib/xlsxrb/elements/metadata.rb
|
|
64
65
|
- lib/xlsxrb/elements/row.rb
|
|
65
66
|
- lib/xlsxrb/elements/styles.rb
|
|
66
67
|
- lib/xlsxrb/elements/types.rb
|
|
@@ -111,6 +112,7 @@ files:
|
|
|
111
112
|
- sig/generated/xlsxrb/elements/column.rbs
|
|
112
113
|
- sig/generated/xlsxrb/elements/coordinate_access.rbs
|
|
113
114
|
- sig/generated/xlsxrb/elements/image.rbs
|
|
115
|
+
- sig/generated/xlsxrb/elements/metadata.rbs
|
|
114
116
|
- sig/generated/xlsxrb/elements/row.rbs
|
|
115
117
|
- sig/generated/xlsxrb/elements/styles.rbs
|
|
116
118
|
- sig/generated/xlsxrb/elements/types.rbs
|