xlsxrb 0.1.13 → 0.1.15
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 +104 -0
- data/README.md +17 -14
- data/lib/xlsxrb/colors.rb +118 -0
- data/lib/xlsxrb/elements/cell.rb +205 -16
- data/lib/xlsxrb/elements/column.rb +6 -4
- data/lib/xlsxrb/elements/coordinate_access.rb +32 -0
- data/lib/xlsxrb/elements/image.rb +128 -0
- data/lib/xlsxrb/elements/row.rb +206 -9
- data/lib/xlsxrb/elements/styles.rb +157 -0
- data/lib/xlsxrb/elements/types.rb +95 -1
- data/lib/xlsxrb/elements/workbook.rb +121 -4
- data/lib/xlsxrb/elements/worksheet.rb +519 -29
- data/lib/xlsxrb/elements.rb +2 -0
- data/lib/xlsxrb/number_formatter.rb +429 -0
- data/lib/xlsxrb/ooxml/cfb.rb +1 -1
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +7 -5
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +11 -4
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +7 -1
- data/lib/xlsxrb/ooxml/reader.rb +14 -17
- data/lib/xlsxrb/ooxml/shared_strings_parser.rb +7 -1
- data/lib/xlsxrb/ooxml/styles_parser.rb +39 -9
- data/lib/xlsxrb/ooxml/utils.rb +34 -18
- data/lib/xlsxrb/ooxml/workbook_parser.rb +74 -16
- data/lib/xlsxrb/ooxml/workbook_writer.rb +82 -23
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +319 -79
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +263 -66
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +5 -3
- data/lib/xlsxrb/ooxml/writer.rb +14 -0
- data/lib/xlsxrb/ooxml/xml_builder.rb +14 -2
- data/lib/xlsxrb/ooxml/zip_reader.rb +144 -28
- data/lib/xlsxrb/stream_row.rb +243 -16
- data/lib/xlsxrb/stream_sheet.rb +647 -16
- data/lib/xlsxrb/stream_writer.rb +375 -34
- data/lib/xlsxrb/style_builder.rb +308 -22
- data/lib/xlsxrb/utils.rb +211 -0
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +72 -11
- data/lib/xlsxrb/worksheet_builder.rb +738 -24
- data/lib/xlsxrb.rb +1073 -83
- data/sig/generated/xlsxrb/colors.rbs +40 -0
- data/sig/generated/xlsxrb/elements/cell.rbs +113 -8
- data/sig/generated/xlsxrb/elements/column.rbs +3 -2
- data/sig/generated/xlsxrb/elements/coordinate_access.rbs +18 -0
- data/sig/generated/xlsxrb/elements/image.rbs +82 -0
- data/sig/generated/xlsxrb/elements/row.rbs +83 -4
- data/sig/generated/xlsxrb/elements/styles.rbs +79 -0
- data/sig/generated/xlsxrb/elements/types.rbs +43 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +79 -2
- data/sig/generated/xlsxrb/elements/worksheet.rbs +282 -18
- data/sig/generated/xlsxrb/number_formatter.rbs +132 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +6 -0
- data/sig/generated/xlsxrb/ooxml/shared_strings_parser.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +5 -2
- data/sig/generated/xlsxrb/ooxml/utils.rbs +17 -8
- data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +9 -3
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +28 -6
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +13 -3
- data/sig/generated/xlsxrb/ooxml/writer.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +3 -1
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +13 -0
- data/sig/generated/xlsxrb/stream_row.rbs +100 -6
- data/sig/generated/xlsxrb/stream_sheet.rbs +358 -14
- data/sig/generated/xlsxrb/stream_writer.rbs +220 -30
- data/sig/generated/xlsxrb/style_builder.rbs +55 -18
- data/sig/generated/xlsxrb/utils.rbs +151 -0
- data/sig/generated/xlsxrb/workbook_builder.rbs +26 -0
- data/sig/generated/xlsxrb/worksheet_builder.rbs +356 -18
- data/sig/generated/xlsxrb.rbs +223 -27
- metadata +11 -1
|
@@ -75,6 +75,32 @@ module Xlsxrb
|
|
|
75
75
|
# : (?rows: String?, ?cols: String?, ?sheet: String?) -> void
|
|
76
76
|
def print_titles: (?rows: String?, ?cols: String?, ?sheet: String?) -> void
|
|
77
77
|
|
|
78
|
+
# Sets repeating title rows for pagination on the target or active sheet.
|
|
79
|
+
#
|
|
80
|
+
# @example Repeat first row
|
|
81
|
+
# wb.repeat_rows(0)
|
|
82
|
+
#
|
|
83
|
+
# @param first [Integer, String] First row index (0-based) or range string (e.g. "1:2").
|
|
84
|
+
# @param last [Integer, String, nil] Optional last row index (0-based).
|
|
85
|
+
# @param sheet [String, nil] Target sheet name.
|
|
86
|
+
# @return [void]
|
|
87
|
+
# @api public
|
|
88
|
+
# : (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
89
|
+
def repeat_rows: (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
90
|
+
|
|
91
|
+
# Sets repeating title columns for pagination on the target or active sheet.
|
|
92
|
+
#
|
|
93
|
+
# @example Repeat columns A through C
|
|
94
|
+
# wb.repeat_columns("A", "C")
|
|
95
|
+
#
|
|
96
|
+
# @param first [Integer, String] First column index (0-based) or column name/range.
|
|
97
|
+
# @param last [Integer, String, nil] Optional last column index/name.
|
|
98
|
+
# @param sheet [String, nil] Target sheet name.
|
|
99
|
+
# @return [void]
|
|
100
|
+
# @api public
|
|
101
|
+
# : (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
102
|
+
def repeat_columns: (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
103
|
+
|
|
78
104
|
# Sets workbook structure and window protection.
|
|
79
105
|
#
|
|
80
106
|
# @param opts [Hash] Protection options (e.g. lock_structure: true, password: "secret").
|
|
@@ -7,8 +7,11 @@ module Xlsxrb
|
|
|
7
7
|
class WorksheetBuilder
|
|
8
8
|
# @param name [String] The worksheet name.
|
|
9
9
|
# @param strict_excel_mode [Boolean] Whether to enforce Microsoft Excel limits.
|
|
10
|
-
#
|
|
11
|
-
|
|
10
|
+
# @param state [Symbol] Sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
11
|
+
# : (String name, ?strict_excel_mode: bool, ?state: Symbol) -> void
|
|
12
|
+
def initialize: (String name, ?strict_excel_mode: bool, ?state: Symbol) -> void
|
|
13
|
+
|
|
14
|
+
attr_reader name: untyped
|
|
12
15
|
|
|
13
16
|
# Defines or configures a named cell style.
|
|
14
17
|
#
|
|
@@ -38,11 +41,25 @@ module Xlsxrb
|
|
|
38
41
|
# @param hidden [Boolean] Whether the row is hidden.
|
|
39
42
|
# @param custom_height [Boolean] Whether custom row height is enforced.
|
|
40
43
|
# @param outline_level [Integer, nil] Grouping/outline hierarchy level.
|
|
44
|
+
# @param collapsed [Boolean] Whether the row is collapsed.
|
|
41
45
|
# @return [void]
|
|
42
46
|
# @raise [ArgumentError] If limits are exceeded when strict_excel_mode is enabled.
|
|
43
47
|
# @api public
|
|
44
|
-
# : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
|
|
45
|
-
def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
|
|
48
|
+
# : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
49
|
+
def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
50
|
+
|
|
51
|
+
alias add_row row
|
|
52
|
+
|
|
53
|
+
# Appends a row to the worksheet and returns self for chaining.
|
|
54
|
+
#
|
|
55
|
+
# @example
|
|
56
|
+
# sheet << ["A", 1] << ["B", 2]
|
|
57
|
+
#
|
|
58
|
+
# @param values [Array, Hash] Row cell values.
|
|
59
|
+
# @return [self]
|
|
60
|
+
# @api public
|
|
61
|
+
# : (Array[untyped] | Hash[untyped, untyped] values) -> self
|
|
62
|
+
def <<: (Array[untyped] | Hash[untyped, untyped] values) -> self
|
|
46
63
|
|
|
47
64
|
# Sets column formatting and properties for one or multiple columns.
|
|
48
65
|
#
|
|
@@ -54,14 +71,12 @@ module Xlsxrb
|
|
|
54
71
|
#
|
|
55
72
|
# @param index [Integer, String, Range, Array] Column index (0-based), letter ("A"), or range ("A".."D").
|
|
56
73
|
# @param width [Float, Integer, nil] Column width in character units (0 to 255).
|
|
57
|
-
# @param
|
|
58
|
-
# @param custom_width [Boolean] Whether custom width is explicitly set.
|
|
59
|
-
# @param outline_level [Integer, nil] Grouping/outline level.
|
|
74
|
+
# @param style [Integer, Symbol, String, nil] Column style format or index.
|
|
60
75
|
# @return [void]
|
|
61
76
|
# @raise [ArgumentError] If width exceeds 255 in strict mode.
|
|
62
77
|
# @api public
|
|
63
|
-
# : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil) -> void
|
|
64
|
-
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
|
|
78
|
+
# : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?style: (Integer | Symbol | String)?) -> void
|
|
79
|
+
def column: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?style: (Integer | Symbol | String)?) -> void
|
|
65
80
|
|
|
66
81
|
# Adds a chart to the worksheet.
|
|
67
82
|
#
|
|
@@ -82,8 +97,8 @@ module Xlsxrb
|
|
|
82
97
|
# @param location [String, nil] Optional internal sheet location (e.g. "Sheet2!A1").
|
|
83
98
|
# @return [void]
|
|
84
99
|
# @api public
|
|
85
|
-
# : (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
86
|
-
def hyperlink: (String | Integer cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
100
|
+
# : (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
101
|
+
def hyperlink: (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
87
102
|
|
|
88
103
|
# Sets an auto-filter range on the sheet.
|
|
89
104
|
#
|
|
@@ -114,12 +129,13 @@ module Xlsxrb
|
|
|
114
129
|
|
|
115
130
|
# Adds a data validation rule to a cell or range.
|
|
116
131
|
#
|
|
117
|
-
# @param sqref [String] Target cell or range reference (e.g. "B2:B100").
|
|
132
|
+
# @param sqref [String, nil] Target cell or range reference (e.g. "B2:B100").
|
|
118
133
|
# @param opts [Hash] Validation configuration (e.g. type: :list, formula1: '"Option1,Option2"').
|
|
134
|
+
# @yield [data_validation_builder] Optional configuration block.
|
|
119
135
|
# @return [void]
|
|
120
136
|
# @api public
|
|
121
|
-
# : (String sqref, **untyped opts) -> void
|
|
122
|
-
def validate_data: (String sqref, **untyped opts) -> void
|
|
137
|
+
# : (?String? sqref, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
138
|
+
def validate_data: (?String? sqref, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
123
139
|
|
|
124
140
|
# Adds a conditional formatting rule to a cell range.
|
|
125
141
|
#
|
|
@@ -132,16 +148,17 @@ module Xlsxrb
|
|
|
132
148
|
|
|
133
149
|
# Adds an Excel Table (ListObject) to the sheet.
|
|
134
150
|
#
|
|
135
|
-
# @param ref [String] The table range (e.g. "A1:D20").
|
|
136
|
-
# @param columns [Array<String
|
|
151
|
+
# @param ref [String, nil] The table range (e.g. "A1:D20").
|
|
152
|
+
# @param columns [Array<String>, nil] Column header names.
|
|
137
153
|
# @param name [String, nil] Table name identifier.
|
|
138
154
|
# @param display_name [String, nil] Table display name.
|
|
139
155
|
# @param style [String, nil] Built-in table style name (e.g. "TableStyleMedium2").
|
|
140
156
|
# @param opts [Hash] Additional table properties.
|
|
157
|
+
# @yield [table_builder] Optional configuration block.
|
|
141
158
|
# @return [void]
|
|
142
159
|
# @api public
|
|
143
|
-
# : (String ref, columns: Array[String | Hash[Symbol, untyped]]
|
|
144
|
-
def table: (String ref, columns: Array[String | Hash[Symbol, untyped]]
|
|
160
|
+
# : (?String? ref, ?columns: Array[String | Hash[Symbol, untyped]]?, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) ?{ (TableBuilder) -> void } -> void
|
|
161
|
+
def table: (?String? ref, ?columns: Array[String | Hash[Symbol, untyped]]?, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) ?{ (TableBuilder) -> void } -> void
|
|
145
162
|
|
|
146
163
|
# Adds a Pivot Table to the sheet.
|
|
147
164
|
#
|
|
@@ -178,6 +195,26 @@ module Xlsxrb
|
|
|
178
195
|
# : (sparklines: Array[String | Hash[Symbol, untyped]], ?type: (String | Symbol)?, **untyped opts) -> void
|
|
179
196
|
def sparkline_group: (sparklines: Array[String | Hash[Symbol, untyped]], ?type: (String | Symbol)?, **untyped opts) -> void
|
|
180
197
|
|
|
198
|
+
# Adds a single sparkline to the sheet.
|
|
199
|
+
#
|
|
200
|
+
# @example Add a line sparkline
|
|
201
|
+
# sheet.add_sparkline(location: "F1", range: "A1:E1")
|
|
202
|
+
#
|
|
203
|
+
# @example Add a column sparkline with high/low markers
|
|
204
|
+
# sheet.add_sparkline(location: "F2", range: "A2:E2", type: :column, high: true, low: true)
|
|
205
|
+
#
|
|
206
|
+
# @example Add a win/loss sparkline
|
|
207
|
+
# sheet.add_sparkline(location: "F3", range: "A3:E3", type: :win_loss)
|
|
208
|
+
#
|
|
209
|
+
# @param location [String, nil] Target cell for the sparkline (e.g. "F1").
|
|
210
|
+
# @param range [String, nil] Data range for the sparkline (e.g. "A1:E1").
|
|
211
|
+
# @param type [Symbol, String, nil] Sparkline type (:line, :column, :win_loss / :stacked).
|
|
212
|
+
# @param opts [Hash] Additional sparkline options.
|
|
213
|
+
# @return [void]
|
|
214
|
+
# @api public
|
|
215
|
+
# : (?location: String?, ?range: String?, ?type: (String | Symbol)?, **untyped opts) -> void
|
|
216
|
+
def add_sparkline: (?location: String?, ?range: String?, ?type: (String | Symbol)?, **untyped opts) -> void
|
|
217
|
+
|
|
181
218
|
# Merges a range of cells into a single cell.
|
|
182
219
|
#
|
|
183
220
|
# @example Merge with string range
|
|
@@ -264,6 +301,67 @@ module Xlsxrb
|
|
|
264
301
|
# : (Symbol name, untyped value) -> void
|
|
265
302
|
def print_options: (Symbol name, untyped value) -> void
|
|
266
303
|
|
|
304
|
+
# Sets or gets the print area for the worksheet.
|
|
305
|
+
#
|
|
306
|
+
# @example Set print area range
|
|
307
|
+
# sheet.print_area("A1:H50")
|
|
308
|
+
#
|
|
309
|
+
# @example Get print area range
|
|
310
|
+
# sheet.print_area #=> "A1:H50"
|
|
311
|
+
#
|
|
312
|
+
# @param range [String, nil] Cell range (e.g. "A1:H50").
|
|
313
|
+
# @return [String, nil]
|
|
314
|
+
# @api public
|
|
315
|
+
# : (?String? range) -> String?
|
|
316
|
+
def print_area: (?String? range) -> String?
|
|
317
|
+
|
|
318
|
+
# Sets or gets repeating print titles (rows and/or columns) for pagination.
|
|
319
|
+
#
|
|
320
|
+
# @example Set repeating header rows
|
|
321
|
+
# sheet.print_titles(rows: "1:2")
|
|
322
|
+
#
|
|
323
|
+
# @example Get repeating print titles
|
|
324
|
+
# sheet.print_titles #=> { rows: "1:2", cols: nil }
|
|
325
|
+
#
|
|
326
|
+
# @param rows [String, nil] Repeating row range (e.g. "1:2").
|
|
327
|
+
# @param cols [String, nil] Repeating column range (e.g. "A:B").
|
|
328
|
+
# @return [Hash, nil]
|
|
329
|
+
# @api public
|
|
330
|
+
# : (?rows: String?, ?cols: String?) -> Hash[Symbol, untyped]?
|
|
331
|
+
def print_titles: (?rows: String?, ?cols: String?) -> Hash[Symbol, untyped]?
|
|
332
|
+
|
|
333
|
+
# Sets repeating title rows to appear at the top of each printed page.
|
|
334
|
+
# Accepts 0-indexed row numbers (WriteXLSX / xlsxrb convention) or Excel range string ("1:2").
|
|
335
|
+
#
|
|
336
|
+
# @example Repeat first row
|
|
337
|
+
# sheet.repeat_rows(0)
|
|
338
|
+
#
|
|
339
|
+
# @example Repeat rows 1 through 3
|
|
340
|
+
# sheet.repeat_rows(0, 2)
|
|
341
|
+
#
|
|
342
|
+
# @param first [Integer, String] First row index (0-based) or range string (e.g. "1:2").
|
|
343
|
+
# @param last [Integer, String, nil] Optional last row index (0-based, defaults to first).
|
|
344
|
+
# @return [void]
|
|
345
|
+
# @api public
|
|
346
|
+
# : (Integer | String first, ?(Integer | String)? last) -> void
|
|
347
|
+
def repeat_rows: (Integer | String first, ?(Integer | String)? last) -> void
|
|
348
|
+
|
|
349
|
+
# Sets repeating title columns to appear at the left of each printed page.
|
|
350
|
+
# Accepts 0-indexed column numbers (0 => "A"), column names ("A", "B"), or range string ("A:B").
|
|
351
|
+
#
|
|
352
|
+
# @example Repeat column A
|
|
353
|
+
# sheet.repeat_columns(0)
|
|
354
|
+
#
|
|
355
|
+
# @example Repeat columns A through C
|
|
356
|
+
# sheet.repeat_columns("A", "C")
|
|
357
|
+
#
|
|
358
|
+
# @param first [Integer, String] First column index (0-based) or column name/range.
|
|
359
|
+
# @param last [Integer, String, nil] Optional last column index/name (defaults to first).
|
|
360
|
+
# @return [void]
|
|
361
|
+
# @api public
|
|
362
|
+
# : (Integer | String first, ?(Integer | String)? last) -> void
|
|
363
|
+
def repeat_columns: (Integer | String first, ?(Integer | String)? last) -> void
|
|
364
|
+
|
|
267
365
|
# Sets sheet-level protection with optional password hashing.
|
|
268
366
|
#
|
|
269
367
|
# @param opts [Hash] Protection options (e.g. password: "secret", select_locked_cells: true).
|
|
@@ -318,6 +416,22 @@ module Xlsxrb
|
|
|
318
416
|
# : (Symbol name, untyped value) -> void
|
|
319
417
|
def sheet_view: (Symbol name, untyped value) -> void
|
|
320
418
|
|
|
419
|
+
# Configures sheet format properties (e.g. default_row_height, default_col_width).
|
|
420
|
+
#
|
|
421
|
+
# @example Using keyword arguments
|
|
422
|
+
# sheet.sheet_format(default_row_height: 24, default_col_width: 15)
|
|
423
|
+
#
|
|
424
|
+
# @example Using property name and value
|
|
425
|
+
# sheet.sheet_format(:default_row_height, 24)
|
|
426
|
+
#
|
|
427
|
+
# @param name [Symbol, String, Hash, nil] Property name or hash of properties.
|
|
428
|
+
# @param value [Object, nil] Property value when name is provided.
|
|
429
|
+
# @param opts [Hash] Keyword arguments for sheet format properties.
|
|
430
|
+
# @return [Hash]
|
|
431
|
+
# @api public
|
|
432
|
+
# : (?Symbol | String | Hash[Symbol, untyped] | nil name, ?untyped value, **untyped opts) -> Hash[Symbol, untyped]
|
|
433
|
+
def sheet_format: (?Symbol | String | Hash[Symbol, untyped] | nil name, ?untyped value, **untyped opts) -> Hash[Symbol, untyped]
|
|
434
|
+
|
|
321
435
|
# Inserts a horizontal page break before the specified row.
|
|
322
436
|
#
|
|
323
437
|
# @param row_num [Integer] 1-based row number.
|
|
@@ -334,6 +448,29 @@ module Xlsxrb
|
|
|
334
448
|
# : (Integer | String col_index) -> void
|
|
335
449
|
def page_break_col: (Integer | String col_index) -> void
|
|
336
450
|
|
|
451
|
+
# Adds a protected range to the worksheet.
|
|
452
|
+
#
|
|
453
|
+
# @param name [String] Name of the protected range.
|
|
454
|
+
# @param sqref [String] Cell range (e.g. "A1:B10").
|
|
455
|
+
# @param password [String, nil] Optional password or hash.
|
|
456
|
+
# @param opts [Hash] Additional options.
|
|
457
|
+
# @return [void]
|
|
458
|
+
# @api public
|
|
459
|
+
# : (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
460
|
+
def protected_range: (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
461
|
+
|
|
462
|
+
alias add_protected_range protected_range
|
|
463
|
+
|
|
464
|
+
# Adds a cell watch to the worksheet.
|
|
465
|
+
#
|
|
466
|
+
# @param ref [String] Cell reference (e.g. "A1").
|
|
467
|
+
# @return [void]
|
|
468
|
+
# @api public
|
|
469
|
+
# : (String ref) -> void
|
|
470
|
+
def cell_watch: (String ref) -> void
|
|
471
|
+
|
|
472
|
+
alias add_cell_watch cell_watch
|
|
473
|
+
|
|
337
474
|
# Builds and returns the in-memory {Elements::Worksheet}.
|
|
338
475
|
#
|
|
339
476
|
# @return [Elements::Worksheet]
|
|
@@ -346,4 +483,205 @@ module Xlsxrb
|
|
|
346
483
|
# : Hash[String, StyleBuilder]
|
|
347
484
|
attr_reader styles: untyped
|
|
348
485
|
end
|
|
486
|
+
|
|
487
|
+
# Builder context for configuring an Excel Table (ListObject) in block form.
|
|
488
|
+
#
|
|
489
|
+
# @api public
|
|
490
|
+
class TableBuilder
|
|
491
|
+
# @param ref [String, nil] Table range (e.g. "A1:D10").
|
|
492
|
+
# @param columns [Array, nil] Column header names or definition hashes.
|
|
493
|
+
# @param name [String, nil] Table name identifier.
|
|
494
|
+
# @param display_name [String, nil] Table display name.
|
|
495
|
+
# @param style [String, nil] Built-in table style name (e.g. "TableStyleMedium2").
|
|
496
|
+
# @param opts [Hash] Additional table properties.
|
|
497
|
+
# : (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
498
|
+
def initialize: (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
499
|
+
|
|
500
|
+
# : (untyped key) -> untyped
|
|
501
|
+
def []: (untyped key) -> untyped
|
|
502
|
+
|
|
503
|
+
# : (untyped key, untyped value) -> untyped
|
|
504
|
+
def []=: (untyped key, untyped value) -> untyped
|
|
505
|
+
|
|
506
|
+
# : (?String? val) -> String?
|
|
507
|
+
def ref: (?String? val) -> String?
|
|
508
|
+
|
|
509
|
+
# : (String val) -> String
|
|
510
|
+
def ref=: (String val) -> String
|
|
511
|
+
|
|
512
|
+
# : (*untyped cols) -> untyped
|
|
513
|
+
def columns: (*untyped cols) -> untyped
|
|
514
|
+
|
|
515
|
+
# : (untyped cols) -> untyped
|
|
516
|
+
def columns=: (untyped cols) -> untyped
|
|
517
|
+
|
|
518
|
+
# Appends a single column name or column definition.
|
|
519
|
+
#
|
|
520
|
+
# @param col [String, Hash] Column header name or definition.
|
|
521
|
+
# @return [void]
|
|
522
|
+
# : (String | Hash[Symbol, untyped] col) -> void
|
|
523
|
+
def column: (String | Hash[Symbol, untyped] col) -> void
|
|
524
|
+
|
|
525
|
+
alias add_column column
|
|
526
|
+
|
|
527
|
+
# : (?String? val) -> String?
|
|
528
|
+
def name: (?String? val) -> String?
|
|
529
|
+
|
|
530
|
+
# : (String val) -> String
|
|
531
|
+
def name=: (String val) -> String
|
|
532
|
+
|
|
533
|
+
# : (?String? val) -> String?
|
|
534
|
+
def display_name: (?String? val) -> String?
|
|
535
|
+
|
|
536
|
+
# : (String val) -> String
|
|
537
|
+
def display_name=: (String val) -> String
|
|
538
|
+
|
|
539
|
+
# : (?String? val) -> String?
|
|
540
|
+
def style: (?String? val) -> String?
|
|
541
|
+
|
|
542
|
+
# : (String val) -> String
|
|
543
|
+
def style=: (String val) -> String
|
|
544
|
+
|
|
545
|
+
# : (?bool? val) -> bool?
|
|
546
|
+
def show_row_stripes: (?bool? val) -> bool?
|
|
547
|
+
|
|
548
|
+
# : (bool val) -> bool
|
|
549
|
+
def show_row_stripes=: (bool val) -> bool
|
|
550
|
+
|
|
551
|
+
# : (?bool? val) -> bool?
|
|
552
|
+
def show_column_stripes: (?bool? val) -> bool?
|
|
553
|
+
|
|
554
|
+
# : (bool val) -> bool
|
|
555
|
+
def show_column_stripes=: (bool val) -> bool
|
|
556
|
+
|
|
557
|
+
# : (?bool? val) -> bool?
|
|
558
|
+
def show_first_column: (?bool? val) -> bool?
|
|
559
|
+
|
|
560
|
+
# : (bool val) -> bool
|
|
561
|
+
def show_first_column=: (bool val) -> bool
|
|
562
|
+
|
|
563
|
+
# : (?bool? val) -> bool?
|
|
564
|
+
def show_last_column: (?bool? val) -> bool?
|
|
565
|
+
|
|
566
|
+
# : (bool val) -> bool
|
|
567
|
+
def show_last_column=: (bool val) -> bool
|
|
568
|
+
|
|
569
|
+
# : (?Integer? val) -> Integer?
|
|
570
|
+
def total_row_count: (?Integer? val) -> Integer?
|
|
571
|
+
|
|
572
|
+
# : (Integer val) -> Integer
|
|
573
|
+
def total_row_count=: (Integer val) -> Integer
|
|
574
|
+
|
|
575
|
+
# : () -> Hash[Symbol, untyped]
|
|
576
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
# Builder context for configuring data validation rules in block form.
|
|
580
|
+
#
|
|
581
|
+
# @api public
|
|
582
|
+
class DataValidationBuilder
|
|
583
|
+
# @param sqref [String, nil] Target cell or range reference.
|
|
584
|
+
# @param opts [Hash] Additional validation properties.
|
|
585
|
+
# : (?String? sqref, **untyped opts) -> void
|
|
586
|
+
def initialize: (?String? sqref, **untyped opts) -> void
|
|
587
|
+
|
|
588
|
+
# : (untyped key) -> untyped
|
|
589
|
+
def []: (untyped key) -> untyped
|
|
590
|
+
|
|
591
|
+
# : (untyped key, untyped value) -> untyped
|
|
592
|
+
def []=: (untyped key, untyped value) -> untyped
|
|
593
|
+
|
|
594
|
+
# : (?String? val) -> String?
|
|
595
|
+
def sqref: (?String? val) -> String?
|
|
596
|
+
|
|
597
|
+
# : (String val) -> String
|
|
598
|
+
def sqref=: (String val) -> String
|
|
599
|
+
|
|
600
|
+
alias range sqref
|
|
601
|
+
|
|
602
|
+
alias range= sqref=
|
|
603
|
+
|
|
604
|
+
# : (?untyped val) -> untyped
|
|
605
|
+
def type: (?untyped val) -> untyped
|
|
606
|
+
|
|
607
|
+
# : (untyped val) -> untyped
|
|
608
|
+
def type=: (untyped val) -> untyped
|
|
609
|
+
|
|
610
|
+
# : (?untyped val) -> untyped
|
|
611
|
+
def operator: (?untyped val) -> untyped
|
|
612
|
+
|
|
613
|
+
# : (untyped val) -> untyped
|
|
614
|
+
def operator=: (untyped val) -> untyped
|
|
615
|
+
|
|
616
|
+
# : (?untyped val) -> untyped
|
|
617
|
+
def formula1: (?untyped val) -> untyped
|
|
618
|
+
|
|
619
|
+
# : (untyped val) -> untyped
|
|
620
|
+
def formula1=: (untyped val) -> untyped
|
|
621
|
+
|
|
622
|
+
# : (?untyped val) -> untyped
|
|
623
|
+
def formula2: (?untyped val) -> untyped
|
|
624
|
+
|
|
625
|
+
# : (untyped val) -> untyped
|
|
626
|
+
def formula2=: (untyped val) -> untyped
|
|
627
|
+
|
|
628
|
+
# : (?bool? val) -> bool?
|
|
629
|
+
def allow_blank: (?bool? val) -> bool?
|
|
630
|
+
|
|
631
|
+
# : (bool val) -> bool
|
|
632
|
+
def allow_blank=: (bool val) -> bool
|
|
633
|
+
|
|
634
|
+
# : (?bool? val) -> bool?
|
|
635
|
+
def show_input_message: (?bool? val) -> bool?
|
|
636
|
+
|
|
637
|
+
# : (bool val) -> bool
|
|
638
|
+
def show_input_message=: (bool val) -> bool
|
|
639
|
+
|
|
640
|
+
# : (?bool? val) -> bool?
|
|
641
|
+
def show_error_message: (?bool? val) -> bool?
|
|
642
|
+
|
|
643
|
+
# : (bool val) -> bool
|
|
644
|
+
def show_error_message=: (bool val) -> bool
|
|
645
|
+
|
|
646
|
+
# : (?String? val) -> String?
|
|
647
|
+
def error_title: (?String? val) -> String?
|
|
648
|
+
|
|
649
|
+
# : (String val) -> String
|
|
650
|
+
def error_title=: (String val) -> String
|
|
651
|
+
|
|
652
|
+
# : (?String? val) -> String?
|
|
653
|
+
def error_message: (?String? val) -> String?
|
|
654
|
+
|
|
655
|
+
# : (String val) -> String
|
|
656
|
+
def error_message=: (String val) -> String
|
|
657
|
+
|
|
658
|
+
alias error error_message
|
|
659
|
+
|
|
660
|
+
alias error= error_message=
|
|
661
|
+
|
|
662
|
+
# : (?String? val) -> String?
|
|
663
|
+
def prompt_title: (?String? val) -> String?
|
|
664
|
+
|
|
665
|
+
# : (String val) -> String
|
|
666
|
+
def prompt_title=: (String val) -> String
|
|
667
|
+
|
|
668
|
+
# : (?String? val) -> String?
|
|
669
|
+
def prompt_message: (?String? val) -> String?
|
|
670
|
+
|
|
671
|
+
# : (String val) -> String
|
|
672
|
+
def prompt_message=: (String val) -> String
|
|
673
|
+
|
|
674
|
+
alias prompt prompt_message
|
|
675
|
+
|
|
676
|
+
alias prompt= prompt_message=
|
|
677
|
+
|
|
678
|
+
# : (?untyped val) -> untyped
|
|
679
|
+
def error_style: (?untyped val) -> untyped
|
|
680
|
+
|
|
681
|
+
# : (untyped val) -> untyped
|
|
682
|
+
def error_style=: (untyped val) -> untyped
|
|
683
|
+
|
|
684
|
+
# : () -> Hash[Symbol, untyped]
|
|
685
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
686
|
+
end
|
|
349
687
|
end
|