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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +256 -1
- data/README.md +111 -28
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +439 -139
- data/lib/xlsxrb/chart_builder.rb +540 -193
- data/lib/xlsxrb/dsl_helpers.rb +178 -73
- data/lib/xlsxrb/elements/cell.rb +197 -130
- data/lib/xlsxrb/elements/column.rb +88 -7
- data/lib/xlsxrb/elements/coordinate_access.rb +86 -59
- data/lib/xlsxrb/elements/image.rb +18 -19
- data/lib/xlsxrb/elements/metadata.rb +2379 -0
- data/lib/xlsxrb/elements/row.rb +84 -118
- data/lib/xlsxrb/elements/styles.rb +140 -90
- data/lib/xlsxrb/elements/types.rb +164 -22
- data/lib/xlsxrb/elements/workbook.rb +122 -140
- data/lib/xlsxrb/elements/worksheet.rb +451 -226
- data/lib/xlsxrb/elements.rb +1 -0
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +16 -5
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +14 -9
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +296 -34
- data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
- data/lib/xlsxrb/ooxml/reader.rb +52 -50
- data/lib/xlsxrb/ooxml/styles_parser.rb +36 -5
- data/lib/xlsxrb/ooxml/utils.rb +2 -2
- data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
- data/lib/xlsxrb/ooxml/workbook_writer.rb +242 -109
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +63 -31
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +119 -56
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +33 -13
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +75 -15
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +18 -8
- data/lib/xlsxrb/ooxml/writer.rb +124 -44
- data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
- data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
- data/lib/xlsxrb/ooxml/zip_reader.rb +112 -25
- data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
- data/lib/xlsxrb/stream_row.rb +56 -81
- data/lib/xlsxrb/stream_sheet.rb +542 -273
- data/lib/xlsxrb/stream_writer.rb +1536 -870
- data/lib/xlsxrb/style_builder.rb +667 -221
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +406 -143
- data/lib/xlsxrb/worksheet_builder.rb +1009 -900
- data/lib/xlsxrb.rb +1179 -1056
- data/sig/generated/xlsxrb/chart_builder.rbs +385 -159
- data/sig/generated/xlsxrb/dsl_helpers.rbs +81 -15
- data/sig/generated/xlsxrb/elements/cell.rbs +78 -70
- data/sig/generated/xlsxrb/elements/column.rbs +55 -3
- data/sig/generated/xlsxrb/elements/coordinate_access.rbs +35 -29
- data/sig/generated/xlsxrb/elements/image.rbs +7 -11
- data/sig/generated/xlsxrb/elements/metadata.rbs +1574 -0
- data/sig/generated/xlsxrb/elements/row.rbs +39 -42
- data/sig/generated/xlsxrb/elements/styles.rbs +66 -66
- data/sig/generated/xlsxrb/elements/types.rbs +27 -0
- data/sig/generated/xlsxrb/elements/workbook.rbs +46 -99
- data/sig/generated/xlsxrb/elements/worksheet.rbs +121 -96
- data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -4
- data/sig/generated/xlsxrb/ooxml/reader.rbs +2 -2
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/utils.rbs +3 -3
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +13 -1
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +6 -4
- data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +7 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +22 -13
- data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
- data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +24 -9
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
- data/sig/generated/xlsxrb/stream_row.rbs +32 -33
- data/sig/generated/xlsxrb/stream_sheet.rbs +233 -181
- data/sig/generated/xlsxrb/stream_writer.rbs +961 -667
- data/sig/generated/xlsxrb/style_builder.rbs +402 -128
- data/sig/generated/xlsxrb/workbook_builder.rbs +223 -71
- data/sig/generated/xlsxrb/worksheet_builder.rbs +579 -453
- data/sig/generated/xlsxrb.rbs +205 -144
- data/sig/rexml.rbs +8 -0
- metadata +5 -5
- data/lib/xlsxrb/utils.rb +0 -291
- data/sig/generated/xlsxrb/utils.rbs +0 -184
|
@@ -13,92 +13,95 @@ module Xlsxrb
|
|
|
13
13
|
#
|
|
14
14
|
# @api public
|
|
15
15
|
class StreamWriter
|
|
16
|
+
OMITTED: untyped
|
|
17
|
+
|
|
16
18
|
# @return [String, nil] Name of the currently active worksheet.
|
|
19
|
+
# @api private
|
|
17
20
|
# : String?
|
|
18
21
|
attr_reader current_sheet: untyped
|
|
19
22
|
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# @
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
alias shared_strings? shared_strings
|
|
23
|
+
# Returns whether the shared strings table is enabled.
|
|
24
|
+
#
|
|
25
|
+
# @return [Boolean]
|
|
26
|
+
# @api public
|
|
27
|
+
# : () -> bool
|
|
28
|
+
def shared_strings?: () -> bool
|
|
27
29
|
|
|
28
30
|
# @return [Integer] The ZIP deflate compression level (0..9).
|
|
31
|
+
# : Integer
|
|
29
32
|
attr_reader compression_level: untyped
|
|
30
33
|
|
|
34
|
+
# @return [Hash{String => StyleBuilder}]
|
|
35
|
+
# : Hash[String, StyleBuilder]
|
|
36
|
+
attr_reader styles: untyped
|
|
37
|
+
|
|
31
38
|
# Initializes a streaming writer context.
|
|
32
39
|
#
|
|
33
40
|
# @param target [String, IO, StringIO] Destination file path or writable IO stream.
|
|
34
41
|
# @param strict_excel_mode [Boolean] Whether to enforce Microsoft Excel specification limits.
|
|
35
|
-
# @param escape_formulas [Boolean] Whether to treat strings starting with formula prefixes as plain text.
|
|
36
42
|
# @param default_font [Hash, nil] Optional default font options (e.g. `{ name: "Arial", size: 12 }`).
|
|
37
43
|
# @param shared_strings [Boolean] Whether to intern strings into a shared strings table (`xl/sharedStrings.xml`).
|
|
38
44
|
# When set to `false`, strings are written directly as inline strings (`<c t="inlineStr">`), maintaining flat
|
|
39
45
|
# $O(1)$ constant memory regardless of row count or unique string cardinality. Note that disabling shared strings
|
|
40
46
|
# may slightly increase archive size (typically 3-5%) on datasets with high repetition.
|
|
41
|
-
# @param compression_level [Integer, nil] ZIP deflate compression level (0..9, or Zlib::DEFAULT_COMPRESSION
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
# : (untyped target, ?strict_excel_mode: bool, ?
|
|
45
|
-
def initialize: (untyped target, ?strict_excel_mode: bool, ?
|
|
47
|
+
# @param compression_level [Integer, nil] ZIP deflate compression level (0..9, or Zlib::DEFAULT_COMPRESSION
|
|
48
|
+
# for zlib's level 6). Defaults to {Xlsxrb::DEFAULT_COMPRESSION_LEVEL}. Higher levels write smaller files more slowly;
|
|
49
|
+
# level 0 stores entries without compression. See docs/adr/0009-default-zip-compression-level.md.
|
|
50
|
+
# : (untyped target, ?strict_excel_mode: bool, ?default_font: untyped?, ?shared_strings: bool, ?compression_level: Integer | nil) -> void
|
|
51
|
+
def initialize: (untyped target, ?strict_excel_mode: bool, ?default_font: untyped?, ?shared_strings: bool, ?compression_level: Integer | nil) -> void
|
|
46
52
|
|
|
47
53
|
# Gets or sets the active worksheet tab in the workbook window.
|
|
48
54
|
#
|
|
49
55
|
# @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
|
|
50
56
|
# @return [String, Symbol, Integer, nil]
|
|
51
57
|
# @api public
|
|
52
|
-
#
|
|
53
|
-
def active_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
54
|
-
|
|
55
|
-
alias active_sheet= active_sheet
|
|
56
|
-
|
|
57
|
-
alias active_tab active_sheet
|
|
58
|
-
|
|
59
|
-
alias active_tab= active_sheet
|
|
60
|
-
|
|
61
|
-
# Gets or sets the first sheet tab visible in the sheet tab scroll area.
|
|
62
|
-
#
|
|
63
|
-
# @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
|
|
58
|
+
# Active worksheet tab in the workbook window.
|
|
64
59
|
# @return [String, Symbol, Integer, nil]
|
|
65
60
|
# @api public
|
|
66
|
-
|
|
67
|
-
def first_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
61
|
+
attr_accessor active_sheet: String | Symbol | Integer | nil
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
# First sheet tab visible in the sheet tab scroll area.
|
|
64
|
+
# @return [String, Symbol, Integer, nil]
|
|
65
|
+
# @api public
|
|
66
|
+
attr_accessor first_sheet: String | Symbol | Integer | nil
|
|
70
67
|
|
|
71
|
-
#
|
|
72
|
-
#
|
|
68
|
+
# Sets whether sheet tabs are visible in the workbook window.
|
|
73
69
|
# @param visible [Boolean, nil]
|
|
74
70
|
# @return [Boolean, nil]
|
|
75
71
|
# @api public
|
|
76
|
-
|
|
77
|
-
def show_sheet_tabs: (?bool? visible) -> bool?
|
|
72
|
+
attr_writer show_sheet_tabs: untyped
|
|
78
73
|
|
|
79
|
-
|
|
74
|
+
# Returns whether sheet tabs are visible in the workbook window.
|
|
75
|
+
# @return [Boolean]
|
|
76
|
+
# @api public
|
|
77
|
+
# : () -> bool
|
|
78
|
+
def show_sheet_tabs?: () -> bool
|
|
80
79
|
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
# @param ratio [Integer, nil]
|
|
80
|
+
# Ratio between the sheet tabs bar and the horizontal scroll bar (0-1000).
|
|
84
81
|
# @return [Integer, nil]
|
|
85
82
|
# @api public
|
|
86
|
-
|
|
87
|
-
def tab_ratio: (?Integer? ratio) -> Integer?
|
|
88
|
-
|
|
89
|
-
alias tab_ratio= tab_ratio
|
|
83
|
+
attr_accessor tab_ratio: Integer?
|
|
90
84
|
|
|
91
|
-
#
|
|
85
|
+
# Configures or queries workbook-level properties.
|
|
92
86
|
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
# when they open the generated Excel file. Ensure you fully trust the exported data.
|
|
87
|
+
# When called with no arguments, returns the {Elements::WorkbookProperties} value object.
|
|
88
|
+
# When called with keyword options, configures properties and returns nil.
|
|
96
89
|
#
|
|
97
|
-
# @param
|
|
98
|
-
# @
|
|
90
|
+
# @param opts [Hash] Workbook properties map.
|
|
91
|
+
# @return [Elements::WorkbookProperties, void]
|
|
92
|
+
# @api public
|
|
93
|
+
# : () -> Elements::WorkbookProperties
|
|
94
|
+
# : (**untyped opts) -> void
|
|
95
|
+
def workbook_properties: () -> Elements::WorkbookProperties
|
|
96
|
+
| (**untyped opts) -> void
|
|
97
|
+
|
|
98
|
+
# Sets workbook-level properties.
|
|
99
|
+
#
|
|
100
|
+
# @param props [Hash, Elements::MetadataRecord]
|
|
99
101
|
# @return [void]
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
+
# @api public
|
|
103
|
+
# : (untyped props) -> void
|
|
104
|
+
def workbook_properties=: (untyped props) -> void
|
|
102
105
|
|
|
103
106
|
# Defines or configures a named cell style.
|
|
104
107
|
#
|
|
@@ -120,7 +123,30 @@ module Xlsxrb
|
|
|
120
123
|
# : (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
|
|
121
124
|
def default_font: (?String | Hash[Symbol, untyped]? name, ?Float | Integer | nil size, **untyped opts) -> void
|
|
122
125
|
|
|
123
|
-
|
|
126
|
+
# Creates an {Elements::Formula} object.
|
|
127
|
+
# @api public
|
|
128
|
+
# : (String expression, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
|
|
129
|
+
def formula: (String expression, ?cached_value: String | Numeric | bool | Elements::CellError | nil, ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
|
|
130
|
+
|
|
131
|
+
# Creates an array or dynamic array {Elements::Formula} object.
|
|
132
|
+
# @api public
|
|
133
|
+
# : (String expression, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), **untyped attrs) -> Elements::Formula
|
|
134
|
+
def array_formula: (String expression, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil, **untyped attrs) -> Elements::Formula
|
|
135
|
+
|
|
136
|
+
# Creates a shared formula {Elements::Formula} object.
|
|
137
|
+
# @api public
|
|
138
|
+
# : (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil)) -> Elements::Formula
|
|
139
|
+
def shared_formula: (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil) -> Elements::Formula
|
|
140
|
+
|
|
141
|
+
# Creates an {Elements::RichText} object.
|
|
142
|
+
# @api public
|
|
143
|
+
# : (*(Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped) runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
144
|
+
def rich_text: (*Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
145
|
+
|
|
146
|
+
# Creates or returns an {Elements::CellError} object.
|
|
147
|
+
# @api public
|
|
148
|
+
# : (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
149
|
+
def cell_error: (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
124
150
|
|
|
125
151
|
# Proxy object yielded by the `sheet` method to prevent writing to inactive sheets in streaming mode.
|
|
126
152
|
#
|
|
@@ -130,24 +156,37 @@ module Xlsxrb
|
|
|
130
156
|
# @param sheet_name [String]
|
|
131
157
|
def initialize: (untyped writer, untyped sheet_name) -> untyped
|
|
132
158
|
|
|
133
|
-
#
|
|
159
|
+
# Returns the worksheet name.
|
|
134
160
|
#
|
|
135
|
-
# @
|
|
136
|
-
# @param size [Float, Integer, nil] Font size in points.
|
|
137
|
-
# @param opts [Hash] Additional font options.
|
|
138
|
-
# @return [void]
|
|
161
|
+
# @return [String]
|
|
139
162
|
# @api public
|
|
140
|
-
# : (
|
|
141
|
-
def
|
|
163
|
+
# : () -> String
|
|
164
|
+
def name: () -> String
|
|
142
165
|
|
|
143
|
-
|
|
166
|
+
# Creates an {Elements::Formula} object.
|
|
167
|
+
# @api public
|
|
168
|
+
# : (String expression, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
|
|
169
|
+
def formula: (String expression, ?cached_value: String | Numeric | bool | Elements::CellError | nil, ?type: (Symbol | String)?, ?ref: String?, ?shared_index: Integer?) -> Elements::Formula
|
|
144
170
|
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
# @return [Array<String>] Worksheet names.
|
|
171
|
+
# Creates an array or dynamic array {Elements::Formula} object.
|
|
148
172
|
# @api public
|
|
149
|
-
# : () ->
|
|
150
|
-
def
|
|
173
|
+
# : (String expression, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil), **untyped attrs) -> Elements::Formula
|
|
174
|
+
def array_formula: (String expression, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil, **untyped attrs) -> Elements::Formula
|
|
175
|
+
|
|
176
|
+
# Creates a shared formula {Elements::Formula} object.
|
|
177
|
+
# @api public
|
|
178
|
+
# : (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: (String | Numeric | bool | Elements::CellError | nil)) -> Elements::Formula
|
|
179
|
+
def shared_formula: (?String? expression, ?shared_index: Integer?, ?ref: String?, ?cached_value: String | Numeric | bool | Elements::CellError | nil) -> Elements::Formula
|
|
180
|
+
|
|
181
|
+
# Creates an {Elements::RichText} object.
|
|
182
|
+
# @api public
|
|
183
|
+
# : (*(Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped) runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
184
|
+
def rich_text: (*Hash[Symbol, untyped] | Elements::RichTextRun | String | Array[untyped] | untyped runs, ?text: String?, ?base_font: untyped, **untyped font_props) -> Elements::RichText
|
|
185
|
+
|
|
186
|
+
# Creates or returns an {Elements::CellError} object.
|
|
187
|
+
# @api public
|
|
188
|
+
# : (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
189
|
+
def cell_error: (String | Symbol | Elements::CellError code) -> Elements::CellError
|
|
151
190
|
|
|
152
191
|
# Defines or configures a named cell style on the active sheet.
|
|
153
192
|
#
|
|
@@ -168,41 +207,28 @@ module Xlsxrb
|
|
|
168
207
|
# @example Merge with cell reference string
|
|
169
208
|
# s.merge("A1:C1")
|
|
170
209
|
#
|
|
171
|
-
# @
|
|
172
|
-
# s.merge(row: 0, col_start: 0, col_end: 2)
|
|
173
|
-
#
|
|
174
|
-
# @param range [String, nil] The cell range (e.g. "A1:B2").
|
|
175
|
-
# @param row [Integer, nil] 0-based row index.
|
|
176
|
-
# @param col_start [Integer, String, nil] 0-based start column index or letter.
|
|
177
|
-
# @param col_end [Integer, String, nil] 0-based end column index or letter.
|
|
178
|
-
# @param row_start [Integer, nil] 0-based start row index.
|
|
179
|
-
# @param row_end [Integer, nil] 0-based end row index.
|
|
210
|
+
# @param range [String] The cell range (e.g. "A1:B2").
|
|
180
211
|
# @return [void]
|
|
181
212
|
# @api public
|
|
182
|
-
# : (
|
|
183
|
-
def merge: (
|
|
213
|
+
# : (String range) -> void
|
|
214
|
+
def merge: (String range) -> void
|
|
184
215
|
|
|
185
216
|
# Adds a drawing shape to the sheet.
|
|
186
217
|
#
|
|
187
218
|
# @example
|
|
188
|
-
# s.shape(preset: "ellipse", text: "Circle",
|
|
219
|
+
# s.shape(preset: "ellipse", text: "Circle", from_column: 1, from_row: 1, to_column: 4, to_row: 5)
|
|
189
220
|
#
|
|
190
221
|
# @param preset [String] Preset shape type (e.g. "rect", "ellipse").
|
|
191
222
|
# @param text [String, nil] Shape label text.
|
|
192
|
-
# @param
|
|
223
|
+
# @param from_column [Integer, nil] Starting column index (0-based).
|
|
193
224
|
# @param from_row [Integer] Starting row index (0-based).
|
|
194
|
-
# @param
|
|
225
|
+
# @param to_column [Integer, nil] Ending column index (0-based).
|
|
195
226
|
# @param to_row [Integer] Ending row index (0-based).
|
|
196
227
|
# @param opts [Hash] Additional shape formatting options.
|
|
197
228
|
# @return [void]
|
|
198
229
|
# @api public
|
|
199
|
-
# : (?preset: String, ?text: String?, ?
|
|
200
|
-
def shape: (?preset: String, ?text: String?, ?
|
|
201
|
-
|
|
202
|
-
# simplecov:disable
|
|
203
|
-
# Edge case / untested delegation block
|
|
204
|
-
# : (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
205
|
-
def internal_sheet_setup: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
230
|
+
# : (?preset: String, ?text: String?, ?from_column: Integer?, ?from_row: Integer, ?to_column: Integer?, ?to_row: Integer, **untyped opts) -> void
|
|
231
|
+
def shape: (?preset: String, ?text: String?, ?from_column: Integer?, ?from_row: Integer, ?to_column: Integer?, ?to_row: Integer, **untyped opts) -> void
|
|
206
232
|
|
|
207
233
|
# Appends a row of cells to the active sheet.
|
|
208
234
|
#
|
|
@@ -210,22 +236,20 @@ module Xlsxrb
|
|
|
210
236
|
# s.row(["Name", "Age", "City"])
|
|
211
237
|
#
|
|
212
238
|
# @example Write with explicit column keys and styles
|
|
213
|
-
# s.row({ A: "Header", C: 100 },
|
|
239
|
+
# s.row({ A: "Header", C: 100 }, cell_styles: { A: :bold })
|
|
214
240
|
#
|
|
215
241
|
# @param values [Array, Hash] The cell values (e.g. `[1, 2, 3]` or `{ A: 1, C: 3 }`).
|
|
216
|
-
# @param
|
|
242
|
+
# @param cell_styles [String, Symbol, Array, Hash, nil] Style names or hashes to apply to cells.
|
|
243
|
+
# @param row_style [Integer, Symbol, String, Hash, nil] Row style format or index.
|
|
217
244
|
# @param height [Float, Integer, nil] The row height in points (0 - 409).
|
|
218
245
|
# @param hidden [Boolean] Whether the row is hidden.
|
|
219
246
|
# @param custom_height [Boolean] Whether to flag as custom height.
|
|
220
247
|
# @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
|
|
221
248
|
# @param collapsed [Boolean] Whether the row is collapsed.
|
|
222
|
-
# @param style [Integer, Symbol, String, Hash, nil] Row style format or index.
|
|
223
249
|
# @return [void]
|
|
224
250
|
# @api public
|
|
225
|
-
# : (Array[untyped] | Hash[untyped, untyped] values, ?
|
|
226
|
-
def row: (Array[untyped] | Hash[untyped, untyped] values, ?
|
|
227
|
-
|
|
228
|
-
alias add_row row
|
|
251
|
+
# : (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
252
|
+
def row: (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
229
253
|
|
|
230
254
|
# Appends a row to the worksheet and returns self for chaining.
|
|
231
255
|
#
|
|
@@ -240,9 +264,6 @@ module Xlsxrb
|
|
|
240
264
|
|
|
241
265
|
# Advances the row cursor by count without writing empty row elements.
|
|
242
266
|
#
|
|
243
|
-
# @example Skip one row
|
|
244
|
-
# s.skip_row
|
|
245
|
-
#
|
|
246
267
|
# @example Skip multiple rows
|
|
247
268
|
# s.skip_rows(3)
|
|
248
269
|
#
|
|
@@ -252,25 +273,23 @@ module Xlsxrb
|
|
|
252
273
|
# : (?Integer count) -> void
|
|
253
274
|
def skip_rows: (?Integer count) -> void
|
|
254
275
|
|
|
255
|
-
alias skip_row skip_rows
|
|
256
|
-
|
|
257
276
|
# Configures column width and properties.
|
|
258
277
|
#
|
|
259
278
|
# @example Set column A width
|
|
260
279
|
# s.column(0, width: 25.0)
|
|
261
280
|
#
|
|
262
|
-
# @param
|
|
281
|
+
# @param index [Integer, String, Symbol, Range, Array] 0-based column index, letter ("A", :A), range, or array.
|
|
263
282
|
# @param width [Float, Integer, nil] Column width in characters.
|
|
264
283
|
# @param hidden [Boolean] Whether the column is hidden.
|
|
265
|
-
# @param best_fit [Boolean] Whether the column automatically fits content.
|
|
266
284
|
# @param custom_width [Boolean] Whether to flag as custom width.
|
|
267
285
|
# @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
|
|
268
286
|
# @param collapsed [Boolean] Whether the outline group is collapsed.
|
|
269
287
|
# @param style [Integer, Symbol, String, Hash, nil] Column style format or index.
|
|
288
|
+
# @param best_fit [Boolean] Whether the column automatically fits content.
|
|
270
289
|
# @return [void]
|
|
271
290
|
# @api public
|
|
272
|
-
# : (Integer | String | Symbol | Range[Integer | String] | Array[Integer | String]
|
|
273
|
-
def column: (Integer | String | Symbol | Range[Integer | String] | Array[Integer | String]
|
|
291
|
+
# : (Integer | String | Symbol | Range[Integer | String | Symbol] | Array[Integer | String | Symbol] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?best_fit: bool) -> void
|
|
292
|
+
def column: (Integer | String | Symbol | Range[Integer | String | Symbol] | Array[Integer | String | Symbol] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?best_fit: bool) -> void
|
|
274
293
|
|
|
275
294
|
# Groups multiple columns together with outline hierarchy.
|
|
276
295
|
#
|
|
@@ -285,12 +304,6 @@ module Xlsxrb
|
|
|
285
304
|
# : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?level: Integer, ?collapsed: bool, ?hidden: bool, ?width: Float | Integer | nil, ?style: untyped) -> void
|
|
286
305
|
def group_columns: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?level: Integer, ?collapsed: bool, ?hidden: bool, ?width: Float | Integer | nil, ?style: untyped) -> void
|
|
287
306
|
|
|
288
|
-
alias group_column group_columns
|
|
289
|
-
|
|
290
|
-
alias group_cols group_columns
|
|
291
|
-
|
|
292
|
-
alias group_col group_columns
|
|
293
|
-
|
|
294
307
|
# Groups multiple rows with outline hierarchy with a block.
|
|
295
308
|
#
|
|
296
309
|
# @param rows [Range, Array, Integer, nil] Unused in streaming write.
|
|
@@ -303,39 +316,44 @@ module Xlsxrb
|
|
|
303
316
|
# : (?untyped rows, ?level: Integer, ?collapsed: bool, ?hidden: bool) ?{ (self) -> void } -> void
|
|
304
317
|
def group_rows: (?untyped rows, ?level: Integer, ?collapsed: bool, ?hidden: bool) ?{ (self) -> void } -> void
|
|
305
318
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
# Configures worksheet-level outline and grouping view properties.
|
|
319
|
+
# Configures or queries worksheet-level outline and grouping view properties.
|
|
309
320
|
#
|
|
310
321
|
# @param summary_below [Boolean, nil] Summary rows below detail rows.
|
|
311
322
|
# @param summary_right [Boolean, nil] Summary columns to the right of detail columns.
|
|
312
323
|
# @param show_outline_symbols [Boolean, nil] Outline symbols visible.
|
|
313
|
-
# @param show_symbols [Boolean, nil] Alias for show_outline_symbols.
|
|
314
324
|
# @param apply_styles [Boolean, nil] Automatic styles applied.
|
|
315
325
|
# @param opts [Hash] Additional options.
|
|
316
|
-
# @return [Hash]
|
|
326
|
+
# @return [Hash<Symbol, untyped>, void]
|
|
317
327
|
# @api public
|
|
318
|
-
# : (
|
|
319
|
-
|
|
328
|
+
# : () -> Hash[Symbol, untyped]
|
|
329
|
+
# : (?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, ?apply_styles: bool?, **untyped opts) -> void
|
|
330
|
+
def outline_properties: () -> Hash[Symbol, untyped]
|
|
331
|
+
| (?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, ?apply_styles: bool?, **untyped opts) -> void
|
|
320
332
|
|
|
321
|
-
|
|
333
|
+
# Sets worksheet-level outline and grouping view properties.
|
|
334
|
+
#
|
|
335
|
+
# @param opts [Hash] Outline properties.
|
|
336
|
+
# @return [void]
|
|
337
|
+
# @api public
|
|
338
|
+
# : (Hash[Symbol, untyped] opts) -> void
|
|
339
|
+
def outline_properties=: (Hash[Symbol, untyped] opts) -> void
|
|
322
340
|
|
|
323
341
|
# Adds a chart to the active sheet.
|
|
324
342
|
#
|
|
325
343
|
# @example
|
|
326
344
|
# s.chart(:bar) do |chart_builder|
|
|
327
|
-
# chart_builder.title
|
|
345
|
+
# chart_builder.title = "Quarterly Sales"
|
|
328
346
|
# chart_builder.series(values: "Sheet1!$B$2:$B$5", categories: "Sheet1!$A$2:$A$5", name: "Revenue")
|
|
329
347
|
# end
|
|
330
348
|
#
|
|
331
349
|
# @param type [Symbol, String, nil] The chart type (:bar, :col, :line, :pie, :scatter, :area, :doughnut, :radar).
|
|
332
|
-
# @param
|
|
350
|
+
# @param options [Hash] Additional chart options.
|
|
333
351
|
# @yield [chart_builder]
|
|
334
352
|
# @yieldparam chart_builder [Xlsxrb::ChartBuilder]
|
|
335
353
|
# @return [void]
|
|
336
354
|
# @api public
|
|
337
|
-
# : (?Symbol | String? type, **untyped
|
|
338
|
-
def chart: (?Symbol | String? type, **untyped
|
|
355
|
+
# : (?Symbol | String? type, **untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
356
|
+
def chart: (?Symbol | String? type, **untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
339
357
|
|
|
340
358
|
# Adds a hyperlink to a cell.
|
|
341
359
|
#
|
|
@@ -355,53 +373,65 @@ module Xlsxrb
|
|
|
355
373
|
# : (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
356
374
|
def hyperlink: (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
357
375
|
|
|
358
|
-
#
|
|
376
|
+
# Returns the auto-filter range on the active sheet, or nil if none.
|
|
359
377
|
#
|
|
360
|
-
# @
|
|
361
|
-
#
|
|
378
|
+
# @return [String, nil]
|
|
379
|
+
# @api public
|
|
380
|
+
# : () -> String?
|
|
381
|
+
def auto_filter: () -> String?
|
|
382
|
+
|
|
383
|
+
# Sets the auto-filter range on the active sheet.
|
|
362
384
|
#
|
|
363
|
-
# @param
|
|
364
|
-
# @return [
|
|
385
|
+
# @param range [String, nil] The cell range (e.g. "A1:D10").
|
|
386
|
+
# @return [String, nil]
|
|
365
387
|
# @api public
|
|
366
|
-
# : (String
|
|
367
|
-
def auto_filter
|
|
388
|
+
# : (String? range) -> String?
|
|
389
|
+
def auto_filter=: (String? range) -> String?
|
|
368
390
|
|
|
369
391
|
# Sets filter criteria for a column in the auto-filter.
|
|
370
392
|
#
|
|
371
393
|
# @example Simple values filter
|
|
372
394
|
# s.filter_column(0, ["Active", "Pending"])
|
|
373
395
|
#
|
|
374
|
-
# @param col_id [Integer] 0-based column index relative to auto-filter range.
|
|
375
|
-
# @param
|
|
396
|
+
# @param col_id [Integer, String, Symbol] 0-based column index relative to auto-filter range or column letter.
|
|
397
|
+
# @param filter [Hash] Values or filter specification hash.
|
|
376
398
|
# @return [void]
|
|
377
399
|
# @api public
|
|
378
|
-
# : (Integer
|
|
379
|
-
def filter_column: (Integer
|
|
400
|
+
# : (Integer | String | Symbol col_id, (Hash[untyped, untyped] | Array[untyped]) filter) -> void
|
|
401
|
+
def filter_column: (Integer | String | Symbol col_id, Hash[untyped, untyped] | Array[untyped] filter) -> void
|
|
380
402
|
|
|
381
|
-
# Configures sort state on a range.
|
|
403
|
+
# Configures or queries sort state on a range.
|
|
382
404
|
#
|
|
383
|
-
#
|
|
384
|
-
#
|
|
405
|
+
# When called with no arguments, returns the {Elements::SortState} value object.
|
|
406
|
+
# When called with arguments, updates sort state and returns nil.
|
|
385
407
|
#
|
|
386
|
-
# @param ref [String] The range to sort.
|
|
387
|
-
# @param sort_conditions [Array<Hash>,
|
|
408
|
+
# @param ref [String, nil] The range to sort.
|
|
409
|
+
# @param sort_conditions [Array<Hash>, nil] Sort conditions array.
|
|
388
410
|
# @param opts [Hash] Additional sort options.
|
|
411
|
+
# @return [Elements::SortState, nil, void]
|
|
412
|
+
# @api public
|
|
413
|
+
# : () -> Elements::SortState?
|
|
414
|
+
# : (?String? ref, ?Array[Hash[untyped, untyped]]? sort_conditions, **untyped opts) -> void
|
|
415
|
+
def sort_state: () -> Elements::SortState?
|
|
416
|
+
| (?String? ref, ?Array[Hash[untyped, untyped]]? sort_conditions, **untyped opts) -> void
|
|
417
|
+
|
|
418
|
+
# Sets sort state configuration for the active sheet.
|
|
419
|
+
#
|
|
420
|
+
# @param opts [Elements::SortState, Hash, nil] Sort state options.
|
|
389
421
|
# @return [void]
|
|
390
422
|
# @api public
|
|
391
|
-
# : (
|
|
392
|
-
def sort_state
|
|
423
|
+
# : (Elements::SortState | Hash[Symbol, untyped] | nil opts) -> void
|
|
424
|
+
def sort_state=: (Elements::SortState | Hash[Symbol, untyped] | nil opts) -> void
|
|
393
425
|
|
|
394
426
|
# Adds data validation rules to a range.
|
|
395
427
|
#
|
|
396
|
-
# Adds data validation to a cell or range.
|
|
397
|
-
#
|
|
398
428
|
# @example Dropdown list validation
|
|
399
|
-
# s.
|
|
429
|
+
# s.data_validation("B2:B100", type: "list", formula1: '"High,Medium,Low"')
|
|
400
430
|
#
|
|
401
431
|
# @example Block syntax
|
|
402
|
-
# s.
|
|
403
|
-
# dv.type :list
|
|
404
|
-
# dv.formula1 '"High,Medium,Low"'
|
|
432
|
+
# s.data_validation("B2:B100") do |dv|
|
|
433
|
+
# dv.type = :list
|
|
434
|
+
# dv.formula1 = '"High,Medium,Low"'
|
|
405
435
|
# end
|
|
406
436
|
#
|
|
407
437
|
# @param range [String, nil] The cell range (e.g. "B2:B10").
|
|
@@ -411,7 +441,7 @@ module Xlsxrb
|
|
|
411
441
|
# @return [void]
|
|
412
442
|
# @api public
|
|
413
443
|
# : (?String? range, ?type: (String | Symbol)?, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
414
|
-
def
|
|
444
|
+
def data_validation: (?String? range, ?type: (String | Symbol)?, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
415
445
|
|
|
416
446
|
# Adds conditional formatting to a range.
|
|
417
447
|
#
|
|
@@ -440,8 +470,8 @@ module Xlsxrb
|
|
|
440
470
|
#
|
|
441
471
|
# @example Block syntax
|
|
442
472
|
# s.table("A1:C10") do |t|
|
|
443
|
-
# t.columns ["ID", "Name", "Total"]
|
|
444
|
-
# t.style "TableStyleMedium9"
|
|
473
|
+
# t.columns = ["ID", "Name", "Total"]
|
|
474
|
+
# t.style = "TableStyleMedium9"
|
|
445
475
|
# end
|
|
446
476
|
#
|
|
447
477
|
# @param ref [String, nil] The cell range for the table (e.g. "A1:D10").
|
|
@@ -456,11 +486,6 @@ module Xlsxrb
|
|
|
456
486
|
# : (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) ?{ (TableBuilder) -> void } -> void
|
|
457
487
|
def table: (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) ?{ (TableBuilder) -> void } -> void
|
|
458
488
|
|
|
459
|
-
# simplecov:disable
|
|
460
|
-
# Edge case / untested delegation block
|
|
461
|
-
# : () -> void
|
|
462
|
-
def cleanup!: () -> void
|
|
463
|
-
|
|
464
489
|
# Adds a comment to a cell.
|
|
465
490
|
#
|
|
466
491
|
# @example
|
|
@@ -469,39 +494,38 @@ module Xlsxrb
|
|
|
469
494
|
# @param cell [String, Integer] The cell reference (e.g. "A1").
|
|
470
495
|
# @param text [String] The comment text.
|
|
471
496
|
# @param author [String] The author name.
|
|
497
|
+
# @param visible [Boolean] Whether the comment is always shown instead of on hover.
|
|
472
498
|
# @return [void]
|
|
473
499
|
# @api public
|
|
474
|
-
# : (String | Integer cell, String text, ?author: String) -> void
|
|
475
|
-
def comment: (String | Integer cell, String text, ?author: String) -> void
|
|
500
|
+
# : (String | Integer cell, String text, ?author: String, ?visible: bool) -> void
|
|
501
|
+
def comment: (String | Integer cell, String text, ?author: String, ?visible: bool) -> void
|
|
476
502
|
|
|
477
503
|
# Adds a threaded comment to a cell.
|
|
478
504
|
#
|
|
479
505
|
# @param cell [String, Integer] The cell reference (e.g. "A1").
|
|
480
506
|
# @param text [String] The comment text.
|
|
481
507
|
# @param author [String] The author name.
|
|
482
|
-
# @param opts [Hash] Options: timestamp, id, parent_id, done, user_id, provider_id.
|
|
508
|
+
# @param visible [Boolean] Whether the comment is always shown instead of on hover. # @param opts [Hash] Options: timestamp, id, parent_id, done, user_id, provider_id.
|
|
483
509
|
# @return [void]
|
|
484
510
|
# @api public
|
|
485
511
|
# : (String | Integer cell, String text, ?author: untyped, ?timestamp: untyped, ?id: String?, ?parent_id: String?, ?done: bool?, ?user_id: String?, ?provider_id: String?) -> void
|
|
486
512
|
def threaded_comment: (String | Integer cell, String text, ?author: untyped, ?timestamp: untyped, ?id: String?, ?parent_id: String?, ?done: bool?, ?user_id: String?, ?provider_id: String?) -> void
|
|
487
513
|
|
|
488
|
-
alias add_threaded_comment threaded_comment
|
|
489
|
-
|
|
490
514
|
# Adds a Pivot Table to the sheet.
|
|
491
515
|
#
|
|
492
516
|
# @param source_ref [String] Source data range reference (e.g. "Sheet1!A1:D100").
|
|
493
517
|
# @param row_fields [Array<String>] Field names for rows.
|
|
494
518
|
# @param data_fields [Array<String>] Field names for data values.
|
|
495
|
-
# @param
|
|
496
|
-
# @param
|
|
519
|
+
# @param column_fields [Array<String>, nil] Field names for columns.
|
|
520
|
+
# @param ref [String, nil] Target top-left cell reference (default: "E1").
|
|
497
521
|
# @param name [String, nil] Pivot table name.
|
|
498
522
|
# @param field_names [Array<String>, nil] Override field names.
|
|
499
|
-
# @param items [Array, nil] Items
|
|
523
|
+
# @param items [Hash{Integer => Array}, nil] Items of each field, by 0-based field index.
|
|
500
524
|
# @param opts [Hash] Additional options.
|
|
501
525
|
# @return [void]
|
|
502
526
|
# @api public
|
|
503
|
-
# : (String source_ref, row_fields: untyped, data_fields: untyped, ?
|
|
504
|
-
def pivot_table: (String source_ref, row_fields: untyped, data_fields: untyped, ?
|
|
527
|
+
# : (String source_ref, row_fields: untyped, data_fields: untyped, ?column_fields: untyped, ?ref: String?, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
528
|
+
def pivot_table: (String source_ref, row_fields: untyped, data_fields: untyped, ?column_fields: untyped, ?ref: String?, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
505
529
|
|
|
506
530
|
# Adds sparklines to the sheet.
|
|
507
531
|
#
|
|
@@ -516,156 +540,135 @@ module Xlsxrb
|
|
|
516
540
|
# : (sparklines: Array[Hash[Symbol, untyped]], ?type: (String | Symbol)?, **untyped opts) -> void
|
|
517
541
|
def sparkline_group: (sparklines: Array[Hash[Symbol, untyped]], ?type: (String | Symbol)?, **untyped opts) -> void
|
|
518
542
|
|
|
519
|
-
# Adds a single sparkline to the sheet.
|
|
520
|
-
#
|
|
521
|
-
# @example Add a line sparkline
|
|
522
|
-
# s.add_sparkline(location: "F1", range: "A1:E1")
|
|
523
|
-
#
|
|
524
|
-
# @example Add a column sparkline with high/low markers
|
|
525
|
-
# s.add_sparkline(location: "F2", range: "A2:E2", type: :column, high: true, low: true)
|
|
526
|
-
#
|
|
527
|
-
# @example Add a win/loss sparkline
|
|
528
|
-
# s.add_sparkline(location: "F3", range: "A3:E3", type: :win_loss)
|
|
529
|
-
#
|
|
530
|
-
# @param location [String, nil] Target cell for the sparkline (e.g. "F1").
|
|
531
|
-
# @param range [String, nil] Data range for the sparkline (e.g. "A1:E1").
|
|
532
|
-
# @param type [Symbol, String, nil] Sparkline type (:line, :column, :win_loss / :stacked).
|
|
533
|
-
# @param opts [Hash] Additional sparkline options.
|
|
534
|
-
# @return [void]
|
|
535
|
-
# @api public
|
|
536
|
-
# : (?location: String?, ?range: String?, ?type: (String | Symbol)?, **untyped opts) -> void
|
|
537
|
-
def add_sparkline: (?location: String?, ?range: String?, ?type: (String | Symbol)?, **untyped opts) -> void
|
|
538
|
-
|
|
539
543
|
# Sets workbook-level properties.
|
|
540
544
|
#
|
|
541
|
-
#
|
|
542
|
-
# @return [void]
|
|
543
|
-
# @api public
|
|
544
|
-
# : (**untyped opts) -> void
|
|
545
|
-
def workbook_property: (**untyped opts) -> void
|
|
546
|
-
|
|
547
|
-
# Sets or gets the active sheet in the workbook window.
|
|
548
|
-
# If called without arguments on the proxy, marks this sheet as the active sheet.
|
|
545
|
+
# Gets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
549
546
|
#
|
|
550
|
-
# @
|
|
551
|
-
# @return [String, Symbol, Integer, nil]
|
|
552
|
-
# @api public
|
|
553
|
-
# : (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
554
|
-
def active_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
555
|
-
|
|
556
|
-
alias active_tab active_sheet
|
|
557
|
-
|
|
558
|
-
# Sets or gets the first visible sheet in the tab bar.
|
|
559
|
-
#
|
|
560
|
-
# @param name_or_index [String, Symbol, Integer, nil]
|
|
561
|
-
# @return [String, Symbol, Integer, nil]
|
|
562
|
-
# @api public
|
|
563
|
-
# : (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
564
|
-
def first_sheet: (?String | Symbol | Integer | nil name_or_index) -> (String | Symbol | Integer | nil)
|
|
565
|
-
|
|
566
|
-
# Sets or gets whether sheet tabs are visible in the workbook window.
|
|
567
|
-
#
|
|
568
|
-
# @param visible [Boolean, nil]
|
|
569
|
-
# @return [Boolean, nil]
|
|
547
|
+
# @return [Symbol]
|
|
570
548
|
# @api public
|
|
571
|
-
# : (
|
|
572
|
-
def
|
|
549
|
+
# : () -> Symbol
|
|
550
|
+
def state: () -> Symbol
|
|
573
551
|
|
|
574
|
-
# Sets
|
|
552
|
+
# Sets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
575
553
|
#
|
|
576
|
-
# @param
|
|
577
|
-
# @return [
|
|
554
|
+
# @param new_state [Symbol, String] The new state.
|
|
555
|
+
# @return [Symbol]
|
|
578
556
|
# @api public
|
|
579
|
-
# : (
|
|
580
|
-
def
|
|
557
|
+
# : (Symbol | String new_state) -> Symbol
|
|
558
|
+
def state=: (Symbol | String new_state) -> Symbol
|
|
581
559
|
|
|
582
|
-
# Gets
|
|
560
|
+
# Gets the tab color of this worksheet.
|
|
583
561
|
#
|
|
584
|
-
# @
|
|
585
|
-
# @return [Symbol]
|
|
562
|
+
# @return [String, Hash, nil]
|
|
586
563
|
# @api public
|
|
587
|
-
# : (
|
|
588
|
-
def
|
|
564
|
+
# : () -> (String | Hash[Symbol, untyped] | nil)
|
|
565
|
+
def tab_color: () -> (String | Hash[Symbol, untyped] | nil)
|
|
589
566
|
|
|
590
|
-
#
|
|
567
|
+
# Sets the tab color of this worksheet.
|
|
591
568
|
#
|
|
592
569
|
# @param spec [String, Hash, Symbol, nil] Tab color hex string or hash options.
|
|
593
|
-
# @param opts [Hash] Color keyword arguments (e.g. theme: 1, tint: 0.5).
|
|
594
570
|
# @return [String, Hash, nil]
|
|
595
571
|
# @api public
|
|
596
|
-
# : (
|
|
597
|
-
def tab_color
|
|
598
|
-
|
|
599
|
-
alias tab_color= tab_color
|
|
572
|
+
# : (String | Symbol | Hash[Symbol, untyped] | nil spec) -> (String | Hash[Symbol, untyped] | nil)
|
|
573
|
+
def tab_color=: (String | Symbol | Hash[Symbol, untyped] | nil spec) -> (String | Hash[Symbol, untyped] | nil)
|
|
600
574
|
|
|
601
|
-
#
|
|
575
|
+
# Configures or queries sheet properties.
|
|
602
576
|
#
|
|
603
|
-
# @
|
|
604
|
-
#
|
|
605
|
-
#
|
|
606
|
-
#
|
|
607
|
-
#
|
|
577
|
+
# @param opts [Hash] Keyword options for sheet properties.
|
|
578
|
+
# @return [Elements::SheetProperties, void]
|
|
579
|
+
# @api public
|
|
580
|
+
# : () -> Elements::SheetProperties
|
|
581
|
+
# : (**untyped opts) -> void
|
|
582
|
+
def sheet_properties: () -> Elements::SheetProperties
|
|
583
|
+
| (**untyped opts) -> void
|
|
584
|
+
|
|
585
|
+
# Replaces worksheet properties.
|
|
586
|
+
# @param opts [Hash, Elements::SheetProperties]
|
|
608
587
|
# @return [void]
|
|
609
588
|
# @api public
|
|
610
|
-
# : (Symbol |
|
|
611
|
-
def sheet_properties
|
|
589
|
+
# : (Hash[Symbol, untyped] | Elements::SheetProperties opts) -> void
|
|
590
|
+
def sheet_properties=: (Hash[Symbol, untyped] | Elements::SheetProperties opts) -> void
|
|
612
591
|
|
|
613
|
-
# Adds a defined named range or formula.
|
|
614
|
-
#
|
|
615
|
-
# @example
|
|
616
|
-
# s.defined_name("TaxRate", "0.10")
|
|
617
|
-
#
|
|
618
|
-
# @param name [String] The name.
|
|
619
592
|
# Adds a defined name (named range or formula) scoped to this sheet or workbook.
|
|
620
593
|
# Bare cell references and coordinate keywords are automatically formatted with sheet quotes and absolute $ references.
|
|
621
594
|
#
|
|
622
595
|
# @param name [String] Defined name identifier.
|
|
623
596
|
# @param value [Object, nil] Value or formula expression.
|
|
624
597
|
# @param hidden [Boolean] Whether the defined name is hidden.
|
|
625
|
-
# @param
|
|
626
|
-
# @param rows [Integer, Range, nil] Row or row range (
|
|
598
|
+
# @param columns [Integer, String, nil] Column index or letter for coordinate-based reference.
|
|
599
|
+
# @param rows [Integer, Range, nil] Row or row range (0-based) for coordinate-based reference.
|
|
627
600
|
# @param range [String, nil] Cell range reference.
|
|
628
|
-
# @param sheet [String, nil]
|
|
601
|
+
# @param sheet [String, nil] Reference sheet name (defaults to current sheet).
|
|
602
|
+
# @param scope [String, Symbol, nil] Scope identifier (:workbook or sheet name).
|
|
629
603
|
# @return [void]
|
|
630
604
|
# @api public
|
|
631
|
-
# : (String name, ?untyped value, ?hidden: bool, ?
|
|
632
|
-
def defined_name: (String name, ?untyped value, ?hidden: bool, ?
|
|
605
|
+
# : (String name, ?untyped value, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped, ?sheet: String?, ?scope: (String | Symbol)?) -> void
|
|
606
|
+
def defined_name: (String name, ?untyped value, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped, ?sheet: String?, ?scope: (String | Symbol)?) -> void
|
|
633
607
|
|
|
634
|
-
#
|
|
608
|
+
# Configures or queries freeze panes (<pane state="frozen">).
|
|
609
|
+
#
|
|
610
|
+
# When called with no arguments, returns the {Elements::FreezePane} value object or nil.
|
|
611
|
+
# When called with arguments, configures the freeze pane and returns nil.
|
|
635
612
|
#
|
|
636
613
|
# @example Freeze top row
|
|
637
614
|
# s.freeze_pane(row: 1)
|
|
638
615
|
#
|
|
639
616
|
# @example Freeze first column and top 2 rows
|
|
640
|
-
# s.freeze_pane(row: 2,
|
|
617
|
+
# s.freeze_pane(row: 2, column: 1)
|
|
641
618
|
#
|
|
642
619
|
# @param row [Integer, nil] Number of rows to freeze.
|
|
643
|
-
# @param
|
|
644
|
-
# @return [void]
|
|
620
|
+
# @param column [Integer, String, nil] Number of columns to freeze.
|
|
621
|
+
# @return [Elements::FreezePane, nil, void]
|
|
645
622
|
# @api public
|
|
646
|
-
# : (
|
|
647
|
-
|
|
623
|
+
# : () -> Elements::FreezePane?
|
|
624
|
+
# : (?row: Integer | nil, ?column: (Integer | String)?, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
625
|
+
def freeze_pane: () -> Elements::FreezePane?
|
|
626
|
+
| (?row: Integer | nil, ?column: (Integer | String)?, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
648
627
|
|
|
649
|
-
#
|
|
650
|
-
# Edge case / untested delegation block
|
|
651
|
-
# Sets the print area range for the sheet.
|
|
628
|
+
# Sets or clears freeze pane configuration.
|
|
652
629
|
#
|
|
653
|
-
# @param
|
|
630
|
+
# @param opts [Elements::FreezePane, Hash, nil] Freeze pane options.
|
|
654
631
|
# @return [void]
|
|
655
632
|
# @api public
|
|
656
|
-
# : (
|
|
657
|
-
def
|
|
633
|
+
# : (Elements::FreezePane | Hash[Symbol, untyped] | nil opts) -> void
|
|
634
|
+
def freeze_pane=: (Elements::FreezePane | Hash[Symbol, untyped] | nil opts) -> void
|
|
658
635
|
|
|
659
|
-
#
|
|
660
|
-
# Edge case / untested delegation block
|
|
661
|
-
# Configures repeating title rows and columns for printing.
|
|
636
|
+
# Returns the print area range for this worksheet, or nil if none.
|
|
662
637
|
#
|
|
663
|
-
# @
|
|
664
|
-
# @param cols [String, nil] Column range to repeat (e.g. "A:B").
|
|
665
|
-
# @return [void]
|
|
638
|
+
# @return [String, nil]
|
|
666
639
|
# @api public
|
|
667
|
-
# : (
|
|
668
|
-
def
|
|
640
|
+
# : () -> String?
|
|
641
|
+
def print_area: () -> String?
|
|
642
|
+
|
|
643
|
+
# Sets the print area for this worksheet.
|
|
644
|
+
#
|
|
645
|
+
# @param range [String, nil] Cell range (e.g. "A1:G50").
|
|
646
|
+
# @return [String, nil]
|
|
647
|
+
# @api public
|
|
648
|
+
# : (String? range) -> String?
|
|
649
|
+
def print_area=: (String? range) -> String?
|
|
650
|
+
|
|
651
|
+
# Sets or gets repeating print titles (rows and/or columns) for pagination.
|
|
652
|
+
#
|
|
653
|
+
# When called with no arguments, returns the {Elements::PrintTitles} value object or nil.
|
|
654
|
+
# When called with arguments, updates print titles and returns nil.
|
|
655
|
+
#
|
|
656
|
+
# @param rows [String, Integer, Range, nil] Repeating row range (e.g. "1:2").
|
|
657
|
+
# @param columns [String, Integer, Symbol, Range, nil] Repeating column range (e.g. "A:B").
|
|
658
|
+
# @return [Elements::PrintTitles, nil, void]
|
|
659
|
+
# @api public
|
|
660
|
+
# : () -> Elements::PrintTitles?
|
|
661
|
+
# : (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?) -> void
|
|
662
|
+
def print_titles: () -> Elements::PrintTitles?
|
|
663
|
+
| (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?) -> void
|
|
664
|
+
|
|
665
|
+
# Sets repeating print titles for this worksheet.
|
|
666
|
+
#
|
|
667
|
+
# @param opts [Elements::PrintTitles, Hash, nil] Options with :rows and/or :columns.
|
|
668
|
+
# @return [Elements::PrintTitles, Hash, nil]
|
|
669
|
+
# @api public
|
|
670
|
+
# : (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
|
|
671
|
+
def print_titles=: (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
|
|
669
672
|
|
|
670
673
|
# Sets repeating title rows to appear at the top of each printed page.
|
|
671
674
|
#
|
|
@@ -685,50 +688,58 @@ module Xlsxrb
|
|
|
685
688
|
# : (Integer | String first, ?(Integer | String)? last) -> void
|
|
686
689
|
def repeat_columns: (Integer | String first, ?(Integer | String)? last) -> void
|
|
687
690
|
|
|
688
|
-
# Splits sheet view into panes.
|
|
691
|
+
# Splits sheet view into panes or queries split pane settings (<pane>).
|
|
692
|
+
#
|
|
693
|
+
# When called with no arguments, returns the {Elements::SplitPane} value object or nil.
|
|
694
|
+
# When called with arguments, configures the split pane and returns nil.
|
|
689
695
|
#
|
|
690
|
-
# @param x_split [
|
|
691
|
-
# @param y_split [
|
|
696
|
+
# @param x_split [Integer, nil] Horizontal split position.
|
|
697
|
+
# @param y_split [Integer, nil] Vertical split position.
|
|
692
698
|
# @param top_left_cell [String, nil] Top-left visible cell in bottom-right pane.
|
|
693
|
-
# @param active_pane [String, nil] Active pane identifier.
|
|
694
|
-
# @param state [String, nil] Split state.
|
|
695
|
-
# @return [void]
|
|
699
|
+
# @param active_pane [String, Symbol, nil] Active pane identifier.
|
|
700
|
+
# @param state [String, Symbol, nil] Split state.
|
|
701
|
+
# @return [Elements::SplitPane, nil, void]
|
|
696
702
|
# @api public
|
|
697
|
-
# : (
|
|
698
|
-
|
|
703
|
+
# : () -> Elements::SplitPane?
|
|
704
|
+
# : (?x_split: Integer | nil, ?y_split: Integer | nil, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
705
|
+
def split_pane: () -> Elements::SplitPane?
|
|
706
|
+
| (?x_split: Integer | nil, ?y_split: Integer | nil, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
699
707
|
|
|
700
|
-
#
|
|
701
|
-
# Edge case / untested delegation block
|
|
702
|
-
# Protects the workbook structure.
|
|
708
|
+
# Sets or clears split pane configuration.
|
|
703
709
|
#
|
|
704
|
-
# @param opts [Hash]
|
|
710
|
+
# @param opts [Elements::SplitPane, Hash, nil] Split pane options.
|
|
705
711
|
# @return [void]
|
|
706
712
|
# @api public
|
|
707
|
-
# : (
|
|
708
|
-
def
|
|
713
|
+
# : (Elements::SplitPane | Hash[Symbol, untyped] | nil opts) -> void
|
|
714
|
+
def split_pane=: (Elements::SplitPane | Hash[Symbol, untyped] | nil opts) -> void
|
|
709
715
|
|
|
710
|
-
#
|
|
711
|
-
# Edge case / untested delegation block
|
|
712
|
-
# Sets core metadata property.
|
|
716
|
+
# Sets or queries the active/selected cell on the sheet (<selection>).
|
|
713
717
|
#
|
|
714
|
-
#
|
|
715
|
-
#
|
|
716
|
-
# @return [void]
|
|
717
|
-
# @api public
|
|
718
|
-
# : (String | Symbol name, untyped value) -> void
|
|
719
|
-
def core_property: (String | Symbol name, untyped value) -> void
|
|
720
|
-
|
|
721
|
-
# Sets the active/selected cell on the sheet.
|
|
718
|
+
# When called with no arguments, returns the selection ({Elements::Selection}, Array, or nil).
|
|
719
|
+
# When called with arguments, updates the selection and returns nil.
|
|
722
720
|
#
|
|
723
|
-
# @param active_cell [String] Cell reference (e.g. "A1").
|
|
721
|
+
# @param active_cell [String, nil] Cell reference (e.g. "A1") or range (e.g. "A1:D10").
|
|
724
722
|
# @param sqref [String, nil] Selection range.
|
|
725
723
|
# @param pane [String, Symbol, nil] Pane identifier.
|
|
724
|
+
# @return [Elements::Selection, Array<Elements::Selection>, nil, void]
|
|
725
|
+
# @api public
|
|
726
|
+
# : () -> (Elements::Selection | Array[Elements::Selection])?
|
|
727
|
+
# : (?String? active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
728
|
+
def selection: () -> (Elements::Selection | Array[Elements::Selection])?
|
|
729
|
+
| (?String? active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
730
|
+
|
|
731
|
+
# Sets or clears the selection configuration.
|
|
732
|
+
#
|
|
733
|
+
# @param opts [Elements::Selection, Array<Elements::Selection, Hash>, Hash, nil]
|
|
726
734
|
# @return [void]
|
|
727
735
|
# @api public
|
|
728
|
-
# : (
|
|
729
|
-
def
|
|
736
|
+
# : (Elements::Selection | Array[Elements::Selection | Hash[Symbol, untyped]] | Hash[Symbol, untyped] | nil opts) -> void
|
|
737
|
+
def selection=: (Elements::Selection | Array[Elements::Selection | Hash[Symbol, untyped]] | Hash[Symbol, untyped] | nil opts) -> void
|
|
730
738
|
|
|
731
|
-
# Configures page margins for printing.
|
|
739
|
+
# Configures or queries page margins for printing (<pageMargins>).
|
|
740
|
+
#
|
|
741
|
+
# When called with no arguments, returns the {Elements::PageMargins} value object or nil.
|
|
742
|
+
# When called with arguments, configures page margins and returns nil.
|
|
732
743
|
#
|
|
733
744
|
# @param left [Float, nil] Left margin in inches.
|
|
734
745
|
# @param right [Float, nil] Right margin in inches.
|
|
@@ -736,135 +747,173 @@ module Xlsxrb
|
|
|
736
747
|
# @param bottom [Float, nil] Bottom margin in inches.
|
|
737
748
|
# @param header [Float, nil] Header margin in inches.
|
|
738
749
|
# @param footer [Float, nil] Footer margin in inches.
|
|
739
|
-
# @return [void]
|
|
750
|
+
# @return [Elements::PageMargins, nil, void]
|
|
740
751
|
# @api public
|
|
752
|
+
# : () -> Elements::PageMargins?
|
|
741
753
|
# : (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
|
|
742
|
-
def page_margins: (
|
|
754
|
+
def page_margins: () -> Elements::PageMargins?
|
|
755
|
+
| (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
|
|
756
|
+
|
|
757
|
+
# Sets or clears page margins configuration.
|
|
758
|
+
#
|
|
759
|
+
# @param opts [Hash, Elements::PageMargins, nil]
|
|
760
|
+
# @return [void]
|
|
761
|
+
# @api public
|
|
762
|
+
# : (Hash[Symbol, untyped] | Elements::PageMargins | nil opts) -> void
|
|
763
|
+
def page_margins=: (Hash[Symbol, untyped] | Elements::PageMargins | nil opts) -> void
|
|
743
764
|
|
|
744
|
-
# Configures page orientation, paper size, and print setup.
|
|
765
|
+
# Configures or queries page orientation, paper size, and print setup (<pageSetup>).
|
|
766
|
+
#
|
|
767
|
+
# When called with no arguments, returns the {Elements::PageSetup} value object.
|
|
768
|
+
# When called with keyword arguments, updates page setup and returns nil.
|
|
745
769
|
#
|
|
746
770
|
# @param orientation [String, Symbol, nil] "portrait" or "landscape" (or :portrait, :landscape).
|
|
747
771
|
# @param paper_size [Integer, nil] Paper size index (e.g. 9 for A4, 1 for Letter).
|
|
748
772
|
# @param opts [Hash] Additional options (scale, fit_to_width, fit_to_height).
|
|
773
|
+
# @return [Elements::PageSetup, void]
|
|
774
|
+
# @api public
|
|
775
|
+
# : () -> Elements::PageSetup
|
|
776
|
+
# : (**untyped opts) -> void
|
|
777
|
+
def page_setup: () -> Elements::PageSetup
|
|
778
|
+
| (**untyped opts) -> void
|
|
779
|
+
|
|
780
|
+
# Sets page setup configuration.
|
|
781
|
+
#
|
|
782
|
+
# @param opts [Hash, Elements::PageSetup]
|
|
749
783
|
# @return [void]
|
|
750
784
|
# @api public
|
|
751
|
-
# : (
|
|
752
|
-
def page_setup
|
|
785
|
+
# : (Hash[Symbol, untyped] | Elements::PageSetup opts) -> void
|
|
786
|
+
def page_setup=: (Hash[Symbol, untyped] | Elements::PageSetup opts) -> void
|
|
753
787
|
|
|
754
|
-
# Configures header and footer text for printing.
|
|
788
|
+
# Configures or queries header and footer text for printing (<headerFooter>).
|
|
789
|
+
#
|
|
790
|
+
# When called with no arguments, returns the {Elements::HeaderFooter} value object.
|
|
791
|
+
# When called with keyword arguments, updates headers and footers and returns nil.
|
|
755
792
|
#
|
|
756
793
|
# @param opts [Hash] Header and footer specifications.
|
|
757
|
-
# @return [void]
|
|
794
|
+
# @return [Elements::HeaderFooter, void]
|
|
758
795
|
# @api public
|
|
796
|
+
# : () -> Elements::HeaderFooter
|
|
759
797
|
# : (**untyped opts) -> void
|
|
760
|
-
def header_footer: (
|
|
798
|
+
def header_footer: () -> Elements::HeaderFooter
|
|
799
|
+
| (**untyped opts) -> void
|
|
761
800
|
|
|
762
|
-
#
|
|
801
|
+
# Sets header and footer configuration.
|
|
763
802
|
#
|
|
764
|
-
# @param
|
|
765
|
-
# @param value [Object] Print option value.
|
|
803
|
+
# @param opts [Hash, Elements::HeaderFooter]
|
|
766
804
|
# @return [void]
|
|
767
805
|
# @api public
|
|
768
|
-
# : (Symbol |
|
|
769
|
-
def
|
|
806
|
+
# : (Hash[Symbol, untyped] | Elements::HeaderFooter opts) -> void
|
|
807
|
+
def header_footer=: (Hash[Symbol, untyped] | Elements::HeaderFooter opts) -> void
|
|
770
808
|
|
|
771
|
-
#
|
|
772
|
-
#
|
|
773
|
-
# Sets document metadata properties (core, app, custom).
|
|
809
|
+
# Configures or gets print options (e.g. gridlines, headings).
|
|
810
|
+
# Configures or queries print options.
|
|
774
811
|
#
|
|
775
|
-
# @param
|
|
776
|
-
# @
|
|
777
|
-
# @param custom [Hash, nil] Custom properties.
|
|
778
|
-
# @return [void]
|
|
812
|
+
# @param opts [Hash] Additional options.
|
|
813
|
+
# @return [Elements::PrintOptions, void]
|
|
779
814
|
# @api public
|
|
780
|
-
# : (
|
|
781
|
-
|
|
815
|
+
# : () -> Elements::PrintOptions
|
|
816
|
+
# : (**untyped opts) -> void
|
|
817
|
+
def print_options: () -> Elements::PrintOptions
|
|
818
|
+
| (**untyped opts) -> void
|
|
782
819
|
|
|
783
|
-
#
|
|
784
|
-
#
|
|
785
|
-
# Sets app metadata property.
|
|
786
|
-
#
|
|
787
|
-
# @param name [String, Symbol] Property name.
|
|
788
|
-
# @param value [Object] Property value.
|
|
820
|
+
# Replaces print options.
|
|
821
|
+
# @param opts [Hash, Elements::PrintOptions]
|
|
789
822
|
# @return [void]
|
|
790
823
|
# @api public
|
|
791
|
-
# : (
|
|
792
|
-
def
|
|
824
|
+
# : (Hash[Symbol, untyped] | Elements::PrintOptions opts) -> void
|
|
825
|
+
def print_options=: (Hash[Symbol, untyped] | Elements::PrintOptions opts) -> void
|
|
793
826
|
|
|
794
|
-
#
|
|
827
|
+
# Sets or queries sheet-level protection with optional password hashing (<sheetProtection>).
|
|
828
|
+
#
|
|
829
|
+
# When called with no arguments, returns the {Elements::SheetProtection} value object or nil.
|
|
830
|
+
# When called with keyword arguments, sets sheet protection and returns nil.
|
|
795
831
|
#
|
|
796
832
|
# @param opts [Hash] Protection options.
|
|
797
|
-
# @return [void]
|
|
833
|
+
# @return [Elements::SheetProtection, nil, void]
|
|
798
834
|
# @api public
|
|
835
|
+
# : () -> Elements::SheetProtection?
|
|
799
836
|
# : (**untyped opts) -> void
|
|
800
|
-
def
|
|
837
|
+
def sheet_protection: () -> Elements::SheetProtection?
|
|
838
|
+
| (**untyped opts) -> void
|
|
801
839
|
|
|
802
|
-
#
|
|
803
|
-
# Edge case / untested delegation block
|
|
804
|
-
# Sets custom metadata property.
|
|
840
|
+
# Sets or clears sheet protection configuration.
|
|
805
841
|
#
|
|
806
|
-
# @param
|
|
807
|
-
# @param value [Object] Property value.
|
|
842
|
+
# @param opts [Elements::SheetProtection, Hash, Boolean, nil]
|
|
808
843
|
# @return [void]
|
|
809
844
|
# @api public
|
|
810
|
-
# : (
|
|
811
|
-
def
|
|
845
|
+
# : (Elements::SheetProtection | Hash[Symbol, untyped] | bool | nil opts) -> void
|
|
846
|
+
def sheet_protection=: (Elements::SheetProtection | Hash[Symbol, untyped] | bool | nil opts) -> void
|
|
847
|
+
|
|
848
|
+
# Returns column configurations defined for this worksheet.
|
|
849
|
+
#
|
|
850
|
+
# @return [Array<Elements::Column>]
|
|
851
|
+
# @api public
|
|
852
|
+
# : () -> Array[Elements::Column]
|
|
853
|
+
def columns: () -> Array[Elements::Column]
|
|
812
854
|
|
|
813
855
|
# Inserts an image into the sheet.
|
|
814
856
|
#
|
|
815
857
|
# @param file_data [String] Binary image data or file content.
|
|
816
858
|
# @param ext [String] Image extension ("png", "jpeg", etc.).
|
|
817
|
-
# @param
|
|
859
|
+
# @param from_column [Integer, nil] Starting column index (0-based).
|
|
818
860
|
# @param from_row [Integer] Starting row index (0-based).
|
|
819
|
-
# @param
|
|
861
|
+
# @param to_column [Integer, nil] Ending column index (0-based).
|
|
820
862
|
# @param to_row [Integer] Ending row index (0-based).
|
|
821
863
|
# @param opts [Hash] Additional anchor and sizing options.
|
|
822
864
|
# @return [void]
|
|
823
865
|
# @api public
|
|
824
|
-
# : (String file_data, ?ext: String, ?
|
|
825
|
-
def image: (String file_data, ?ext: String, ?
|
|
866
|
+
# : (String file_data, ?ext: String, ?from_column: Integer?, ?from_row: Integer, ?to_column: Integer?, ?to_row: Integer, **untyped opts) -> void
|
|
867
|
+
def image: (String file_data, ?ext: String, ?from_column: Integer?, ?from_row: Integer, ?to_column: Integer?, ?to_row: Integer, **untyped opts) -> void
|
|
826
868
|
|
|
827
|
-
#
|
|
828
|
-
#
|
|
829
|
-
# @example Set background image from binary data
|
|
830
|
-
# sheet.background_image(png_bytes, ext: "png")
|
|
869
|
+
# Gets the worksheet background image (<picture>).
|
|
831
870
|
#
|
|
832
|
-
# @
|
|
833
|
-
# @param ext [String, nil] Image extension.
|
|
834
|
-
# @param opts [Hash] Additional options.
|
|
835
|
-
# @return [Hash, nil]
|
|
871
|
+
# @return [Elements::BackgroundImage, nil]
|
|
836
872
|
# @api public
|
|
837
|
-
# : (
|
|
838
|
-
def background_image: (
|
|
839
|
-
|
|
840
|
-
alias background_picture background_image
|
|
841
|
-
|
|
842
|
-
alias picture background_image
|
|
873
|
+
# : () -> Elements::BackgroundImage?
|
|
874
|
+
def background_image: () -> Elements::BackgroundImage?
|
|
843
875
|
|
|
876
|
+
# Sets the worksheet background image (<picture>).
|
|
877
|
+
#
|
|
878
|
+
# @param val [String, Hash, Elements::Image, nil] Image binary data, file path, or image options hash.
|
|
879
|
+
# @return [untyped]
|
|
880
|
+
# @api public
|
|
881
|
+
# : (untyped val) -> untyped
|
|
844
882
|
def background_image=: (untyped val) -> untyped
|
|
845
883
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
alias picture= background_image=
|
|
849
|
-
|
|
850
|
-
# Configures sheet view settings (zoom scale, grid lines visibility).
|
|
884
|
+
# Configures or gets sheet view settings (zoom scale, grid lines visibility).
|
|
851
885
|
#
|
|
852
|
-
# @param
|
|
853
|
-
# @
|
|
886
|
+
# @param opts [Hash] Additional options.
|
|
887
|
+
# @return [Elements::SheetView, void]
|
|
888
|
+
# @api public
|
|
889
|
+
# : () -> Elements::SheetView
|
|
890
|
+
# : (**untyped opts) -> void
|
|
891
|
+
def sheet_view: () -> Elements::SheetView
|
|
892
|
+
| (**untyped opts) -> void
|
|
893
|
+
|
|
894
|
+
# Replaces sheet view properties.
|
|
895
|
+
# @param opts [Hash, Elements::SheetView]
|
|
854
896
|
# @return [void]
|
|
855
897
|
# @api public
|
|
856
|
-
# : (Symbol |
|
|
857
|
-
def sheet_view
|
|
898
|
+
# : (Hash[Symbol, untyped] | Elements::SheetView opts) -> void
|
|
899
|
+
def sheet_view=: (Hash[Symbol, untyped] | Elements::SheetView opts) -> void
|
|
858
900
|
|
|
859
|
-
# Configures sheet format properties (e.g. default_row_height,
|
|
901
|
+
# Configures or gets sheet format properties (e.g. default_row_height, default_column_width).
|
|
860
902
|
#
|
|
861
|
-
# @param name [Symbol, String, Hash, nil] Property name or hash of properties.
|
|
862
|
-
# @param value [Object, nil] Property value when name is provided.
|
|
863
903
|
# @param opts [Hash] Keyword arguments for sheet format properties.
|
|
864
|
-
# @return [
|
|
904
|
+
# @return [Elements::SheetFormat, void]
|
|
865
905
|
# @api public
|
|
866
|
-
# : (
|
|
867
|
-
|
|
906
|
+
# : () -> Elements::SheetFormat
|
|
907
|
+
# : (**untyped opts) -> void
|
|
908
|
+
def sheet_format: () -> Elements::SheetFormat
|
|
909
|
+
| (**untyped opts) -> void
|
|
910
|
+
|
|
911
|
+
# Replaces sheet format properties.
|
|
912
|
+
# @param opts [Hash, Elements::SheetFormat]
|
|
913
|
+
# @return [void]
|
|
914
|
+
# @api public
|
|
915
|
+
# : (Hash[Symbol, untyped] | Elements::SheetFormat opts) -> void
|
|
916
|
+
def sheet_format=: (Hash[Symbol, untyped] | Elements::SheetFormat opts) -> void
|
|
868
917
|
|
|
869
918
|
# simplecov:disable
|
|
870
919
|
# Edge case / untested delegation block
|
|
@@ -874,17 +923,17 @@ module Xlsxrb
|
|
|
874
923
|
# @return [void]
|
|
875
924
|
# @api public
|
|
876
925
|
# : (Integer row_index) -> void
|
|
877
|
-
def
|
|
926
|
+
def row_break: (Integer row_index) -> void
|
|
878
927
|
|
|
879
928
|
# simplecov:disable
|
|
880
929
|
# Edge case / untested delegation block
|
|
881
|
-
# Adds a vertical page break after the given column
|
|
930
|
+
# Adds a vertical page break after the given column.
|
|
882
931
|
#
|
|
883
|
-
# @param
|
|
932
|
+
# @param col [Integer, String, Symbol] 0-based column index or column letter.
|
|
884
933
|
# @return [void]
|
|
885
934
|
# @api public
|
|
886
|
-
# : (Integer
|
|
887
|
-
def
|
|
935
|
+
# : (Integer | String | Symbol col) -> void
|
|
936
|
+
def column_break: (Integer | String | Symbol col) -> void
|
|
888
937
|
|
|
889
938
|
# Adds a protected range to the sheet.
|
|
890
939
|
#
|
|
@@ -897,8 +946,6 @@ module Xlsxrb
|
|
|
897
946
|
# : (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
898
947
|
def protected_range: (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
899
948
|
|
|
900
|
-
alias add_protected_range protected_range
|
|
901
|
-
|
|
902
949
|
# Adds a cell watch to the sheet.
|
|
903
950
|
#
|
|
904
951
|
# @param ref [String] Cell reference (e.g. "A1").
|
|
@@ -907,8 +954,6 @@ module Xlsxrb
|
|
|
907
954
|
# : (String ref) -> void
|
|
908
955
|
def cell_watch: (String ref) -> void
|
|
909
956
|
|
|
910
|
-
alias add_cell_watch cell_watch
|
|
911
|
-
|
|
912
957
|
# Adds an ignored error entry to the sheet.
|
|
913
958
|
#
|
|
914
959
|
# @param sqref [String] Cell range reference (e.g. "A1" or "A1:B10").
|
|
@@ -916,68 +961,74 @@ module Xlsxrb
|
|
|
916
961
|
# @return [void]
|
|
917
962
|
# @api public
|
|
918
963
|
# : (String sqref, ?eval_error: bool, ?two_digit_text_year: bool, ?number_stored_as_text: bool, ?formula: bool, ?formula_range: bool, ?unlocked_formula: bool, ?empty_cell_reference: bool, ?list_data_validation: bool, ?calculated_column: bool) -> void
|
|
919
|
-
def
|
|
920
|
-
|
|
921
|
-
alias add_ignored_error ignore_error
|
|
964
|
+
def ignored_error: (String sqref, ?eval_error: bool, ?two_digit_text_year: bool, ?number_stored_as_text: bool, ?formula: bool, ?formula_range: bool, ?unlocked_formula: bool, ?empty_cell_reference: bool, ?list_data_validation: bool, ?calculated_column: bool) -> void
|
|
922
965
|
|
|
923
966
|
# Returns the ignored error entries configured for this sheet.
|
|
924
967
|
#
|
|
925
|
-
# @return [Array<
|
|
968
|
+
# @return [Array<Elements::IgnoredError>]
|
|
926
969
|
# @api public
|
|
927
|
-
# : () -> Array[
|
|
928
|
-
def ignored_errors: () -> Array[
|
|
970
|
+
# : () -> Array[Elements::IgnoredError]
|
|
971
|
+
def ignored_errors: () -> Array[Elements::IgnoredError]
|
|
929
972
|
|
|
930
|
-
# Gets
|
|
973
|
+
# Gets phonetic (furigana) guide properties for the sheet.
|
|
931
974
|
#
|
|
975
|
+
# @return [Elements::PhoneticProperties, nil]
|
|
932
976
|
# @api public
|
|
933
|
-
# : (
|
|
934
|
-
def phonetic_properties: (
|
|
935
|
-
|
|
936
|
-
alias phonetic_properties= phonetic_properties
|
|
977
|
+
# : () -> Elements::PhoneticProperties?
|
|
978
|
+
def phonetic_properties: () -> Elements::PhoneticProperties?
|
|
937
979
|
|
|
938
|
-
|
|
980
|
+
# Sets phonetic (furigana) guide properties for the sheet.
|
|
981
|
+
#
|
|
982
|
+
# @param spec [Hash, Integer, nil] Options hash or font ID integer.
|
|
983
|
+
# @return [Hash[Symbol, untyped], Integer, nil]
|
|
984
|
+
# @api public
|
|
985
|
+
# : (Hash[Symbol, untyped] | Integer | nil spec) -> (Hash[Symbol, untyped] | Integer | nil)
|
|
986
|
+
def phonetic_properties=: (Hash[Symbol, untyped] | Integer | nil spec) -> (Hash[Symbol, untyped] | Integer | nil)
|
|
939
987
|
|
|
940
|
-
|
|
988
|
+
# Gets the internal code name of the worksheet.
|
|
989
|
+
#
|
|
990
|
+
# @return [String, nil]
|
|
991
|
+
# @api public
|
|
992
|
+
# : () -> String?
|
|
993
|
+
def code_name: () -> String?
|
|
941
994
|
|
|
942
|
-
# Sets
|
|
995
|
+
# Sets the internal code name of the worksheet.
|
|
943
996
|
#
|
|
944
997
|
# @param val [String, Symbol, nil] The code name.
|
|
945
998
|
# @return [String, nil]
|
|
946
999
|
# @api public
|
|
947
|
-
# : (
|
|
948
|
-
def code_name
|
|
1000
|
+
# : (String | Symbol | nil val) -> String?
|
|
1001
|
+
def code_name=: (String | Symbol | nil val) -> String?
|
|
949
1002
|
|
|
950
|
-
|
|
1003
|
+
# Returns whether page setup fits content to page width/height.
|
|
1004
|
+
#
|
|
1005
|
+
# @return [Boolean]
|
|
1006
|
+
# @api public
|
|
1007
|
+
# : () -> bool
|
|
1008
|
+
def fit_to_page?: () -> bool
|
|
951
1009
|
|
|
952
|
-
#
|
|
953
|
-
# When enabled, optionally sets fit_to_width and/or fit_to_height on page_setup.
|
|
1010
|
+
# Sets whether page setup fits content to page width/height.
|
|
954
1011
|
#
|
|
955
1012
|
# @param enabled [Boolean, nil] Whether to fit to page.
|
|
956
|
-
# @
|
|
957
|
-
# @param height [Integer, nil] Pages tall to fit to.
|
|
958
|
-
# @return [Boolean, void]
|
|
1013
|
+
# @return [Boolean]
|
|
959
1014
|
# @api public
|
|
960
|
-
# : (
|
|
961
|
-
def fit_to_page
|
|
1015
|
+
# : (bool? enabled) -> bool??
|
|
1016
|
+
def fit_to_page=: (bool? enabled) -> bool?
|
|
962
1017
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1018
|
+
# Gets worksheet calculation properties (<sheetCalcPr>).
|
|
1019
|
+
#
|
|
1020
|
+
# @return [Elements::SheetCalcProperties, nil]
|
|
1021
|
+
# @api public
|
|
1022
|
+
# : () -> Elements::SheetCalcProperties?
|
|
1023
|
+
def sheet_calc_properties: () -> Elements::SheetCalcProperties?
|
|
966
1024
|
|
|
967
|
-
#
|
|
1025
|
+
# Sets worksheet calculation properties (<sheetCalcPr>).
|
|
968
1026
|
#
|
|
969
1027
|
# @param spec [Hash, nil] Calculation properties hash.
|
|
970
|
-
# @param full_calc_on_load [Boolean, nil] Whether to recalculate when loading.
|
|
971
1028
|
# @return [Hash, nil]
|
|
972
1029
|
# @api public
|
|
973
|
-
# : (
|
|
974
|
-
def
|
|
975
|
-
|
|
976
|
-
alias sheet_calc_pr= sheet_calc_pr
|
|
977
|
-
|
|
978
|
-
alias calc_pr sheet_calc_pr
|
|
979
|
-
|
|
980
|
-
alias calc_pr= sheet_calc_pr
|
|
1030
|
+
# : (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
1031
|
+
def sheet_calc_properties=: (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
981
1032
|
end
|
|
982
1033
|
|
|
983
1034
|
# Returns the list of worksheet names created in this workbook so far.
|
|
@@ -990,35 +1041,50 @@ module Xlsxrb
|
|
|
990
1041
|
# Adds a new sheet to the workbook and starts streaming rows into it.
|
|
991
1042
|
#
|
|
992
1043
|
# @param name [String, nil] Sheet name (max 31 characters).
|
|
1044
|
+
# @param state [Symbol, String, nil] Sheet visibility state (:visible, :hidden, :very_hidden).
|
|
1045
|
+
# @param tab_color [String, Hash, Symbol, nil] Tab color hex string (e.g. "FF0000") or hash options.
|
|
1046
|
+
# @param code_name [String, Symbol, nil] Internal VBA code name of the sheet.
|
|
993
1047
|
# @param opts [Hash] Sheet-level configuration.
|
|
994
1048
|
# @yield [sheet_proxy]
|
|
995
1049
|
# @yieldparam sheet_proxy [WorksheetProxy] The streaming sheet proxy.
|
|
996
1050
|
# @return [String] The sheet name.
|
|
997
1051
|
# @api public
|
|
998
|
-
# : (?String? name, **untyped opts) ?{ (WorksheetProxy) -> void } ->
|
|
999
|
-
def sheet: (?String? name, **untyped opts) ?{ (WorksheetProxy) -> void } ->
|
|
1052
|
+
# : (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetProxy) -> void } -> String
|
|
1053
|
+
def sheet: (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetProxy) -> void } -> String
|
|
1054
|
+
|
|
1055
|
+
# Returns a WorksheetProxy for the current or named sheet.
|
|
1056
|
+
#
|
|
1057
|
+
# @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
|
|
1058
|
+
# @yield [proxy]
|
|
1059
|
+
# @yieldparam proxy [WorksheetProxy]
|
|
1060
|
+
# @return [WorksheetProxy]
|
|
1061
|
+
# @api public
|
|
1062
|
+
# : (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetProxy) -> void } -> WorksheetProxy
|
|
1063
|
+
def []: (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetProxy) -> void } -> WorksheetProxy
|
|
1000
1064
|
|
|
1001
1065
|
# Internal: Start or switch to a named sheet (internal helper).
|
|
1066
|
+
# @api private
|
|
1002
1067
|
# : (?String? name, ?state: Symbol) ?{ (WorksheetProxy) -> void } -> (WorksheetProxy | nil)
|
|
1003
1068
|
def internal_sheet_setup: (?String? name, ?state: Symbol) ?{ (WorksheetProxy) -> void } -> (WorksheetProxy | nil)
|
|
1004
1069
|
|
|
1005
|
-
|
|
1070
|
+
# @api private
|
|
1071
|
+
# : () -> void
|
|
1072
|
+
def start_sheet_entry: () -> void
|
|
1006
1073
|
|
|
1007
1074
|
# Appends a row of values to the active sheet.
|
|
1008
1075
|
#
|
|
1009
1076
|
# @param values [Array<Object>, Hash] The cell values.
|
|
1010
|
-
# @param
|
|
1077
|
+
# @param cell_styles [String, Symbol, Array, Hash, nil] Style names or inline style definitions to apply to cells.
|
|
1078
|
+
# @param row_style [Integer, Symbol, String, Hash, nil] Row style format or index.
|
|
1011
1079
|
# @param height [Float, Integer, nil] The row height in points (0 - 409).
|
|
1012
1080
|
# @param hidden [Boolean] Whether the row is hidden.
|
|
1013
1081
|
# @param custom_height [Boolean] Whether custom row height is set.
|
|
1014
1082
|
# @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
|
|
1015
|
-
# @param
|
|
1083
|
+
# @param collapsed [Boolean] Whether the row is collapsed.
|
|
1016
1084
|
# @return [void]
|
|
1017
1085
|
# @api public
|
|
1018
|
-
# : (Array[untyped] | Hash[untyped, untyped] values, ?
|
|
1019
|
-
def row: (Array[untyped] | Hash[untyped, untyped] values, ?
|
|
1020
|
-
|
|
1021
|
-
alias add_row row
|
|
1086
|
+
# : (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
1087
|
+
def row: (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
1022
1088
|
|
|
1023
1089
|
# Appends a row to the worksheet and returns self for chaining.
|
|
1024
1090
|
#
|
|
@@ -1033,9 +1099,6 @@ module Xlsxrb
|
|
|
1033
1099
|
|
|
1034
1100
|
# Advances the row cursor by count without writing empty row elements.
|
|
1035
1101
|
#
|
|
1036
|
-
# @example Skip one row
|
|
1037
|
-
# w.skip_row
|
|
1038
|
-
#
|
|
1039
1102
|
# @example Skip multiple rows
|
|
1040
1103
|
# w.skip_rows(3)
|
|
1041
1104
|
#
|
|
@@ -1045,19 +1108,27 @@ module Xlsxrb
|
|
|
1045
1108
|
# : (?Integer count) -> void
|
|
1046
1109
|
def skip_rows: (?Integer count) -> void
|
|
1047
1110
|
|
|
1048
|
-
alias skip_row skip_rows
|
|
1049
|
-
|
|
1050
1111
|
# Sets column formatting and properties for one or multiple columns.
|
|
1051
1112
|
#
|
|
1052
|
-
# @param index [Integer, String, Range, Array] Column index (0-based)
|
|
1113
|
+
# @param index [Integer, String, Symbol, Range, Array] Column index (0-based), letter ("A", :A), range, or array.
|
|
1053
1114
|
# @param width [Float, Integer, nil] Column width in character units (0 - 255).
|
|
1054
1115
|
# @param hidden [Boolean] Whether the column is hidden.
|
|
1116
|
+
# @param custom_width [Boolean] Whether custom width flag is set.
|
|
1117
|
+
# @param outline_level [Integer, nil] Grouping/outline level.
|
|
1055
1118
|
# @param collapsed [Boolean] Whether the column is collapsed.
|
|
1056
1119
|
# @param style [Integer, Symbol, String, Hash, nil] Column style format or index.
|
|
1120
|
+
# @param best_fit [Boolean] Whether the column automatically fits content.
|
|
1057
1121
|
# @return [void]
|
|
1058
1122
|
# @api public
|
|
1059
|
-
# : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?) -> void
|
|
1060
|
-
def column: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?) -> void
|
|
1123
|
+
# : (Integer | String | Symbol | Range[Integer | String | Symbol] | Array[Integer | String | Symbol] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?best_fit: bool) -> void
|
|
1124
|
+
def column: (Integer | String | Symbol | Range[Integer | String | Symbol] | Array[Integer | String | Symbol] index, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool, ?style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?best_fit: bool) -> void
|
|
1125
|
+
|
|
1126
|
+
# Returns column configurations defined for the active worksheet.
|
|
1127
|
+
#
|
|
1128
|
+
# @return [Array<Elements::Column>]
|
|
1129
|
+
# @api public
|
|
1130
|
+
# : () -> Array[Elements::Column]
|
|
1131
|
+
def columns: () -> Array[Elements::Column]
|
|
1061
1132
|
|
|
1062
1133
|
# Groups multiple columns together with outline hierarchy.
|
|
1063
1134
|
#
|
|
@@ -1078,12 +1149,6 @@ module Xlsxrb
|
|
|
1078
1149
|
# : (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?level: Integer, ?collapsed: bool, ?hidden: bool, ?width: Float | Integer | nil, ?style: untyped) -> void
|
|
1079
1150
|
def group_columns: (Integer | String | Range[Integer | String] | Array[Integer | String] index, ?level: Integer, ?collapsed: bool, ?hidden: bool, ?width: Float | Integer | nil, ?style: untyped) -> void
|
|
1080
1151
|
|
|
1081
|
-
alias group_column group_columns
|
|
1082
|
-
|
|
1083
|
-
alias group_cols group_columns
|
|
1084
|
-
|
|
1085
|
-
alias group_col group_columns
|
|
1086
|
-
|
|
1087
1152
|
# Groups multiple rows with outline hierarchy with a block.
|
|
1088
1153
|
#
|
|
1089
1154
|
# @example Group rows with a block
|
|
@@ -1102,9 +1167,10 @@ module Xlsxrb
|
|
|
1102
1167
|
# : (?untyped rows, ?level: Integer, ?collapsed: bool, ?hidden: bool) ?{ (self) -> void } -> void
|
|
1103
1168
|
def group_rows: (?untyped rows, ?level: Integer, ?collapsed: bool, ?hidden: bool) ?{ (self) -> void } -> void
|
|
1104
1169
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
#
|
|
1170
|
+
# Configures or queries worksheet-level outline and grouping view properties.
|
|
1171
|
+
#
|
|
1172
|
+
# When called with no arguments, returns the outline properties Hash.
|
|
1173
|
+
# When called with arguments, updates outline properties and returns nil.
|
|
1108
1174
|
#
|
|
1109
1175
|
# @example Show summary row below detail rows
|
|
1110
1176
|
# sheet.outline_properties(summary_below: true, summary_right: true)
|
|
@@ -1112,25 +1178,33 @@ module Xlsxrb
|
|
|
1112
1178
|
# @param summary_below [Boolean, nil] Flag indicating if summary rows appear below detail rows.
|
|
1113
1179
|
# @param summary_right [Boolean, nil] Flag indicating if summary columns appear to the right of detail columns.
|
|
1114
1180
|
# @param show_outline_symbols [Boolean, nil] Flag indicating whether outline symbols are visible.
|
|
1115
|
-
# @param show_symbols [Boolean, nil] Alias for show_outline_symbols.
|
|
1116
1181
|
# @param apply_styles [Boolean, nil] Flag indicating whether automatic styles apply to outlines.
|
|
1117
1182
|
# @param opts [Hash] Additional options.
|
|
1118
|
-
# @return [Hash]
|
|
1183
|
+
# @return [Hash<Symbol, untyped>, void]
|
|
1119
1184
|
# @api public
|
|
1120
|
-
# : (
|
|
1121
|
-
|
|
1185
|
+
# : () -> Hash[Symbol, untyped]
|
|
1186
|
+
# : (?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, ?apply_styles: bool?, **untyped opts) -> void
|
|
1187
|
+
def outline_properties: () -> Hash[Symbol, untyped]
|
|
1188
|
+
| (?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, ?apply_styles: bool?, **untyped opts) -> void
|
|
1122
1189
|
|
|
1123
|
-
|
|
1190
|
+
# Sets worksheet outline and grouping view properties.
|
|
1191
|
+
#
|
|
1192
|
+
# @param opts [Hash] Outline properties.
|
|
1193
|
+
# @return [void]
|
|
1194
|
+
# @api public
|
|
1195
|
+
# : (Hash[Symbol, untyped] opts) -> void
|
|
1196
|
+
def outline_properties=: (Hash[Symbol, untyped] opts) -> void
|
|
1124
1197
|
|
|
1125
1198
|
# Adds a chart to the current worksheet.
|
|
1126
1199
|
#
|
|
1200
|
+
# @param type [Symbol, String, nil] Optional chart type (e.g. :bar, :line).
|
|
1127
1201
|
# @param options [Hash] Chart options.
|
|
1128
1202
|
# @yield [builder]
|
|
1129
1203
|
# @yieldparam builder [Xlsxrb::ChartBuilder]
|
|
1130
1204
|
# @return [void]
|
|
1131
1205
|
# @api public
|
|
1132
|
-
# : (**untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
1133
|
-
def chart: (**untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
1206
|
+
# : (?Symbol | String? type, **untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
1207
|
+
def chart: (?Symbol | String? type, **untyped options) ?{ (ChartBuilder) -> void } -> void
|
|
1134
1208
|
|
|
1135
1209
|
# Adds a hyperlink on a cell.
|
|
1136
1210
|
#
|
|
@@ -1144,13 +1218,20 @@ module Xlsxrb
|
|
|
1144
1218
|
# : (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
1145
1219
|
def hyperlink: (String | Integer cell, ?(String | Elements::Hyperlink)? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
1146
1220
|
|
|
1147
|
-
#
|
|
1221
|
+
# Returns the auto-filter range on the active sheet, or nil if none.
|
|
1148
1222
|
#
|
|
1149
|
-
# @
|
|
1150
|
-
# @return [void]
|
|
1223
|
+
# @return [String, nil]
|
|
1151
1224
|
# @api public
|
|
1152
|
-
# : (
|
|
1153
|
-
def auto_filter: (
|
|
1225
|
+
# : () -> String?
|
|
1226
|
+
def auto_filter: () -> String?
|
|
1227
|
+
|
|
1228
|
+
# Sets the auto-filter range for the current worksheet.
|
|
1229
|
+
#
|
|
1230
|
+
# @param range [String, nil] Cell range (e.g. "A1:E100").
|
|
1231
|
+
# @return [String, nil]
|
|
1232
|
+
# @api public
|
|
1233
|
+
# : (String? range) -> String?
|
|
1234
|
+
def auto_filter=: (String? range) -> String?
|
|
1154
1235
|
|
|
1155
1236
|
# Sets filter criteria on a column in the auto-filter.
|
|
1156
1237
|
#
|
|
@@ -1158,28 +1239,49 @@ module Xlsxrb
|
|
|
1158
1239
|
# @param filter [Hash] Filter criteria.
|
|
1159
1240
|
# @return [void]
|
|
1160
1241
|
# @api public
|
|
1161
|
-
#
|
|
1162
|
-
|
|
1242
|
+
# Sets filter criteria on an auto-filter column.
|
|
1243
|
+
#
|
|
1244
|
+
# @param col_id [Integer, String, Symbol] 0-based column index relative to auto-filter or column letter ("A", :B).
|
|
1245
|
+
# @param filter [Hash] Filter definition.
|
|
1246
|
+
# @return [void]
|
|
1247
|
+
# @api public
|
|
1248
|
+
# : (Integer | String | Symbol col_id, (Hash[untyped, untyped] | Array[untyped]) filter) -> void
|
|
1249
|
+
def filter_column: (Integer | String | Symbol col_id, Hash[untyped, untyped] | Array[untyped] filter) -> void
|
|
1163
1250
|
|
|
1164
|
-
# Configures column sort state on the active sheet.
|
|
1251
|
+
# Configures or queries column sort state on the active sheet.
|
|
1252
|
+
#
|
|
1253
|
+
# When called with no arguments, returns the {Elements::SortState} value object.
|
|
1254
|
+
# When called with arguments, updates sort state and returns nil.
|
|
1165
1255
|
#
|
|
1166
|
-
# @param ref [String] The sorted range.
|
|
1167
|
-
# @param sort_conditions [Array<Hash
|
|
1256
|
+
# @param ref [String, nil] The sorted range.
|
|
1257
|
+
# @param sort_conditions [Array<Hash>, nil] Sort conditions.
|
|
1258
|
+
# @param case_sensitive [Boolean] Whether sorting is case sensitive.
|
|
1259
|
+
# @param sort_method [String, nil] Sort method.
|
|
1168
1260
|
# @param opts [Hash] Additional options.
|
|
1261
|
+
# @return [Elements::SortState, nil, void]
|
|
1262
|
+
# @api public
|
|
1263
|
+
# : () -> Elements::SortState?
|
|
1264
|
+
# : (?String? ref, ?Array[Hash[untyped, untyped]]? sort_conditions, ?case_sensitive: bool, ?sort_method: String?, **untyped opts) -> void
|
|
1265
|
+
def sort_state: () -> Elements::SortState?
|
|
1266
|
+
| (?String? ref, ?Array[Hash[untyped, untyped]]? sort_conditions, ?case_sensitive: bool, ?sort_method: String?, **untyped opts) -> void
|
|
1267
|
+
|
|
1268
|
+
# Sets column sort state on the active sheet.
|
|
1269
|
+
#
|
|
1270
|
+
# @param opts [Elements::SortState, Hash, nil] Sort state options.
|
|
1169
1271
|
# @return [void]
|
|
1170
1272
|
# @api public
|
|
1171
|
-
# : (
|
|
1172
|
-
def sort_state
|
|
1273
|
+
# : (Elements::SortState | Hash[Symbol, untyped] | nil opts) -> void
|
|
1274
|
+
def sort_state=: (Elements::SortState | Hash[Symbol, untyped] | nil opts) -> void
|
|
1173
1275
|
|
|
1174
1276
|
# Adds a data validation rule.
|
|
1175
1277
|
#
|
|
1176
1278
|
# @param sqref [String, nil] Cell range.
|
|
1177
|
-
# @param opts [Hash] Validation options (or coordinate keywords: `columns:`, `rows:`, `except_rows:`, `in:`).
|
|
1279
|
+
# @param opts [Hash] Validation options (or coordinate keywords: `columns:`, `rows:`, `except_rows:`, `list:`, `in:`).
|
|
1178
1280
|
# @yield [data_validation_builder] Optional configuration block.
|
|
1179
1281
|
# @return [void]
|
|
1180
1282
|
# @api public
|
|
1181
1283
|
# : (?String? sqref, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
1182
|
-
def
|
|
1284
|
+
def data_validation: (?String? sqref, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
1183
1285
|
|
|
1184
1286
|
# Adds a conditional formatting rule.
|
|
1185
1287
|
# Supports block configuration via {ConditionalFormatBuilder} and coordinate targeting (:columns, :rows).
|
|
@@ -1213,33 +1315,34 @@ module Xlsxrb
|
|
|
1213
1315
|
# @param source_ref [String] Source data range.
|
|
1214
1316
|
# @param row_fields [Array<Integer>] 0-based field indices for rows.
|
|
1215
1317
|
# @param data_fields [Array<Hash>] Data fields.
|
|
1216
|
-
# @param
|
|
1217
|
-
# @param
|
|
1318
|
+
# @param column_fields [Array<Integer>, nil] 0-based field indices for columns.
|
|
1319
|
+
# @param ref [String, nil] Top-left destination cell (default: "E1").
|
|
1218
1320
|
# @param name [String, nil] Pivot table name.
|
|
1219
1321
|
# @param field_names [Array<String>, nil] Override field names.
|
|
1220
|
-
# @param items [Array, nil] Items
|
|
1322
|
+
# @param items [Hash{Integer => Array}, nil] Items of each field, by 0-based field index.
|
|
1221
1323
|
# @param opts [Hash] Additional options.
|
|
1222
1324
|
# @return [void]
|
|
1223
1325
|
# @api public
|
|
1224
|
-
# : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?
|
|
1225
|
-
def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?
|
|
1326
|
+
# : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?column_fields: untyped, ?ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1327
|
+
def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?column_fields: untyped, ?ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1226
1328
|
|
|
1227
1329
|
# Adds a comment to a cell.
|
|
1228
1330
|
#
|
|
1229
1331
|
# @param cell [String, Integer] Cell coordinate (e.g. "A1").
|
|
1230
1332
|
# @param text [String] Comment text.
|
|
1231
1333
|
# @param author [String] Author name.
|
|
1334
|
+
# @param visible [Boolean] Whether the comment is always shown instead of on hover.
|
|
1232
1335
|
# @return [void]
|
|
1233
1336
|
# @api public
|
|
1234
|
-
# : (String | Integer cell, String text, ?author: ::String) -> void
|
|
1235
|
-
def comment: (String | Integer cell, String text, ?author: ::String) -> void
|
|
1337
|
+
# : (String | Integer cell, String text, ?author: ::String, ?visible: bool) -> void
|
|
1338
|
+
def comment: (String | Integer cell, String text, ?author: ::String, ?visible: bool) -> void
|
|
1236
1339
|
|
|
1237
1340
|
# Adds a threaded comment to a cell.
|
|
1238
1341
|
#
|
|
1239
1342
|
# @param cell [String, Integer] Cell coordinate (e.g. "A1").
|
|
1240
1343
|
# @param text [String] Comment text.
|
|
1241
1344
|
# @param author [String] Author name.
|
|
1242
|
-
# @param timestamp [String, Time, nil] Optional ISO 8601 timestamp.
|
|
1345
|
+
# @param visible [Boolean] Whether the comment is always shown instead of on hover. # @param timestamp [String, Time, nil] Optional ISO 8601 timestamp.
|
|
1243
1346
|
# @param id [String, nil] Optional GUID for this comment.
|
|
1244
1347
|
# @param parent_id [String, nil] Optional parent comment GUID for replies.
|
|
1245
1348
|
# @param done [Boolean, nil] Optional resolved flag.
|
|
@@ -1250,8 +1353,6 @@ module Xlsxrb
|
|
|
1250
1353
|
# : (String | Integer cell, String text, ?author: untyped, ?timestamp: untyped, ?id: String?, ?parent_id: String?, ?done: bool?, ?user_id: String?, ?provider_id: String?) -> void
|
|
1251
1354
|
def threaded_comment: (String | Integer cell, String text, ?author: untyped, ?timestamp: untyped, ?id: String?, ?parent_id: String?, ?done: bool?, ?user_id: String?, ?provider_id: String?) -> void
|
|
1252
1355
|
|
|
1253
|
-
alias add_threaded_comment threaded_comment
|
|
1254
|
-
|
|
1255
1356
|
# Adds a sparkline group.
|
|
1256
1357
|
#
|
|
1257
1358
|
# @param sparklines [Array<Hash>] Sparkline definitions.
|
|
@@ -1262,69 +1363,93 @@ module Xlsxrb
|
|
|
1262
1363
|
# : (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
1263
1364
|
def sparkline_group: (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
1264
1365
|
|
|
1265
|
-
#
|
|
1266
|
-
#
|
|
1267
|
-
# @example Add a line sparkline
|
|
1268
|
-
# writer.add_sparkline(location: "F1", range: "A1:E1")
|
|
1269
|
-
#
|
|
1270
|
-
# @example Add a column sparkline with high/low markers
|
|
1271
|
-
# writer.add_sparkline(location: "F2", range: "A2:E2", type: :column, high: true, low: true)
|
|
1366
|
+
# Merges a range of cells into a single cell.
|
|
1272
1367
|
#
|
|
1273
|
-
# @example
|
|
1274
|
-
#
|
|
1368
|
+
# @example
|
|
1369
|
+
# sheet.merge("A1:C1")
|
|
1275
1370
|
#
|
|
1276
|
-
# @param
|
|
1277
|
-
# @param range [String, nil] Data range for the sparkline (e.g. "A1:E1").
|
|
1278
|
-
# @param type [Symbol, String, nil] Sparkline type (:line, :column, :win_loss / :stacked).
|
|
1279
|
-
# @param opts [Hash] Additional sparkline options.
|
|
1371
|
+
# @param range [String] Cell range (e.g. "A1:B2").
|
|
1280
1372
|
# @return [void]
|
|
1281
1373
|
# @api public
|
|
1282
|
-
# : (
|
|
1283
|
-
def
|
|
1374
|
+
# : (String range) -> void
|
|
1375
|
+
def merge: (String range) -> void
|
|
1284
1376
|
|
|
1285
|
-
#
|
|
1377
|
+
# Configures or queries freeze panes (<pane state="frozen">).
|
|
1286
1378
|
#
|
|
1287
|
-
#
|
|
1288
|
-
#
|
|
1289
|
-
#
|
|
1290
|
-
# @param
|
|
1291
|
-
# @param
|
|
1292
|
-
# @param
|
|
1293
|
-
# @
|
|
1379
|
+
# When called with no arguments, returns the {Elements::FreezePane} value object or nil.
|
|
1380
|
+
# When called with arguments, configures the freeze pane and returns nil.
|
|
1381
|
+
#
|
|
1382
|
+
# @param row [Integer, nil] Number of rows to freeze.
|
|
1383
|
+
# @param column [Integer, String, nil] Number of columns to freeze.
|
|
1384
|
+
# @param top_left_cell [String, nil] Top-left cell reference in bottom-right pane.
|
|
1385
|
+
# @param active_pane [String, Symbol, nil] Active pane identifier.
|
|
1386
|
+
# @return [Elements::FreezePane, nil, void]
|
|
1294
1387
|
# @api public
|
|
1295
|
-
# : (
|
|
1296
|
-
|
|
1388
|
+
# : () -> Elements::FreezePane?
|
|
1389
|
+
# : (?row: Integer | nil, ?column: (Integer | String)?, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
1390
|
+
def freeze_pane: () -> Elements::FreezePane?
|
|
1391
|
+
| (?row: Integer | nil, ?column: (Integer | String)?, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
1297
1392
|
|
|
1298
|
-
#
|
|
1393
|
+
# Sets or clears freeze pane configuration.
|
|
1299
1394
|
#
|
|
1300
|
-
# @param
|
|
1301
|
-
# @param col [Integer, String] Number of columns to freeze.
|
|
1395
|
+
# @param opts [Elements::FreezePane, Hash, nil] Freeze pane options.
|
|
1302
1396
|
# @return [void]
|
|
1303
1397
|
# @api public
|
|
1304
|
-
# : (
|
|
1305
|
-
def freeze_pane
|
|
1398
|
+
# : (Elements::FreezePane | Hash[Symbol, untyped] | nil opts) -> void
|
|
1399
|
+
def freeze_pane=: (Elements::FreezePane | Hash[Symbol, untyped] | nil opts) -> void
|
|
1306
1400
|
|
|
1307
|
-
# Splits window panes without freezing.
|
|
1401
|
+
# Splits window panes without freezing or queries split pane settings (<pane>).
|
|
1308
1402
|
#
|
|
1309
|
-
#
|
|
1310
|
-
#
|
|
1403
|
+
# When called with no arguments, returns the {Elements::SplitPane} value object or nil.
|
|
1404
|
+
# When called with arguments, configures the split pane and returns nil.
|
|
1405
|
+
#
|
|
1406
|
+
# @param x_split [Integer, nil] Horizontal split in points.
|
|
1407
|
+
# @param y_split [Integer, nil] Vertical split in points.
|
|
1311
1408
|
# @param top_left_cell [String, nil] Top-left cell reference in bottom-right pane.
|
|
1409
|
+
# @param active_pane [String, Symbol, nil] Active pane identifier.
|
|
1410
|
+
# @param state [String, Symbol, nil] Split state.
|
|
1411
|
+
# @return [Elements::SplitPane, nil, void]
|
|
1412
|
+
# @api public
|
|
1413
|
+
# : () -> Elements::SplitPane?
|
|
1414
|
+
# : (?x_split: Integer | nil, ?y_split: Integer | nil, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
1415
|
+
def split_pane: () -> Elements::SplitPane?
|
|
1416
|
+
| (?x_split: Integer | nil, ?y_split: Integer | nil, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
1417
|
+
|
|
1418
|
+
# Sets or clears split pane configuration.
|
|
1419
|
+
#
|
|
1420
|
+
# @param opts [Elements::SplitPane, Hash, nil] Split pane options.
|
|
1312
1421
|
# @return [void]
|
|
1313
1422
|
# @api public
|
|
1314
|
-
# : (
|
|
1315
|
-
def split_pane
|
|
1423
|
+
# : (Elements::SplitPane | Hash[Symbol, untyped] | nil opts) -> void
|
|
1424
|
+
def split_pane=: (Elements::SplitPane | Hash[Symbol, untyped] | nil opts) -> void
|
|
1316
1425
|
|
|
1317
|
-
# Sets the active cell selection on the current sheet.
|
|
1426
|
+
# Sets or queries the active cell selection on the current sheet (<selection>).
|
|
1427
|
+
#
|
|
1428
|
+
# When called with no arguments, returns the selection ({Elements::Selection}, Array, or nil).
|
|
1429
|
+
# When called with arguments, updates the selection and returns nil.
|
|
1318
1430
|
#
|
|
1319
|
-
# @param active_cell [String] Active cell reference (e.g. "A1").
|
|
1431
|
+
# @param active_cell [String, nil] Active cell reference (e.g. "A1") or range (e.g. "A1:D10").
|
|
1320
1432
|
# @param sqref [String, nil] Selection range.
|
|
1321
1433
|
# @param pane [String, Symbol, nil] Target pane.
|
|
1434
|
+
# @return [Elements::Selection, Array<Elements::Selection>, nil, void]
|
|
1435
|
+
# @api public
|
|
1436
|
+
# : () -> (Elements::Selection | Array[Elements::Selection])?
|
|
1437
|
+
# : (?String? active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
1438
|
+
def selection: () -> (Elements::Selection | Array[Elements::Selection])?
|
|
1439
|
+
| (?String? active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
1440
|
+
|
|
1441
|
+
# Sets or clears the selection configuration.
|
|
1442
|
+
#
|
|
1443
|
+
# @param opts [Elements::Selection, Array<Elements::Selection, Hash>, Hash, nil]
|
|
1322
1444
|
# @return [void]
|
|
1323
1445
|
# @api public
|
|
1324
|
-
# : (
|
|
1325
|
-
def
|
|
1446
|
+
# : (Elements::Selection | Array[Elements::Selection | Hash[Symbol, untyped]] | Hash[Symbol, untyped] | nil opts) -> void
|
|
1447
|
+
def selection=: (Elements::Selection | Array[Elements::Selection | Hash[Symbol, untyped]] | Hash[Symbol, untyped] | nil opts) -> void
|
|
1326
1448
|
|
|
1327
|
-
#
|
|
1449
|
+
# Configures or queries page margins in inches for printing (<pageMargins>).
|
|
1450
|
+
#
|
|
1451
|
+
# When called with no arguments, returns the {Elements::PageMargins} value object or nil.
|
|
1452
|
+
# When called with arguments, configures page margins and returns nil.
|
|
1328
1453
|
#
|
|
1329
1454
|
# @param left [Float, nil] Left margin.
|
|
1330
1455
|
# @param right [Float, nil] Right margin.
|
|
@@ -1332,91 +1457,141 @@ module Xlsxrb
|
|
|
1332
1457
|
# @param bottom [Float, nil] Bottom margin.
|
|
1333
1458
|
# @param header [Float, nil] Header margin.
|
|
1334
1459
|
# @param footer [Float, nil] Footer margin.
|
|
1335
|
-
# @return [void]
|
|
1460
|
+
# @return [Elements::PageMargins, nil, void]
|
|
1336
1461
|
# @api public
|
|
1462
|
+
# : () -> Elements::PageMargins?
|
|
1337
1463
|
# : (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
|
|
1338
|
-
def page_margins: (
|
|
1464
|
+
def page_margins: () -> Elements::PageMargins?
|
|
1465
|
+
| (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
|
|
1339
1466
|
|
|
1340
|
-
# Sets page
|
|
1467
|
+
# Sets or clears page margins configuration.
|
|
1341
1468
|
#
|
|
1342
|
-
# @param opts [Hash
|
|
1469
|
+
# @param opts [Hash, Elements::PageMargins, nil]
|
|
1343
1470
|
# @return [void]
|
|
1344
1471
|
# @api public
|
|
1472
|
+
# : (Hash[Symbol, untyped] | Elements::PageMargins | nil opts) -> void
|
|
1473
|
+
def page_margins=: (Hash[Symbol, untyped] | Elements::PageMargins | nil opts) -> void
|
|
1474
|
+
|
|
1475
|
+
# Configures or queries page setup configuration (<pageSetup>).
|
|
1476
|
+
#
|
|
1477
|
+
# When called with no arguments, returns the {Elements::PageSetup} value object.
|
|
1478
|
+
# When called with keyword arguments, updates page setup and returns nil.
|
|
1479
|
+
#
|
|
1480
|
+
# @param opts [Hash] Page setup options (e.g. orientation: :landscape).
|
|
1481
|
+
# @return [Elements::PageSetup, void]
|
|
1482
|
+
# @api public
|
|
1483
|
+
# : () -> Elements::PageSetup
|
|
1345
1484
|
# : (**untyped opts) -> void
|
|
1346
|
-
def page_setup: (
|
|
1485
|
+
def page_setup: () -> Elements::PageSetup
|
|
1486
|
+
| (**untyped opts) -> void
|
|
1347
1487
|
|
|
1348
|
-
#
|
|
1488
|
+
# Sets page setup configuration.
|
|
1489
|
+
#
|
|
1490
|
+
# @param opts [Hash, Elements::PageSetup]
|
|
1491
|
+
# @return [void]
|
|
1492
|
+
# @api public
|
|
1493
|
+
# : (Hash[Symbol, untyped] | Elements::PageSetup opts) -> void
|
|
1494
|
+
def page_setup=: (Hash[Symbol, untyped] | Elements::PageSetup opts) -> void
|
|
1495
|
+
|
|
1496
|
+
# Configures or queries headers and footers for printing (<headerFooter>).
|
|
1497
|
+
#
|
|
1498
|
+
# When called with no arguments, returns the {Elements::HeaderFooter} value object.
|
|
1499
|
+
# When called with keyword arguments, updates headers and footers and returns nil.
|
|
1349
1500
|
#
|
|
1350
1501
|
# @param opts [Hash] Header/footer options.
|
|
1502
|
+
# @return [Elements::HeaderFooter, void]
|
|
1503
|
+
# @api public
|
|
1504
|
+
# : () -> Elements::HeaderFooter
|
|
1505
|
+
# : (**untyped opts) -> void
|
|
1506
|
+
def header_footer: () -> Elements::HeaderFooter
|
|
1507
|
+
| (**untyped opts) -> void
|
|
1508
|
+
|
|
1509
|
+
# Sets header and footer configuration.
|
|
1510
|
+
#
|
|
1511
|
+
# @param opts [Hash, Elements::HeaderFooter]
|
|
1351
1512
|
# @return [void]
|
|
1352
1513
|
# @api public
|
|
1514
|
+
# : (Hash[Symbol, untyped] | Elements::HeaderFooter opts) -> void
|
|
1515
|
+
def header_footer=: (Hash[Symbol, untyped] | Elements::HeaderFooter opts) -> void
|
|
1516
|
+
|
|
1517
|
+
# Configures or queries print options (<printOptions>).
|
|
1518
|
+
#
|
|
1519
|
+
# When called with no arguments, returns the {Elements::PrintOptions} value object.
|
|
1520
|
+
# When called with keyword options, configures print options and returns nil.
|
|
1521
|
+
#
|
|
1522
|
+
# @param opts [Hash] Additional print options.
|
|
1523
|
+
# @return [Elements::PrintOptions, void]
|
|
1524
|
+
# @api public
|
|
1525
|
+
# : () -> Elements::PrintOptions
|
|
1353
1526
|
# : (**untyped opts) -> void
|
|
1354
|
-
def
|
|
1527
|
+
def print_options: () -> Elements::PrintOptions
|
|
1528
|
+
| (**untyped opts) -> void
|
|
1355
1529
|
|
|
1356
|
-
#
|
|
1530
|
+
# Replaces print options with the given hash or {Elements::PrintOptions} object.
|
|
1357
1531
|
#
|
|
1358
|
-
# @param
|
|
1359
|
-
# @param value [Object] Option value.
|
|
1532
|
+
# @param opts [Hash, Elements::PrintOptions]
|
|
1360
1533
|
# @return [void]
|
|
1361
1534
|
# @api public
|
|
1362
|
-
# : (Symbol
|
|
1363
|
-
def print_options
|
|
1535
|
+
# : (Hash[Symbol, untyped] | Elements::PrintOptions opts) -> void
|
|
1536
|
+
def print_options=: (Hash[Symbol, untyped] | Elements::PrintOptions opts) -> void
|
|
1364
1537
|
|
|
1365
|
-
# Sets sheet-level protection with optional password hashing.
|
|
1538
|
+
# Sets or queries sheet-level protection with optional password hashing (<sheetProtection>).
|
|
1539
|
+
#
|
|
1540
|
+
# When called with no arguments, returns the {Elements::SheetProtection} value object or nil.
|
|
1541
|
+
# When called with keyword arguments, sets sheet protection and returns nil.
|
|
1366
1542
|
#
|
|
1367
1543
|
# @param opts [Hash] Protection options.
|
|
1368
|
-
# @return [void]
|
|
1544
|
+
# @return [Elements::SheetProtection, nil, void]
|
|
1369
1545
|
# @api public
|
|
1546
|
+
# : () -> Elements::SheetProtection?
|
|
1370
1547
|
# : (**untyped opts) -> void
|
|
1371
|
-
def
|
|
1548
|
+
def sheet_protection: () -> Elements::SheetProtection?
|
|
1549
|
+
| (**untyped opts) -> void
|
|
1550
|
+
|
|
1551
|
+
# Sets or clears sheet protection configuration.
|
|
1552
|
+
#
|
|
1553
|
+
# @param opts [Elements::SheetProtection, Hash, Boolean, nil]
|
|
1554
|
+
# @return [void]
|
|
1555
|
+
# @api public
|
|
1556
|
+
# : (Elements::SheetProtection | Hash[Symbol, untyped] | bool | nil opts) -> void
|
|
1557
|
+
def sheet_protection=: (Elements::SheetProtection | Hash[Symbol, untyped] | bool | nil opts) -> void
|
|
1372
1558
|
|
|
1373
1559
|
# Inserts an embedded image into the active sheet.
|
|
1374
1560
|
#
|
|
1375
1561
|
# @param file_data [String] Binary image data.
|
|
1376
1562
|
# @param ext [String] File extension ("png", "jpeg", etc.).
|
|
1377
|
-
# @param
|
|
1563
|
+
# @param from_column [Integer, nil] Top-left starting column.
|
|
1378
1564
|
# @param from_row [Integer] Top-left starting row.
|
|
1379
|
-
# @param
|
|
1565
|
+
# @param to_column [Integer, nil] Bottom-right ending column.
|
|
1380
1566
|
# @param to_row [Integer] Bottom-right ending row.
|
|
1381
1567
|
# @param opts [Hash] Additional options.
|
|
1382
1568
|
# @return [void]
|
|
1383
1569
|
# @api public
|
|
1384
|
-
# : (String file_data, ?ext: ::String, ?
|
|
1385
|
-
def image: (String file_data, ?ext: ::String, ?
|
|
1570
|
+
# : (String file_data, ?ext: ::String, ?from_column: ::Integer?, ?from_row: ::Integer, ?to_column: ::Integer?, ?to_row: ::Integer, **untyped opts) -> void
|
|
1571
|
+
def image: (String file_data, ?ext: ::String, ?from_column: ::Integer?, ?from_row: ::Integer, ?to_column: ::Integer?, ?to_row: ::Integer, **untyped opts) -> void
|
|
1386
1572
|
|
|
1387
|
-
#
|
|
1573
|
+
# Worksheet background image (<picture>).
|
|
1388
1574
|
#
|
|
1389
|
-
# @
|
|
1390
|
-
# sheet.background_image(png_bytes, ext: "png")
|
|
1391
|
-
#
|
|
1392
|
-
# @example Set background image from file path
|
|
1393
|
-
# sheet.background_image("path/to/background.png")
|
|
1394
|
-
#
|
|
1395
|
-
# @param file_data [String, Hash, Elements::Image, nil] Image binary data, file path, or image options hash.
|
|
1396
|
-
# @param ext [String, nil] Image extension ("png", "jpeg", "jpg", "gif", etc.).
|
|
1397
|
-
# @param opts [Hash] Additional image options.
|
|
1398
|
-
# @return [Hash, nil]
|
|
1575
|
+
# @return [Elements::BackgroundImage, nil]
|
|
1399
1576
|
# @api public
|
|
1400
|
-
# : (
|
|
1401
|
-
def background_image: (
|
|
1402
|
-
|
|
1403
|
-
alias background_picture background_image
|
|
1404
|
-
|
|
1405
|
-
alias picture background_image
|
|
1577
|
+
# : () -> Elements::BackgroundImage?
|
|
1578
|
+
def background_image: () -> Elements::BackgroundImage?
|
|
1406
1579
|
|
|
1580
|
+
# Sets the worksheet background image (<picture>).
|
|
1581
|
+
#
|
|
1582
|
+
# @param val [String, Hash, Elements::Image, nil] Image binary data, file path, or image options hash.
|
|
1583
|
+
# @return [untyped]
|
|
1584
|
+
# @api public
|
|
1585
|
+
# : (untyped val) -> untyped
|
|
1407
1586
|
def background_image=: (untyped val) -> untyped
|
|
1408
1587
|
|
|
1409
|
-
alias background_picture= background_image=
|
|
1410
|
-
|
|
1411
|
-
alias picture= background_image=
|
|
1412
|
-
|
|
1413
1588
|
# Inserts a drawing shape.
|
|
1414
1589
|
#
|
|
1415
1590
|
# @param preset [String] Preset shape name.
|
|
1416
1591
|
# @param text [String, nil] Label text.
|
|
1417
|
-
# @param
|
|
1592
|
+
# @param from_column [Integer, nil] Top-left column.
|
|
1418
1593
|
# @param from_row [Integer] Top-left row.
|
|
1419
|
-
# @param
|
|
1594
|
+
# @param to_column [Integer, nil] Bottom-right column.
|
|
1420
1595
|
# @param to_row [Integer] Bottom-right row.
|
|
1421
1596
|
# @param opts [Hash] Additional options.
|
|
1422
1597
|
# @return [void]
|
|
@@ -1424,68 +1599,114 @@ module Xlsxrb
|
|
|
1424
1599
|
# : (**untyped opts) -> void
|
|
1425
1600
|
def shape: (**untyped opts) -> void
|
|
1426
1601
|
|
|
1427
|
-
# Gets
|
|
1602
|
+
# Gets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
1428
1603
|
#
|
|
1429
|
-
# @param new_state [Symbol, nil] The new state.
|
|
1430
1604
|
# @return [Symbol]
|
|
1431
1605
|
# @api public
|
|
1432
|
-
# : (
|
|
1433
|
-
def state: (
|
|
1606
|
+
# : () -> Symbol
|
|
1607
|
+
def state: () -> Symbol
|
|
1608
|
+
|
|
1609
|
+
# Sets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
1610
|
+
#
|
|
1611
|
+
# @param new_state [Symbol, String] The new state.
|
|
1612
|
+
# @return [Symbol]
|
|
1613
|
+
# @api public
|
|
1614
|
+
# : (Symbol | String new_state) -> Symbol
|
|
1615
|
+
def state=: (Symbol | String new_state) -> Symbol
|
|
1616
|
+
|
|
1617
|
+
# Gets the tab color of the current worksheet.
|
|
1618
|
+
#
|
|
1619
|
+
# @return [String, Hash, nil]
|
|
1620
|
+
# @api public
|
|
1621
|
+
# : () -> (String | Hash[Symbol, untyped] | nil)
|
|
1622
|
+
def tab_color: () -> (String | Hash[Symbol, untyped] | nil)
|
|
1434
1623
|
|
|
1435
|
-
#
|
|
1624
|
+
# Sets the tab color of the current worksheet.
|
|
1436
1625
|
#
|
|
1437
1626
|
# @param spec [String, Hash, Symbol, nil] Tab color hex string or hash options.
|
|
1438
|
-
# @param opts [Hash] Color keyword arguments (e.g. theme: 1, tint: 0.5).
|
|
1439
1627
|
# @return [String, Hash, nil]
|
|
1440
1628
|
# @api public
|
|
1441
|
-
# : (
|
|
1442
|
-
def tab_color
|
|
1629
|
+
# : (String | Symbol | Hash[Symbol, untyped] | nil spec) -> (String | Hash[Symbol, untyped] | nil)
|
|
1630
|
+
def tab_color=: (String | Symbol | Hash[Symbol, untyped] | nil spec) -> (String | Hash[Symbol, untyped] | nil)
|
|
1443
1631
|
|
|
1444
|
-
|
|
1632
|
+
# Configures or queries sheet properties (<sheetPr>).
|
|
1633
|
+
#
|
|
1634
|
+
# When called with no arguments, returns the {Elements::SheetProperties} value object.
|
|
1635
|
+
# When called with keyword options, configures properties and returns nil.
|
|
1636
|
+
#
|
|
1637
|
+
# @param opts [Hash] Additional sheet properties.
|
|
1638
|
+
# @return [Elements::SheetProperties, void]
|
|
1639
|
+
# @api public
|
|
1640
|
+
# : () -> Elements::SheetProperties
|
|
1641
|
+
# : (**untyped opts) -> void
|
|
1642
|
+
def sheet_properties: () -> Elements::SheetProperties
|
|
1643
|
+
| (**untyped opts) -> void
|
|
1445
1644
|
|
|
1446
|
-
#
|
|
1645
|
+
# Replaces worksheet properties with the given hash or {Elements::SheetProperties} object.
|
|
1447
1646
|
#
|
|
1448
|
-
# @param
|
|
1449
|
-
# @param value [Object] Property value.
|
|
1647
|
+
# @param opts [Hash, Elements::SheetProperties]
|
|
1450
1648
|
# @return [void]
|
|
1451
1649
|
# @api public
|
|
1452
|
-
# : (Symbol
|
|
1453
|
-
def sheet_properties
|
|
1650
|
+
# : (Hash[Symbol, untyped] | Elements::SheetProperties opts) -> void
|
|
1651
|
+
def sheet_properties=: (Hash[Symbol, untyped] | Elements::SheetProperties opts) -> void
|
|
1652
|
+
|
|
1653
|
+
# Configures or queries sheet view display properties (<sheetView>).
|
|
1654
|
+
#
|
|
1655
|
+
# When called with no arguments, returns the {Elements::SheetView} value object.
|
|
1656
|
+
# When called with keyword options, configures view properties and returns nil.
|
|
1657
|
+
#
|
|
1658
|
+
# @param opts [Hash] Additional view properties.
|
|
1659
|
+
# @return [Elements::SheetView, void]
|
|
1660
|
+
# @api public
|
|
1661
|
+
# : () -> Elements::SheetView
|
|
1662
|
+
# : (**untyped opts) -> void
|
|
1663
|
+
def sheet_view: () -> Elements::SheetView
|
|
1664
|
+
| (**untyped opts) -> void
|
|
1454
1665
|
|
|
1455
|
-
#
|
|
1666
|
+
# Replaces sheet view properties with the given hash or {Elements::SheetView} object.
|
|
1456
1667
|
#
|
|
1457
|
-
# @param
|
|
1458
|
-
# @param value [Object] View property value.
|
|
1668
|
+
# @param opts [Hash, Elements::SheetView]
|
|
1459
1669
|
# @return [void]
|
|
1460
1670
|
# @api public
|
|
1461
|
-
# : (Symbol
|
|
1462
|
-
def sheet_view
|
|
1671
|
+
# : (Hash[Symbol, untyped] | Elements::SheetView opts) -> void
|
|
1672
|
+
def sheet_view=: (Hash[Symbol, untyped] | Elements::SheetView opts) -> void
|
|
1463
1673
|
|
|
1464
|
-
# Configures sheet format properties (
|
|
1674
|
+
# Configures or queries sheet format properties (<sheetFormatPr>).
|
|
1675
|
+
#
|
|
1676
|
+
# When called with no arguments, returns the {Elements::SheetFormat} value object.
|
|
1677
|
+
# When called with keyword options, configures format properties and returns nil.
|
|
1465
1678
|
#
|
|
1466
|
-
# @param name [Symbol, String, Hash, nil] Property name or hash of properties.
|
|
1467
|
-
# @param value [Object, nil] Property value when name is provided.
|
|
1468
1679
|
# @param opts [Hash] Keyword arguments for sheet format properties.
|
|
1469
|
-
# @return [
|
|
1680
|
+
# @return [Elements::SheetFormat, void]
|
|
1470
1681
|
# @api public
|
|
1471
|
-
# : (
|
|
1472
|
-
|
|
1682
|
+
# : () -> Elements::SheetFormat
|
|
1683
|
+
# : (**untyped opts) -> void
|
|
1684
|
+
def sheet_format: () -> Elements::SheetFormat
|
|
1685
|
+
| (**untyped opts) -> void
|
|
1473
1686
|
|
|
1474
|
-
#
|
|
1687
|
+
# Replaces sheet format properties with the given hash or {Elements::SheetFormat} object.
|
|
1475
1688
|
#
|
|
1476
|
-
# @param
|
|
1689
|
+
# @param opts [Hash, Elements::SheetFormat]
|
|
1477
1690
|
# @return [void]
|
|
1478
1691
|
# @api public
|
|
1479
|
-
# : (
|
|
1480
|
-
def
|
|
1692
|
+
# : (Hash[Symbol, untyped] | Elements::SheetFormat opts) -> void
|
|
1693
|
+
def sheet_format=: (Hash[Symbol, untyped] | Elements::SheetFormat opts) -> void
|
|
1481
1694
|
|
|
1482
|
-
# Inserts a
|
|
1695
|
+
# Inserts a horizontal page break after the given 0-based row.
|
|
1483
1696
|
#
|
|
1484
|
-
# @param
|
|
1697
|
+
# @param row_index [Integer] 0-based row index.
|
|
1485
1698
|
# @return [void]
|
|
1486
1699
|
# @api public
|
|
1487
|
-
# : (Integer
|
|
1488
|
-
def
|
|
1700
|
+
# : (Integer row_index) -> void
|
|
1701
|
+
def row_break: (Integer row_index) -> void
|
|
1702
|
+
|
|
1703
|
+
# Inserts a vertical page break after the given column.
|
|
1704
|
+
#
|
|
1705
|
+
# @param col [Integer, String, Symbol] 0-based column index or letter ("B", :B).
|
|
1706
|
+
# @return [void]
|
|
1707
|
+
# @api public
|
|
1708
|
+
# : (Integer | String | Symbol col) -> void
|
|
1709
|
+
def column_break: (Integer | String | Symbol col) -> void
|
|
1489
1710
|
|
|
1490
1711
|
# Adds a protected range to the current sheet.
|
|
1491
1712
|
#
|
|
@@ -1498,8 +1719,6 @@ module Xlsxrb
|
|
|
1498
1719
|
# : (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
1499
1720
|
def protected_range: (String name, String sqref, ?password: String?, **untyped opts) -> void
|
|
1500
1721
|
|
|
1501
|
-
alias add_protected_range protected_range
|
|
1502
|
-
|
|
1503
1722
|
# Adds a cell watch to the current sheet.
|
|
1504
1723
|
#
|
|
1505
1724
|
# @param ref [String] Cell reference (e.g. "A1").
|
|
@@ -1508,8 +1727,6 @@ module Xlsxrb
|
|
|
1508
1727
|
# : (String ref) -> void
|
|
1509
1728
|
def cell_watch: (String ref) -> void
|
|
1510
1729
|
|
|
1511
|
-
alias add_cell_watch cell_watch
|
|
1512
|
-
|
|
1513
1730
|
# Adds an ignored error entry to the current sheet.
|
|
1514
1731
|
#
|
|
1515
1732
|
# @param sqref [String] Cell range reference (e.g. "A1" or "A1:B10").
|
|
@@ -1517,114 +1734,138 @@ module Xlsxrb
|
|
|
1517
1734
|
# @return [void]
|
|
1518
1735
|
# @api public
|
|
1519
1736
|
# : (String sqref, ?eval_error: bool, ?two_digit_text_year: bool, ?number_stored_as_text: bool, ?formula: bool, ?formula_range: bool, ?unlocked_formula: bool, ?empty_cell_reference: bool, ?list_data_validation: bool, ?calculated_column: bool) -> void
|
|
1520
|
-
def
|
|
1521
|
-
|
|
1522
|
-
alias add_ignored_error ignore_error
|
|
1737
|
+
def ignored_error: (String sqref, ?eval_error: bool, ?two_digit_text_year: bool, ?number_stored_as_text: bool, ?formula: bool, ?formula_range: bool, ?unlocked_formula: bool, ?empty_cell_reference: bool, ?list_data_validation: bool, ?calculated_column: bool) -> void
|
|
1523
1738
|
|
|
1524
1739
|
# Returns the ignored error entries configured for the current sheet.
|
|
1525
1740
|
#
|
|
1526
|
-
# @return [Array<
|
|
1741
|
+
# @return [Array<Elements::IgnoredError>]
|
|
1527
1742
|
# @api public
|
|
1528
|
-
# : () -> Array[
|
|
1529
|
-
def ignored_errors: () -> Array[
|
|
1743
|
+
# : () -> Array[Elements::IgnoredError]
|
|
1744
|
+
def ignored_errors: () -> Array[Elements::IgnoredError]
|
|
1530
1745
|
|
|
1531
|
-
#
|
|
1746
|
+
# Phonetic (furigana) guide properties for the current sheet.
|
|
1532
1747
|
#
|
|
1533
|
-
# @
|
|
1534
|
-
# Returns the current phonetic properties.
|
|
1535
|
-
# @return [Hash, nil]
|
|
1536
|
-
# @overload phonetic_properties(spec = nil, font_id: nil, type: nil, alignment: nil)
|
|
1537
|
-
# Sets phonetic properties for the current sheet.
|
|
1538
|
-
# @param spec [Hash, Integer, nil]
|
|
1539
|
-
# @param font_id [Integer, nil]
|
|
1540
|
-
# @param type [Symbol, String, nil]
|
|
1541
|
-
# @param alignment [Symbol, String, nil]
|
|
1542
|
-
# @return [Hash, nil]
|
|
1748
|
+
# @return [Elements::PhoneticProperties, nil]
|
|
1543
1749
|
# @api public
|
|
1544
|
-
# : (
|
|
1545
|
-
def phonetic_properties: (
|
|
1750
|
+
# : () -> Elements::PhoneticProperties?
|
|
1751
|
+
def phonetic_properties: () -> Elements::PhoneticProperties?
|
|
1546
1752
|
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1753
|
+
# Sets phonetic (furigana) guide properties for the current sheet.
|
|
1754
|
+
#
|
|
1755
|
+
# @param spec [Hash, Integer, nil]
|
|
1756
|
+
# @return [Hash[Symbol, untyped], Integer, nil]
|
|
1757
|
+
# @api public
|
|
1758
|
+
# : (Hash[Symbol, untyped] | Integer | nil spec) -> (Hash[Symbol, untyped] | Integer | nil)
|
|
1759
|
+
def phonetic_properties=: (Hash[Symbol, untyped] | Integer | nil spec) -> (Hash[Symbol, untyped] | Integer | nil)
|
|
1550
1760
|
|
|
1551
|
-
|
|
1761
|
+
# Gets the internal code name of the current worksheet (or workbook if no sheet is open).
|
|
1762
|
+
#
|
|
1763
|
+
# @return [String, nil]
|
|
1764
|
+
# @api public
|
|
1765
|
+
# : () -> String?
|
|
1766
|
+
def code_name: () -> String?
|
|
1552
1767
|
|
|
1553
|
-
# Sets
|
|
1768
|
+
# Sets the internal code name of the current worksheet (or workbook if no sheet is open).
|
|
1554
1769
|
#
|
|
1555
1770
|
# @param val [String, Symbol, nil] The code name.
|
|
1556
1771
|
# @return [String, nil]
|
|
1557
1772
|
# @api public
|
|
1558
|
-
# : (
|
|
1559
|
-
def code_name
|
|
1773
|
+
# : (String | Symbol | nil val) -> String?
|
|
1774
|
+
def code_name=: (String | Symbol | nil val) -> String?
|
|
1560
1775
|
|
|
1561
|
-
|
|
1776
|
+
# Returns whether page setup fits content to page width/height for the current sheet.
|
|
1777
|
+
#
|
|
1778
|
+
# @return [Boolean]
|
|
1779
|
+
# @api public
|
|
1780
|
+
# : () -> bool
|
|
1781
|
+
def fit_to_page?: () -> bool
|
|
1562
1782
|
|
|
1563
|
-
#
|
|
1564
|
-
# When enabled, optionally sets fit_to_width and/or fit_to_height on page_setup.
|
|
1783
|
+
# Sets whether page setup fits content to page width/height for the current sheet.
|
|
1565
1784
|
#
|
|
1566
1785
|
# @param enabled [Boolean, nil] Whether to fit to page.
|
|
1567
|
-
# @
|
|
1568
|
-
# @param height [Integer, nil] Pages tall to fit to.
|
|
1569
|
-
# @return [Boolean, void]
|
|
1786
|
+
# @return [Boolean]
|
|
1570
1787
|
# @api public
|
|
1571
|
-
# : (
|
|
1572
|
-
def fit_to_page
|
|
1788
|
+
# : (bool? enabled) -> bool?
|
|
1789
|
+
def fit_to_page=: (bool? enabled) -> bool?
|
|
1573
1790
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
alias fit_to_page? fit_to_page
|
|
1577
|
-
|
|
1578
|
-
# Configures worksheet calculation properties (<sheetCalcPr>) for the current sheet.
|
|
1791
|
+
# Worksheet calculation properties (<sheetCalcPr>) for the current sheet.
|
|
1579
1792
|
#
|
|
1580
1793
|
# @example Instruct Excel to recalculate formulas when loading sheet
|
|
1581
|
-
# w.
|
|
1794
|
+
# w.sheet_calc_properties = { full_calc_on_load: true }
|
|
1795
|
+
#
|
|
1796
|
+
# @return [Elements::SheetCalcProperties, nil]
|
|
1797
|
+
# @api public
|
|
1798
|
+
# : () -> Elements::SheetCalcProperties?
|
|
1799
|
+
def sheet_calc_properties: () -> Elements::SheetCalcProperties?
|
|
1800
|
+
|
|
1801
|
+
# Sets worksheet calculation properties (<sheetCalcPr>) for the current sheet.
|
|
1582
1802
|
#
|
|
1583
1803
|
# @param spec [Hash, nil] Calculation properties hash.
|
|
1584
|
-
# @param full_calc_on_load [Boolean, nil] Whether to recalculate when loading.
|
|
1585
1804
|
# @return [Hash, nil]
|
|
1586
1805
|
# @api public
|
|
1587
|
-
# : (
|
|
1588
|
-
def
|
|
1589
|
-
|
|
1590
|
-
alias sheet_calc_pr= sheet_calc_pr
|
|
1591
|
-
|
|
1592
|
-
alias calc_pr sheet_calc_pr
|
|
1593
|
-
|
|
1594
|
-
alias calc_pr= sheet_calc_pr
|
|
1806
|
+
# : (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
1807
|
+
def sheet_calc_properties=: (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
1595
1808
|
|
|
1596
1809
|
# Adds a defined name.
|
|
1597
1810
|
#
|
|
1598
1811
|
# @param name [String] The defined name.
|
|
1599
1812
|
# @param value [Object, nil] The formula or value expression.
|
|
1600
|
-
# @param sheet [String, nil]
|
|
1813
|
+
# @param sheet [String, nil] Reference sheet name.
|
|
1814
|
+
# @param scope [String, Symbol, nil] Local scope sheet name or :workbook.
|
|
1601
1815
|
# @param hidden [Boolean] Whether the defined name is hidden.
|
|
1602
|
-
# @param
|
|
1603
|
-
# @param rows [Integer, Range, nil] Row or row range (
|
|
1816
|
+
# @param columns [Integer, String, nil] Column index or letter for coordinate-based reference.
|
|
1817
|
+
# @param rows [Integer, Range, nil] Row or row range (0-based) for coordinate-based reference.
|
|
1604
1818
|
# @param range [String, nil] Cell range reference.
|
|
1605
1819
|
# @return [void]
|
|
1606
1820
|
# @api public
|
|
1607
|
-
# : (String name, ?untyped value, ?sheet: String?, ?hidden: bool, ?
|
|
1608
|
-
def defined_name: (String name, ?untyped value, ?sheet: String?, ?hidden: bool, ?
|
|
1821
|
+
# : (String name, ?untyped value, ?sheet: String?, ?scope: (String | Symbol)?, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped) -> void
|
|
1822
|
+
def defined_name: (String name, ?untyped value, ?sheet: String?, ?scope: (String | Symbol)?, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped) -> void
|
|
1609
1823
|
|
|
1610
|
-
#
|
|
1824
|
+
# Returns workbook-level defined names.
|
|
1825
|
+
#
|
|
1826
|
+
# @return [Array<Elements::DefinedName>]
|
|
1827
|
+
# @api public
|
|
1828
|
+
# : () -> Array[Elements::DefinedName]
|
|
1829
|
+
def defined_names: () -> Array[Elements::DefinedName]
|
|
1830
|
+
|
|
1831
|
+
# Returns the print area range for the current or named sheet, or nil if none.
|
|
1611
1832
|
#
|
|
1612
|
-
# @param range [String] Cell range (e.g. "A1:G50").
|
|
1613
1833
|
# @param sheet [String, nil] Target sheet name.
|
|
1614
|
-
# @return [
|
|
1834
|
+
# @return [String, nil]
|
|
1615
1835
|
# @api public
|
|
1616
|
-
# : (
|
|
1617
|
-
def print_area: (
|
|
1836
|
+
# : (?sheet: String?) -> String?
|
|
1837
|
+
def print_area: (?sheet: String?) -> String?
|
|
1618
1838
|
|
|
1619
|
-
# Sets print
|
|
1839
|
+
# Sets the print area for the current worksheet.
|
|
1620
1840
|
#
|
|
1621
|
-
# @param
|
|
1622
|
-
# @
|
|
1841
|
+
# @param range [String, nil] Cell range (e.g. "A1:G50").
|
|
1842
|
+
# @return [String, nil]
|
|
1843
|
+
# @api public
|
|
1844
|
+
# : (String? range) -> String?
|
|
1845
|
+
def print_area=: (String? range) -> String?
|
|
1846
|
+
|
|
1847
|
+
# Sets or gets repeating print titles (rows and/or columns) for pagination.
|
|
1848
|
+
#
|
|
1849
|
+
# When called with no row/column arguments, returns the {Elements::PrintTitles} value object or nil.
|
|
1850
|
+
# When called with row/column arguments, sets repeating print titles and returns nil.
|
|
1851
|
+
#
|
|
1852
|
+
# @param rows [String, Integer, Range, Object, nil] Repeating row range (e.g. "1:2" or 0-based 0..1).
|
|
1853
|
+
# @param columns [String, Integer, Symbol, Range, Object, nil] Repeating column range (e.g. "A:B" or 0..1).
|
|
1623
1854
|
# @param sheet [String, nil] Target sheet name.
|
|
1624
|
-
# @return [void]
|
|
1855
|
+
# @return [Elements::PrintTitles, nil, void]
|
|
1856
|
+
# @api public
|
|
1857
|
+
# : () -> Elements::PrintTitles?
|
|
1858
|
+
# : (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?, ?sheet: String?) -> void
|
|
1859
|
+
def print_titles: () -> Elements::PrintTitles?
|
|
1860
|
+
| (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?, ?sheet: String?) -> void
|
|
1861
|
+
|
|
1862
|
+
# Sets repeating print titles for the current worksheet.
|
|
1863
|
+
#
|
|
1864
|
+
# @param opts [Elements::PrintTitles, Hash, nil] Options with :rows and/or :columns.
|
|
1865
|
+
# @return [Elements::PrintTitles, Hash, nil]
|
|
1625
1866
|
# @api public
|
|
1626
|
-
# : (
|
|
1627
|
-
def print_titles
|
|
1867
|
+
# : (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
|
|
1868
|
+
def print_titles=: (Elements::PrintTitles | Hash[Symbol, untyped] | nil opts) -> (Elements::PrintTitles | Hash[Symbol, untyped] | nil)
|
|
1628
1869
|
|
|
1629
1870
|
# Sets repeating title rows for pagination on the current or named sheet.
|
|
1630
1871
|
#
|
|
@@ -1652,31 +1893,63 @@ module Xlsxrb
|
|
|
1652
1893
|
# : (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
1653
1894
|
def repeat_columns: (Integer | String first, ?(Integer | String)? last, ?sheet: String?) -> void
|
|
1654
1895
|
|
|
1655
|
-
# Sets workbook protection.
|
|
1896
|
+
# Sets or returns workbook protection settings.
|
|
1656
1897
|
#
|
|
1657
1898
|
# @param opts [Hash] Protection options.
|
|
1899
|
+
# @return [Elements::WorkbookProtection, nil, void]
|
|
1900
|
+
# @api public
|
|
1901
|
+
# : (**String | Integer | bool | nil opts) -> (Elements::WorkbookProtection | nil)
|
|
1902
|
+
def workbook_protection: (**String | Integer | bool | nil opts) -> (Elements::WorkbookProtection | nil)
|
|
1903
|
+
|
|
1904
|
+
# Sets workbook protection settings.
|
|
1905
|
+
#
|
|
1906
|
+
# @param opts [Hash, Elements::MetadataRecord, nil]
|
|
1658
1907
|
# @return [void]
|
|
1659
1908
|
# @api public
|
|
1660
|
-
# : (
|
|
1661
|
-
def
|
|
1909
|
+
# : (untyped opts) -> void
|
|
1910
|
+
def workbook_protection=: (untyped opts) -> void
|
|
1911
|
+
|
|
1912
|
+
# Configures or queries core document properties.
|
|
1913
|
+
#
|
|
1914
|
+
# When called with no arguments, returns the {Elements::CoreProperties} value object.
|
|
1915
|
+
# When called with keyword options, configures properties and returns nil.
|
|
1916
|
+
#
|
|
1917
|
+
# @param opts [Hash] Core properties map.
|
|
1918
|
+
# @return [Elements::CoreProperties, void]
|
|
1919
|
+
# @api public
|
|
1920
|
+
# : () -> Elements::CoreProperties
|
|
1921
|
+
# : (**untyped opts) -> void
|
|
1922
|
+
def core_properties: () -> Elements::CoreProperties
|
|
1923
|
+
| (**untyped opts) -> void
|
|
1662
1924
|
|
|
1663
|
-
#
|
|
1925
|
+
# Replaces core document properties.
|
|
1664
1926
|
#
|
|
1665
|
-
# @param
|
|
1666
|
-
# @param value [String, Integer, Time] Property value.
|
|
1927
|
+
# @param props [Hash, Elements::CoreProperties]
|
|
1667
1928
|
# @return [void]
|
|
1668
1929
|
# @api public
|
|
1669
|
-
# : (Symbol
|
|
1670
|
-
def
|
|
1930
|
+
# : (Hash[Symbol, untyped] | Elements::CoreProperties props) -> void
|
|
1931
|
+
def core_properties=: (Hash[Symbol, untyped] | Elements::CoreProperties props) -> void
|
|
1671
1932
|
|
|
1672
|
-
#
|
|
1933
|
+
# Configures or queries application document properties.
|
|
1934
|
+
#
|
|
1935
|
+
# When called with no arguments, returns the {Elements::AppProperties} value object.
|
|
1936
|
+
# When called with keyword options, configures properties and returns nil.
|
|
1673
1937
|
#
|
|
1674
|
-
# @param
|
|
1675
|
-
# @
|
|
1938
|
+
# @param opts [Hash] Application properties map.
|
|
1939
|
+
# @return [Elements::AppProperties, void]
|
|
1940
|
+
# @api public
|
|
1941
|
+
# : () -> Elements::AppProperties
|
|
1942
|
+
# : (**untyped opts) -> void
|
|
1943
|
+
def app_properties: () -> Elements::AppProperties
|
|
1944
|
+
| (**untyped opts) -> void
|
|
1945
|
+
|
|
1946
|
+
# Replaces application document properties.
|
|
1947
|
+
#
|
|
1948
|
+
# @param props [Hash, Elements::AppProperties]
|
|
1676
1949
|
# @return [void]
|
|
1677
1950
|
# @api public
|
|
1678
|
-
# : (Symbol
|
|
1679
|
-
def
|
|
1951
|
+
# : (Hash[Symbol, untyped] | Elements::AppProperties props) -> void
|
|
1952
|
+
def app_properties=: (Hash[Symbol, untyped] | Elements::AppProperties props) -> void
|
|
1680
1953
|
|
|
1681
1954
|
# Sets multiple core and/or app properties.
|
|
1682
1955
|
#
|
|
@@ -1698,6 +1971,13 @@ module Xlsxrb
|
|
|
1698
1971
|
# : (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
|
|
1699
1972
|
def custom_property: (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
|
|
1700
1973
|
|
|
1974
|
+
# Returns custom document properties.
|
|
1975
|
+
#
|
|
1976
|
+
# @return [Hash<String, Elements::CustomProperty>]
|
|
1977
|
+
# @api public
|
|
1978
|
+
# : () -> Hash[String, Elements::CustomProperty]
|
|
1979
|
+
def custom_properties: () -> Hash[String, Elements::CustomProperty]
|
|
1980
|
+
|
|
1701
1981
|
# Finalizes and writes all streaming sheet contents to the destination target.
|
|
1702
1982
|
#
|
|
1703
1983
|
# @return [void]
|
|
@@ -1708,12 +1988,26 @@ module Xlsxrb
|
|
|
1708
1988
|
# Explicitly cleans up any resources if not already closed.
|
|
1709
1989
|
#
|
|
1710
1990
|
# @return [void]
|
|
1711
|
-
# @api
|
|
1991
|
+
# @api private
|
|
1712
1992
|
# : () -> void
|
|
1713
1993
|
def cleanup!: () -> void
|
|
1714
1994
|
|
|
1715
1995
|
private
|
|
1716
1996
|
|
|
1997
|
+
# Raises ArgumentError for any cell style name that has not been defined.
|
|
1998
|
+
# : (untyped cell_styles) -> void
|
|
1999
|
+
def check_style_names!: (untyped cell_styles) -> void
|
|
2000
|
+
|
|
2001
|
+
# Gives Date and Time values whose named cell style has no number format a variant of
|
|
2002
|
+
# that style with the default date or time format, registered on first use.
|
|
2003
|
+
# : (Array[untyped] values, untyped cell_styles) -> untyped
|
|
2004
|
+
def with_date_style_variants: (Array[untyped] values, untyped cell_styles) -> untyped
|
|
2005
|
+
|
|
2006
|
+
def ensure_sheet_started!: () -> untyped
|
|
2007
|
+
|
|
2008
|
+
# : (String? range, ?sheet: String?) -> String?
|
|
2009
|
+
def set_print_area: (String? range, ?sheet: String?) -> String?
|
|
2010
|
+
|
|
1717
2011
|
# : (untyped range) -> untyped
|
|
1718
2012
|
def absolute_range: (untyped range) -> untyped
|
|
1719
2013
|
|