xlsxrb 0.1.18 → 0.2.1
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 +200 -0
- data/README.md +35 -12
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +410 -80
- data/lib/xlsxrb/chart_builder.rb +251 -386
- data/lib/xlsxrb/dsl_helpers.rb +169 -68
- data/lib/xlsxrb/elements/cell.rb +37 -157
- data/lib/xlsxrb/elements/column.rb +11 -19
- data/lib/xlsxrb/elements/coordinate_access.rb +15 -86
- data/lib/xlsxrb/elements/image.rb +5 -72
- data/lib/xlsxrb/elements/metadata.rb +463 -817
- data/lib/xlsxrb/elements/row.rb +27 -145
- data/lib/xlsxrb/elements/styles.rb +30 -88
- data/lib/xlsxrb/elements/types.rb +6 -99
- data/lib/xlsxrb/elements/workbook.rb +19 -126
- data/lib/xlsxrb/elements/worksheet.rb +45 -316
- data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +4 -1
- data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -7
- data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +32 -17
- data/lib/xlsxrb/ooxml/reader.rb +49 -51
- data/lib/xlsxrb/ooxml/styles_parser.rb +26 -2
- data/lib/xlsxrb/ooxml/utils.rb +15 -2
- data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
- data/lib/xlsxrb/ooxml/workbook_writer.rb +184 -94
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +61 -29
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +353 -261
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +28 -11
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +62 -16
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +1 -1
- data/lib/xlsxrb/ooxml/writer.rb +106 -42
- data/lib/xlsxrb/ooxml/xml_builder.rb +18 -0
- data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
- data/lib/xlsxrb/ooxml/zip_reader.rb +65 -15
- data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
- data/lib/xlsxrb/stream_row.rb +14 -118
- data/lib/xlsxrb/stream_sheet.rb +14 -261
- data/lib/xlsxrb/stream_writer.rb +807 -1537
- data/lib/xlsxrb/style_builder.rb +715 -593
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +403 -286
- data/lib/xlsxrb/worksheet_builder.rb +1297 -1458
- data/lib/xlsxrb.rb +281 -1079
- data/sig/generated/xlsxrb/chart_builder.rbs +202 -205
- data/sig/generated/xlsxrb/dsl_helpers.rbs +92 -16
- data/sig/generated/xlsxrb/elements/cell.rbs +12 -76
- data/sig/generated/xlsxrb/elements/column.rbs +0 -7
- data/sig/generated/xlsxrb/elements/coordinate_access.rbs +5 -41
- data/sig/generated/xlsxrb/elements/image.rbs +3 -29
- data/sig/generated/xlsxrb/elements/metadata.rbs +138 -151
- data/sig/generated/xlsxrb/elements/row.rbs +10 -53
- data/sig/generated/xlsxrb/elements/styles.rbs +1 -39
- data/sig/generated/xlsxrb/elements/workbook.rbs +14 -78
- data/sig/generated/xlsxrb/elements/worksheet.rbs +5 -121
- data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +0 -4
- data/sig/generated/xlsxrb/ooxml/reader.rbs +0 -3
- data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
- data/sig/generated/xlsxrb/ooxml/utils.rbs +13 -3
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +17 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +58 -3
- data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +10 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +20 -14
- data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +12 -0
- data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +22 -7
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
- data/sig/generated/xlsxrb/stream_row.rbs +9 -44
- data/sig/generated/xlsxrb/stream_sheet.rbs +1 -158
- data/sig/generated/xlsxrb/stream_writer.rbs +491 -974
- data/sig/generated/xlsxrb/style_builder.rbs +464 -239
- data/sig/generated/xlsxrb/workbook_builder.rbs +124 -139
- data/sig/generated/xlsxrb/worksheet_builder.rbs +922 -686
- data/sig/generated/xlsxrb.rbs +56 -188
- data/sig/rexml.rbs +8 -0
- metadata +3 -5
- data/lib/xlsxrb/utils.rb +0 -251
- data/sig/generated/xlsxrb/utils.rbs +0 -200
|
@@ -9,18 +9,17 @@ module Xlsxrb
|
|
|
9
9
|
#
|
|
10
10
|
# @api public
|
|
11
11
|
class WorksheetBuilder
|
|
12
|
-
OMITTED = Object.new.freeze
|
|
13
|
-
private_constant :OMITTED
|
|
14
12
|
# @param name [String] The worksheet name.
|
|
15
13
|
# @param strict_excel_mode [Boolean] Whether to enforce Microsoft Excel limits.
|
|
16
14
|
# @param state [Symbol] Sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
17
|
-
# @param
|
|
18
|
-
#: (String name, ?strict_excel_mode: bool, ?state: Symbol, ?
|
|
19
|
-
def initialize(name, strict_excel_mode: true, state: :visible,
|
|
15
|
+
# @param style_log [StyleLog] When the workbook's styles are defined (internal).
|
|
16
|
+
#: (String name, ?strict_excel_mode: bool, ?state: Symbol, ?style_log: StyleLog) -> void
|
|
17
|
+
def initialize(name, strict_excel_mode: true, state: :visible, style_log: StyleLog.new)
|
|
20
18
|
@name = name
|
|
19
|
+
@style_log = style_log
|
|
20
|
+
@column_style_clocks = {} # { column index => style log clock when its style was set }
|
|
21
21
|
@strict_excel_mode = strict_excel_mode
|
|
22
22
|
@state = state ? state.to_sym : :visible
|
|
23
|
-
@escape_formulas = escape_formulas ? true : false
|
|
24
23
|
@next_row_index = 0
|
|
25
24
|
@rows = []
|
|
26
25
|
@columns = []
|
|
@@ -74,19 +73,6 @@ module Xlsxrb
|
|
|
74
73
|
#: Array[Hash[Symbol, untyped]]
|
|
75
74
|
attr_reader :defined_names
|
|
76
75
|
|
|
77
|
-
# @return [Boolean] Whether to treat strings starting with formula prefixes as plain text.
|
|
78
|
-
#: bool
|
|
79
|
-
attr_accessor :escape_formulas
|
|
80
|
-
|
|
81
|
-
# Returns whether formula escaping is enabled.
|
|
82
|
-
#
|
|
83
|
-
# @return [Boolean]
|
|
84
|
-
# @api public
|
|
85
|
-
#: () -> bool
|
|
86
|
-
def escape_formulas?
|
|
87
|
-
@escape_formulas ? true : false
|
|
88
|
-
end
|
|
89
|
-
|
|
90
76
|
# Defines or configures a named cell style.
|
|
91
77
|
#
|
|
92
78
|
# @example Define a bold header style
|
|
@@ -97,6 +83,8 @@ module Xlsxrb
|
|
|
97
83
|
# @yield [style_builder]
|
|
98
84
|
# @yieldparam style_builder [Xlsxrb::StyleBuilder]
|
|
99
85
|
# @return [StyleBuilder]
|
|
86
|
+
# Using the returned value is deprecated and warns; in version 0.3.0, this method
|
|
87
|
+
# will return nil. Configure the style with options or in the block.
|
|
100
88
|
# @api public
|
|
101
89
|
#: (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
|
|
102
90
|
def style(name, **opts)
|
|
@@ -105,7 +93,8 @@ module Xlsxrb
|
|
|
105
93
|
style_builder.apply_options!(**opts) unless opts.empty?
|
|
106
94
|
yield style_builder if block_given?
|
|
107
95
|
@styles[style_name] = style_builder
|
|
108
|
-
style_builder
|
|
96
|
+
@style_log.record(style_name, style_builder)
|
|
97
|
+
ReturnedStyleBuilder.new(style_builder)
|
|
109
98
|
end
|
|
110
99
|
|
|
111
100
|
# Creates an {Elements::Formula} object.
|
|
@@ -159,22 +148,12 @@ module Xlsxrb
|
|
|
159
148
|
# @param custom_height [Boolean] Whether custom row height is enforced.
|
|
160
149
|
# @param outline_level [Integer, nil] Grouping/outline hierarchy level.
|
|
161
150
|
# @param collapsed [Boolean] Whether the row is collapsed.
|
|
162
|
-
# @param styles [String, Symbol, Array<String | Symbol>, Hash, nil] Deprecated. Use cell_styles: instead.
|
|
163
|
-
# @param style [Integer, Symbol, String, Hash, nil] Deprecated. Use row_style: instead.
|
|
164
151
|
# @return [void]
|
|
165
152
|
# @raise [ArgumentError] If limits are exceeded when strict_excel_mode is enabled.
|
|
166
153
|
# @api public
|
|
167
|
-
#: (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?
|
|
168
|
-
def row(values, cell_styles: nil, row_style: nil,
|
|
169
|
-
|
|
170
|
-
warn "[DEPRECATION] WorksheetBuilder#row keyword :styles is deprecated; use :cell_styles instead.", uplevel: 1
|
|
171
|
-
cell_styles ||= styles
|
|
172
|
-
end
|
|
173
|
-
if style
|
|
174
|
-
warn "[DEPRECATION] WorksheetBuilder#row keyword :style is deprecated; use :row_style instead.", uplevel: 1
|
|
175
|
-
row_style ||= style
|
|
176
|
-
end
|
|
177
|
-
|
|
154
|
+
#: (Array[untyped] | Hash[untyped, untyped] values, ?cell_styles: untyped, ?row_style: (Integer | Symbol | String | Hash[Symbol, untyped])?, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?collapsed: bool, ?outline_level: Integer | nil) -> void
|
|
155
|
+
def row(values, cell_styles: nil, row_style: nil, height: nil, hidden: false, custom_height: false, collapsed: false, outline_level: nil)
|
|
156
|
+
check_open!
|
|
178
157
|
row_index = @next_row_index
|
|
179
158
|
DslHelpers.validate_row_bounds!(row_index, height, strict_excel_mode: @strict_excel_mode)
|
|
180
159
|
@next_row_index += 1
|
|
@@ -187,22 +166,52 @@ module Xlsxrb
|
|
|
187
166
|
|
|
188
167
|
values = DslHelpers.normalize_row_values(values)
|
|
189
168
|
cell_styles = DslHelpers.normalize_row_styles(cell_styles)
|
|
169
|
+
# The row is kept as given until the workbook resolves its styles, so it must not
|
|
170
|
+
# change with the caller's arrays. Each array is copied once, when first needed.
|
|
171
|
+
values_copied = false
|
|
172
|
+
styles_copied = false
|
|
190
173
|
|
|
191
174
|
# Auto-detect Date / Time for built-in styles
|
|
192
175
|
values.each_with_index do |val, idx|
|
|
193
176
|
cell_style = cell_styles.is_a?(Array) ? cell_styles[idx] : cell_styles
|
|
194
177
|
|
|
195
|
-
if val.is_a?(Date) && cell_style.nil?
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
178
|
+
if val.is_a?(Date) && !val.is_a?(DateTime) && cell_style.nil?
|
|
179
|
+
auto_style = inherited_date_style(row_style, idx)
|
|
180
|
+
unless auto_style
|
|
181
|
+
style("__xlsxrb_date", number_format: "yyyy-mm-dd") unless @styles.key?("__xlsxrb_date")
|
|
182
|
+
auto_style = "__xlsxrb_date"
|
|
183
|
+
end
|
|
184
|
+
elsif val.is_a?(Time) || val.is_a?(DateTime)
|
|
185
|
+
# A value that claims to be a Time without being one, such as
|
|
186
|
+
# ActiveSupport::TimeWithZone, is kept as a Time with the same wall clock.
|
|
187
|
+
unless Time === val || val.is_a?(DateTime) # rubocop:disable Style/CaseEquality
|
|
188
|
+
unless values_copied
|
|
189
|
+
values = values.dup
|
|
190
|
+
values_copied = true
|
|
191
|
+
end
|
|
192
|
+
values[idx] = Ooxml::WorksheetWriter::TimeLike.to_time(val)
|
|
193
|
+
end
|
|
194
|
+
next unless cell_style.nil?
|
|
195
|
+
|
|
196
|
+
auto_style = inherited_date_style(row_style, idx)
|
|
197
|
+
unless auto_style
|
|
198
|
+
style("__xlsxrb_time", number_format: "yyyy-mm-dd hh:mm:ss") unless @styles.key?("__xlsxrb_time")
|
|
199
|
+
auto_style = "__xlsxrb_time"
|
|
200
|
+
end
|
|
201
|
+
else
|
|
202
|
+
next
|
|
205
203
|
end
|
|
204
|
+
unless styles_copied
|
|
205
|
+
cell_styles = if cell_styles.nil?
|
|
206
|
+
[]
|
|
207
|
+
elsif cell_styles.is_a?(Array)
|
|
208
|
+
cell_styles.dup
|
|
209
|
+
else
|
|
210
|
+
Array.new(values.size, cell_styles)
|
|
211
|
+
end
|
|
212
|
+
styles_copied = true
|
|
213
|
+
end
|
|
214
|
+
cell_styles[idx] = auto_style
|
|
206
215
|
end
|
|
207
216
|
|
|
208
217
|
max_len = values.size
|
|
@@ -210,106 +219,67 @@ module Xlsxrb
|
|
|
210
219
|
# See: https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
|
|
211
220
|
raise ArgumentError, "Row contains #{max_len} columns, exceeding Excel limit of 16_384 columns" if @strict_excel_mode && max_len > 16_384
|
|
212
221
|
|
|
213
|
-
cells = Array.new(max_len)
|
|
214
222
|
style_lookup = cell_styles.is_a?(Array)
|
|
223
|
+
# Number format codes of the cells' sheet styles, as of this call.
|
|
224
|
+
format_codes = style_lookup ? nil : format_code_of(cell_styles)
|
|
215
225
|
|
|
216
226
|
col_index = 0
|
|
217
227
|
while col_index < max_len
|
|
218
228
|
val = col_index < values.size ? values[col_index] : nil
|
|
219
229
|
raise ArgumentError, "Invalid cell value type or value: #{val.class} for value #{val.inspect}" unless val.nil? || val.is_a?(String) || (val.is_a?(Numeric) && !(val.is_a?(Float) && (val.infinite? || val.nan?))) || val.is_a?(TrueClass) || val.is_a?(FalseClass) || val.is_a?(Date) || val.is_a?(Time) || val.is_a?(Elements::Formula) || (val.is_a?(Hash) && val.key?(:formula)) || val.is_a?(Elements::RichText) || val.is_a?(Elements::CellError) || (val.is_a?(Array) && val.first.is_a?(Hash) && (val.first.key?(:text) || val.first.key?("text")))
|
|
230
|
+
|
|
220
231
|
# See: https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if val.is_a?(Array)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
font = run.reject { |k| k.to_s == "text" }
|
|
228
|
-
{ text: text, font: font.empty? ? nil : font }.compact
|
|
232
|
+
DslHelpers.check_cell_text_length!(val) if @strict_excel_mode && val.is_a?(String) && val.bytesize > DslHelpers::MAX_CELL_TEXT_LENGTH
|
|
233
|
+
|
|
234
|
+
if val.is_a?(Array) || val.is_a?(Hash)
|
|
235
|
+
unless values_copied
|
|
236
|
+
values = values.dup
|
|
237
|
+
values_copied = true
|
|
229
238
|
end
|
|
230
|
-
|
|
239
|
+
values[col_index] = if val.is_a?(Array)
|
|
240
|
+
# Coerce array of hashes to RichText
|
|
241
|
+
runs = val.map do |run|
|
|
242
|
+
text = run[:text] || run["text"]
|
|
243
|
+
font = run.reject { |k| k.to_s == "text" }
|
|
244
|
+
{ text: text, font: font.empty? ? nil : font }.compact
|
|
245
|
+
end
|
|
246
|
+
Elements::RichText.new(runs: runs)
|
|
247
|
+
else
|
|
248
|
+
# A Hash with :formula becomes the cell's formula.
|
|
249
|
+
Elements::Formula.new(
|
|
250
|
+
expression: val[:formula] || val[:expression] || "",
|
|
251
|
+
cached_value: val.key?(:value) ? val[:value] : val[:cached_value],
|
|
252
|
+
type: val[:type] || (:shared if val.key?(:shared_index)),
|
|
253
|
+
ref: val[:ref],
|
|
254
|
+
shared_index: val[:shared_index],
|
|
255
|
+
calculate_always: val[:calculate_always]
|
|
256
|
+
)
|
|
257
|
+
end
|
|
231
258
|
end
|
|
232
259
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
col_index
|
|
246
|
-
next
|
|
260
|
+
if style_lookup
|
|
261
|
+
style_name = col_index < cell_styles.size ? cell_styles[col_index] : nil
|
|
262
|
+
if style_name.is_a?(Hash)
|
|
263
|
+
inline_name = "__inline_#{style_name.hash}"
|
|
264
|
+
style(inline_name, **style_name) unless @styles.key?(inline_name)
|
|
265
|
+
unless styles_copied
|
|
266
|
+
cell_styles = cell_styles.dup
|
|
267
|
+
styles_copied = true
|
|
268
|
+
end
|
|
269
|
+
cell_styles[col_index] = style_name = inline_name
|
|
270
|
+
end
|
|
271
|
+
format_code = style_name.nil? ? nil : format_code_of(style_name)
|
|
272
|
+
(format_codes ||= [])[col_index] = format_code if format_code
|
|
247
273
|
end
|
|
248
|
-
sb = @styles[style_name]
|
|
249
|
-
fmt_code = if sb&.number_format
|
|
250
|
-
sb.number_format.is_a?(String) ? sb.number_format : Ooxml::Utils::BUILTIN_NUM_FMT_CODES[sb.number_format]
|
|
251
|
-
end
|
|
252
|
-
# If value is a Formula object or Hash with :formula, store it as the cell's formula
|
|
253
|
-
cells[col_index] = if val.is_a?(Elements::Formula)
|
|
254
|
-
Elements::Cell.new(
|
|
255
|
-
row_index: row_index,
|
|
256
|
-
column_index: col_index,
|
|
257
|
-
value: val.cached_value,
|
|
258
|
-
formula: val,
|
|
259
|
-
style: style_name,
|
|
260
|
-
raw_value: val.cached_value&.to_s,
|
|
261
|
-
format_code: fmt_code
|
|
262
|
-
)
|
|
263
|
-
elsif val.is_a?(Hash) && (val.key?(:formula) || val.key?(:expression) || (val[:type]&.to_sym == :shared && (val.key?(:shared_index) || val.key?(:si))))
|
|
264
|
-
cached_val = val.key?(:value) ? val[:value] : val[:cached_value]
|
|
265
|
-
f_expr = val[:formula] || val[:expression] || ""
|
|
266
|
-
f_type = val[:type] || (:shared if val.key?(:shared_index) || val.key?(:si))
|
|
267
|
-
f_obj = Elements::Formula.new(
|
|
268
|
-
expression: f_expr,
|
|
269
|
-
cached_value: cached_val,
|
|
270
|
-
type: f_type,
|
|
271
|
-
ref: val[:ref],
|
|
272
|
-
shared_index: val[:shared_index] || val[:si],
|
|
273
|
-
calculate_always: val[:calculate_always]
|
|
274
|
-
)
|
|
275
|
-
Elements::Cell.new(
|
|
276
|
-
row_index: row_index,
|
|
277
|
-
column_index: col_index,
|
|
278
|
-
value: cached_val,
|
|
279
|
-
formula: f_obj,
|
|
280
|
-
style: style_name,
|
|
281
|
-
raw_value: cached_val&.to_s,
|
|
282
|
-
format_code: fmt_code
|
|
283
|
-
)
|
|
284
|
-
else
|
|
285
|
-
Elements::Cell.new(
|
|
286
|
-
row_index: row_index,
|
|
287
|
-
column_index: col_index,
|
|
288
|
-
value: val,
|
|
289
|
-
style: style_name,
|
|
290
|
-
raw_value: val&.to_s,
|
|
291
|
-
format_code: fmt_code
|
|
292
|
-
)
|
|
293
|
-
end
|
|
294
274
|
col_index += 1
|
|
295
275
|
end
|
|
296
276
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
@rows <<
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
height: height,
|
|
303
|
-
hidden: hidden,
|
|
304
|
-
custom_height: custom_height || !height.nil?,
|
|
305
|
-
collapsed: collapsed,
|
|
306
|
-
outline_level: outline_level,
|
|
307
|
-
style_index: row_style,
|
|
308
|
-
unmapped_data: unmapped
|
|
309
|
-
)
|
|
277
|
+
values = values.dup unless values_copied || values.frozen?
|
|
278
|
+
cell_styles = cell_styles.dup if style_lookup && !styles_copied && !cell_styles.frozen?
|
|
279
|
+
@rows << PendingRow.new(row_index, values, cell_styles, format_codes, max_len, height, hidden,
|
|
280
|
+
custom_height || !height.nil?, collapsed, outline_level, row_style, @style_log.clock)
|
|
281
|
+
nil
|
|
310
282
|
end
|
|
311
|
-
# @deprecated Use {#row} instead. Will be removed in 0.2.0 (available via xlsxrb-adapters).
|
|
312
|
-
alias add_row row
|
|
313
283
|
|
|
314
284
|
# Appends a row to the worksheet and returns self for chaining.
|
|
315
285
|
#
|
|
@@ -327,9 +297,6 @@ module Xlsxrb
|
|
|
327
297
|
|
|
328
298
|
# Advances the row cursor by count without writing empty row elements.
|
|
329
299
|
#
|
|
330
|
-
# @example Skip one row
|
|
331
|
-
# sheet.skip_row
|
|
332
|
-
#
|
|
333
300
|
# @example Skip multiple rows
|
|
334
301
|
# sheet.skip_rows(3)
|
|
335
302
|
#
|
|
@@ -338,12 +305,12 @@ module Xlsxrb
|
|
|
338
305
|
# @api public
|
|
339
306
|
#: (?Integer count) -> void
|
|
340
307
|
def skip_rows(count = 1)
|
|
308
|
+
check_open!
|
|
341
309
|
raise ArgumentError, "count must be positive: #{count.inspect}" if !count.is_a?(Integer) || count < 1
|
|
342
310
|
|
|
343
311
|
@next_row_index += count
|
|
312
|
+
nil
|
|
344
313
|
end
|
|
345
|
-
# @deprecated Use {#skip_rows} instead. Will be removed in 0.2.0.
|
|
346
|
-
alias skip_row skip_rows
|
|
347
314
|
|
|
348
315
|
# Sets column formatting and properties for one or multiple columns.
|
|
349
316
|
#
|
|
@@ -365,12 +332,13 @@ module Xlsxrb
|
|
|
365
332
|
raise ArgumentError, "Column width #{width} must be between 0 and 255 characters (Excel limitation)" if @strict_excel_mode && width && (width.negative? || width > 255)
|
|
366
333
|
|
|
367
334
|
DslHelpers.normalize_column_indices(index).each do |idx|
|
|
335
|
+
@column_style_clocks[idx] = @style_log.clock unless style.nil?
|
|
368
336
|
existing_idx = @columns.find_index { |c| c.index == idx }
|
|
369
337
|
if existing_idx
|
|
370
338
|
prev = @columns[existing_idx]
|
|
371
339
|
new_width = width.nil? ? prev.width : width
|
|
372
|
-
new_custom_width = (custom_width || !width.nil?) || prev.custom_width
|
|
373
|
-
new_hidden = hidden || prev.hidden
|
|
340
|
+
new_custom_width = (custom_width || !width.nil?) || prev.custom_width?
|
|
341
|
+
new_hidden = hidden || prev.hidden?
|
|
374
342
|
new_outline = outline_level.nil? ? prev.outline_level : outline_level
|
|
375
343
|
new_style = style.nil? ? prev.style_index : style
|
|
376
344
|
unmapped = prev.unmapped_data ? prev.unmapped_data.dup : {}
|
|
@@ -434,12 +402,6 @@ module Xlsxrb
|
|
|
434
402
|
def group_columns(index, level: 1, collapsed: false, hidden: false, width: nil, style: nil)
|
|
435
403
|
column(index, outline_level: level, collapsed: collapsed, hidden: hidden, width: width, style: style)
|
|
436
404
|
end
|
|
437
|
-
# @deprecated Use {#group_columns} instead. Will be removed in 0.2.0.
|
|
438
|
-
alias group_column group_columns
|
|
439
|
-
# @deprecated Use {#group_columns} instead. Will be removed in 0.2.0.
|
|
440
|
-
alias group_cols group_columns
|
|
441
|
-
# @deprecated Use {#group_columns} instead. Will be removed in 0.2.0.
|
|
442
|
-
alias group_col group_columns
|
|
443
405
|
|
|
444
406
|
# Groups multiple rows with outline hierarchy, either by range or with a block.
|
|
445
407
|
#
|
|
@@ -481,31 +443,28 @@ module Xlsxrb
|
|
|
481
443
|
when Array then rows
|
|
482
444
|
else [rows.to_i]
|
|
483
445
|
end
|
|
446
|
+
check_open!
|
|
484
447
|
row_indices.each do |idx|
|
|
485
448
|
existing_row = @rows.find { |r| r.index == idx }
|
|
486
449
|
if existing_row
|
|
487
450
|
existing_idx = @rows.index(existing_row)
|
|
488
|
-
@rows[existing_idx] =
|
|
489
|
-
index: existing_row.index,
|
|
490
|
-
cells: existing_row.cells,
|
|
491
|
-
height: existing_row.height,
|
|
451
|
+
@rows[existing_idx] = existing_row.with_outline(
|
|
492
452
|
hidden: hidden || existing_row.hidden,
|
|
493
|
-
custom_height: existing_row.custom_height,
|
|
494
453
|
collapsed: collapsed || existing_row.collapsed,
|
|
495
|
-
outline_level: level
|
|
496
|
-
style_index: existing_row.style_index,
|
|
497
|
-
unmapped_data: existing_row.unmapped_data
|
|
454
|
+
outline_level: level
|
|
498
455
|
)
|
|
499
456
|
else
|
|
500
457
|
@pending_row_attributes[idx] = { outline_level: level, collapsed: collapsed, hidden: hidden }
|
|
501
458
|
end
|
|
502
459
|
end
|
|
503
460
|
end
|
|
461
|
+
nil
|
|
504
462
|
end
|
|
505
|
-
# @deprecated Use {#group_rows} instead. Will be removed in 0.2.0.
|
|
506
|
-
alias group_row group_rows
|
|
507
463
|
|
|
508
|
-
# Configures worksheet-level outline and grouping view properties.
|
|
464
|
+
# Configures or queries worksheet-level outline and grouping view properties.
|
|
465
|
+
#
|
|
466
|
+
# When called with no arguments, returns the outline properties Hash.
|
|
467
|
+
# When called with arguments, updates outline properties and returns nil.
|
|
509
468
|
#
|
|
510
469
|
# @example Show summary row below detail rows
|
|
511
470
|
# sheet.outline_properties(summary_below: true, summary_right: true)
|
|
@@ -513,21 +472,19 @@ module Xlsxrb
|
|
|
513
472
|
# @param summary_below [Boolean, nil] Flag indicating if summary rows appear below detail rows.
|
|
514
473
|
# @param summary_right [Boolean, nil] Flag indicating if summary columns appear to the right of detail columns.
|
|
515
474
|
# @param show_outline_symbols [Boolean, nil] Flag indicating whether outline symbols are visible.
|
|
516
|
-
# @param show_symbols [Boolean, nil] Deprecated alias for show_outline_symbols.
|
|
517
475
|
# @param apply_styles [Boolean, nil] Flag indicating whether automatic styles apply to outlines.
|
|
518
476
|
# @param opts [Hash] Additional options.
|
|
519
477
|
# @return [Hash<Symbol, untyped>, void]
|
|
520
478
|
# @api public
|
|
521
|
-
#: (
|
|
522
|
-
|
|
523
|
-
|
|
479
|
+
#: () -> Hash[Symbol, untyped]
|
|
480
|
+
#: (?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, ?apply_styles: bool?, **untyped opts) -> void
|
|
481
|
+
def outline_properties(summary_below: nil, summary_right: nil, show_outline_symbols: nil, apply_styles: nil, **opts)
|
|
482
|
+
return @sheet_properties.slice(:summary_below, :summary_right, :show_outline_symbols, :apply_styles) if summary_below.nil? && summary_right.nil? && show_outline_symbols.nil? && apply_styles.nil? && opts.empty?
|
|
524
483
|
|
|
525
|
-
warn "[Xlsxrb DEPRECATION] outline_properties keyword show_symbols: is deprecated; use show_outline_symbols: instead.", uplevel: 1 unless show_symbols.nil?
|
|
526
484
|
props = (@sheet_properties[:outline_properties] || {}).dup
|
|
527
485
|
props[:summary_below] = summary_below unless summary_below.nil?
|
|
528
486
|
props[:summary_right] = summary_right unless summary_right.nil?
|
|
529
|
-
|
|
530
|
-
props[:show_outline_symbols] = symbols unless symbols.nil?
|
|
487
|
+
props[:show_outline_symbols] = show_outline_symbols unless show_outline_symbols.nil?
|
|
531
488
|
props[:apply_styles] = apply_styles unless apply_styles.nil?
|
|
532
489
|
props.merge!(opts)
|
|
533
490
|
@sheet_properties[:outline_properties] = props
|
|
@@ -535,8 +492,6 @@ module Xlsxrb
|
|
|
535
492
|
@sheet_properties[:summary_right] = props[:summary_right] unless props[:summary_right].nil?
|
|
536
493
|
nil
|
|
537
494
|
end
|
|
538
|
-
# @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
|
|
539
|
-
alias outline_pr outline_properties
|
|
540
495
|
|
|
541
496
|
# Sets worksheet outline and grouping view properties.
|
|
542
497
|
#
|
|
@@ -549,7 +504,6 @@ module Xlsxrb
|
|
|
549
504
|
outline_properties(**h)
|
|
550
505
|
nil
|
|
551
506
|
end
|
|
552
|
-
alias outline_pr= outline_properties=
|
|
553
507
|
|
|
554
508
|
# Adds a chart to the worksheet.
|
|
555
509
|
#
|
|
@@ -564,7 +518,7 @@ module Xlsxrb
|
|
|
564
518
|
options = options.merge(type: type) if type
|
|
565
519
|
if block_given?
|
|
566
520
|
builder = ChartBuilder.new
|
|
567
|
-
builder.type
|
|
521
|
+
builder.type = type if type
|
|
568
522
|
yield builder
|
|
569
523
|
options = builder.options.merge(options)
|
|
570
524
|
end
|
|
@@ -600,16 +554,12 @@ module Xlsxrb
|
|
|
600
554
|
@hyperlinks << link
|
|
601
555
|
end
|
|
602
556
|
|
|
603
|
-
#
|
|
557
|
+
# Returns the auto-filter range for the worksheet, or nil if none.
|
|
604
558
|
#
|
|
605
|
-
# @
|
|
606
|
-
# @return [void]
|
|
559
|
+
# @return [String, nil]
|
|
607
560
|
# @api public
|
|
608
|
-
#: (
|
|
609
|
-
|
|
610
|
-
@auto_filter = range
|
|
611
|
-
nil
|
|
612
|
-
end
|
|
561
|
+
#: () -> String?
|
|
562
|
+
attr_reader :auto_filter
|
|
613
563
|
|
|
614
564
|
# Sets the auto-filter range for the worksheet.
|
|
615
565
|
#
|
|
@@ -618,8 +568,7 @@ module Xlsxrb
|
|
|
618
568
|
# @api public
|
|
619
569
|
#: (String? range) -> String?
|
|
620
570
|
def auto_filter=(range)
|
|
621
|
-
auto_filter
|
|
622
|
-
range
|
|
571
|
+
@auto_filter = range&.to_s
|
|
623
572
|
end
|
|
624
573
|
|
|
625
574
|
# Configures filtering rules on a specific column of an auto-filter.
|
|
@@ -628,30 +577,35 @@ module Xlsxrb
|
|
|
628
577
|
# @param filter [Hash] Filter criteria (e.g. values, custom filters).
|
|
629
578
|
# @return [void]
|
|
630
579
|
# @api public
|
|
631
|
-
#: (Integer | String | Symbol col_id, untyped filter) -> void
|
|
580
|
+
#: (Integer | String | Symbol col_id, (Hash[untyped, untyped] | Array[untyped]) filter) -> void
|
|
632
581
|
def filter_column(col_id, filter)
|
|
633
582
|
col_id = Elements::Cell._column_index(col_id) if col_id.is_a?(String) || col_id.is_a?(Symbol)
|
|
634
583
|
@filter_columns[col_id] = filter
|
|
635
584
|
nil
|
|
636
585
|
end
|
|
637
586
|
|
|
638
|
-
# Configures column sort state for the sheet.
|
|
587
|
+
# Configures or queries column sort state for the sheet.
|
|
639
588
|
#
|
|
640
|
-
#
|
|
641
|
-
#
|
|
589
|
+
# When called with no arguments, returns the {Elements::SortState} value object.
|
|
590
|
+
# When called with arguments, updates sort state and returns nil.
|
|
591
|
+
#
|
|
592
|
+
# @param ref [String, nil] The sorted range.
|
|
593
|
+
# @param sort_conditions [Array<Hash>, nil] List of sort condition definitions.
|
|
594
|
+
# @param case_sensitive [Boolean] Whether sorting is case sensitive.
|
|
595
|
+
# @param sort_method [String, nil] Sort method.
|
|
642
596
|
# @param opts [Hash] Additional sort state options.
|
|
643
|
-
# @return [Elements::SortState,
|
|
597
|
+
# @return [Elements::SortState, nil, void]
|
|
644
598
|
# @api public
|
|
645
|
-
#: (
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return Elements::SortState.new(**@sort_state)
|
|
650
|
-
|
|
651
|
-
return @sort_state
|
|
599
|
+
#: () -> Elements::SortState?
|
|
600
|
+
#: (?String? ref, ?Array[Hash[untyped, untyped]]? sort_conditions, ?case_sensitive: bool, ?sort_method: String?, **untyped opts) -> void
|
|
601
|
+
def sort_state(ref = nil, sort_conditions = nil, case_sensitive: false, sort_method: nil, **opts)
|
|
602
|
+
if ref.nil? && sort_conditions.nil?
|
|
603
|
+
return @sort_state ? Elements::SortState.new(**@sort_state) : nil
|
|
652
604
|
end
|
|
653
605
|
|
|
654
|
-
|
|
606
|
+
entry = { ref: ref, sort_conditions: sort_conditions, case_sensitive: case_sensitive }
|
|
607
|
+
entry[:sort_method] = sort_method if sort_method
|
|
608
|
+
@sort_state = entry.merge(opts)
|
|
655
609
|
nil
|
|
656
610
|
end
|
|
657
611
|
|
|
@@ -660,7 +614,7 @@ module Xlsxrb
|
|
|
660
614
|
# @param opts [Elements::SortState, Hash, nil] Sort state options.
|
|
661
615
|
# @return [void]
|
|
662
616
|
# @api public
|
|
663
|
-
#: (untyped opts) -> void
|
|
617
|
+
#: (Elements::SortState | Hash[Symbol, untyped] | nil opts) -> void
|
|
664
618
|
def sort_state=(opts)
|
|
665
619
|
@sort_state = opts&.respond_to?(:to_h) ? opts.to_h : opts
|
|
666
620
|
nil
|
|
@@ -679,13 +633,6 @@ module Xlsxrb
|
|
|
679
633
|
@data_validations.concat(normalized_list)
|
|
680
634
|
end
|
|
681
635
|
|
|
682
|
-
# @deprecated Use {#data_validation} instead.
|
|
683
|
-
#: (?String? sqref, **untyped opts) ?{ (DataValidationBuilder) -> void } -> void
|
|
684
|
-
def validate_data(...)
|
|
685
|
-
warn "[DEPRECATION] `validate_data` is deprecated; use `data_validation` instead.", uplevel: 1
|
|
686
|
-
data_validation(...)
|
|
687
|
-
end
|
|
688
|
-
|
|
689
636
|
# Adds a conditional formatting rule to a cell range.
|
|
690
637
|
# Supports block configuration via {ConditionalFormatBuilder} and coordinate targeting (:columns, :rows).
|
|
691
638
|
#
|
|
@@ -737,29 +684,22 @@ module Xlsxrb
|
|
|
737
684
|
# @param source_ref [String] Source data range (e.g. "DataSheet!A1:D100").
|
|
738
685
|
# @param row_fields [Array<Integer, String>] Field names or indices for row headers.
|
|
739
686
|
# @param data_fields [Array<Hash>] Data aggregation fields.
|
|
740
|
-
# @param
|
|
741
|
-
# @param
|
|
687
|
+
# @param column_fields [Array<String, Integer>, nil] Field names or indices for columns.
|
|
688
|
+
# @param ref [String, nil] Target cell for pivot table top-left corner (e.g. "E1").
|
|
742
689
|
# @param name [String, nil] Pivot table name.
|
|
743
690
|
# @param field_names [Array<String>, nil] Custom field display names.
|
|
744
|
-
# @param items [Array, nil]
|
|
745
|
-
# @param column_fields [Array<String, Integer>] Field names or indices for columns.
|
|
746
|
-
# @param col_fields [Array<String, Integer>] Deprecated alias for column_fields.
|
|
747
|
-
# @param ref [String] Target cell for pivot table top-left corner (e.g. "E1").
|
|
748
|
-
# @param dest_ref [String] Deprecated alias for ref.
|
|
691
|
+
# @param items [Hash{Integer => Array}, nil] Items of each field, by 0-based field index.
|
|
749
692
|
# @return [void]
|
|
750
693
|
# @api public
|
|
751
|
-
#: (String source_ref, row_fields: Array[String | Integer], data_fields: Array[String | Hash[Symbol, untyped]], ?column_fields: Array[String | Integer]?, ?
|
|
752
|
-
def pivot_table(source_ref, row_fields:, data_fields:, column_fields: nil,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
c_fields = column_fields || col_fields || []
|
|
756
|
-
target_ref = ref || dest_ref || "E1"
|
|
694
|
+
#: (String source_ref, row_fields: Array[String | Integer], data_fields: Array[String | Hash[Symbol, untyped]], ?column_fields: Array[String | Integer]?, ?ref: String?, ?name: String?, ?field_names: Array[String]?, ?items: Hash[Integer, Array[untyped]]?, **untyped opts) -> void
|
|
695
|
+
def pivot_table(source_ref, row_fields:, data_fields:, column_fields: nil, ref: nil, name: nil, field_names: nil, items: nil, **opts)
|
|
696
|
+
c_fields = column_fields || []
|
|
697
|
+
target_ref = ref || "E1"
|
|
757
698
|
@pivot_tables ||= []
|
|
758
699
|
entry = {
|
|
759
700
|
source_ref: source_ref, row_fields: row_fields,
|
|
760
701
|
data_fields: data_fields, column_fields: c_fields,
|
|
761
|
-
|
|
762
|
-
dest_ref: target_ref, name: name,
|
|
702
|
+
ref: target_ref, destination: target_ref, name: name,
|
|
763
703
|
field_names: field_names, items: items
|
|
764
704
|
}.merge(opts)
|
|
765
705
|
@pivot_tables << entry
|
|
@@ -770,12 +710,13 @@ module Xlsxrb
|
|
|
770
710
|
# @param cell [String, Integer] Cell reference (e.g. "B2").
|
|
771
711
|
# @param text [String] The comment text.
|
|
772
712
|
# @param author [String] Author name.
|
|
713
|
+
# @param visible [Boolean] Whether the comment is always shown instead of on hover.
|
|
773
714
|
# @return [void]
|
|
774
715
|
# @api public
|
|
775
|
-
#: (String | Integer cell, String text, ?author: ::String) -> void
|
|
776
|
-
def comment(cell, text, author: "Author")
|
|
716
|
+
#: (String | Integer cell, String text, ?author: ::String, ?visible: bool) -> void
|
|
717
|
+
def comment(cell, text, author: "Author", visible: false)
|
|
777
718
|
ref_str = cell.to_s
|
|
778
|
-
@comments << { ref: ref_str, text: text, author: author }
|
|
719
|
+
@comments << { ref: ref_str, text: text, author: author, visible: visible }
|
|
779
720
|
nil
|
|
780
721
|
end
|
|
781
722
|
|
|
@@ -800,17 +741,18 @@ module Xlsxrb
|
|
|
800
741
|
text: text,
|
|
801
742
|
author: author,
|
|
802
743
|
timestamp: timestamp,
|
|
744
|
+
created_at: timestamp,
|
|
803
745
|
id: id,
|
|
804
746
|
parent_id: parent_id,
|
|
805
747
|
done: done ? true : false,
|
|
748
|
+
resolved: done ? true : false,
|
|
806
749
|
user_id: user_id,
|
|
750
|
+
author_id: user_id,
|
|
807
751
|
provider_id: provider_id
|
|
808
752
|
}.compact
|
|
809
753
|
@threaded_comments << entry
|
|
810
754
|
nil
|
|
811
755
|
end
|
|
812
|
-
# @deprecated Use {#threaded_comment} instead. Will be removed in 0.2.0.
|
|
813
|
-
alias add_threaded_comment threaded_comment
|
|
814
756
|
|
|
815
757
|
# Adds a sparkline group to the sheet.
|
|
816
758
|
#
|
|
@@ -827,84 +769,43 @@ module Xlsxrb
|
|
|
827
769
|
@sparkline_groups << group
|
|
828
770
|
end
|
|
829
771
|
|
|
830
|
-
# Adds a single sparkline to the sheet.
|
|
831
|
-
#
|
|
832
|
-
# @example Add a line sparkline
|
|
833
|
-
# sheet.add_sparkline(location: "F1", range: "A1:E1")
|
|
834
|
-
#
|
|
835
|
-
# @example Add a column sparkline with high/low markers
|
|
836
|
-
# sheet.add_sparkline(location: "F2", range: "A2:E2", type: :column, high: true, low: true)
|
|
837
|
-
#
|
|
838
|
-
# @example Add a win/loss sparkline
|
|
839
|
-
# sheet.add_sparkline(location: "F3", range: "A3:E3", type: :win_loss)
|
|
840
|
-
#
|
|
841
|
-
# @deprecated Use {#sparkline_group} instead. Will be removed in 0.2.0.
|
|
842
|
-
# @param location [String, nil] Target cell for the sparkline (e.g. "F1").
|
|
843
|
-
# @param range [String, nil] Data range for the sparkline (e.g. "A1:E1").
|
|
844
|
-
# @param type [Symbol, String, nil] Sparkline type (:line, :column, :win_loss / :stacked).
|
|
845
|
-
# @param opts [Hash] Additional sparkline options.
|
|
846
|
-
# @return [void]
|
|
847
|
-
# @api public
|
|
848
|
-
#: (?location: String?, ?range: String?, ?type: (String | Symbol)?, **untyped opts) -> void
|
|
849
|
-
def add_sparkline(location: nil, range: nil, type: nil, **opts)
|
|
850
|
-
warn "[DEPRECATION] #add_sparkline is deprecated; use #sparkline_group instead.", uplevel: 1
|
|
851
|
-
loc = location || opts.delete(:location_ref)
|
|
852
|
-
rng = range || opts.delete(:data_ref) || opts.delete(:data)
|
|
853
|
-
raise ArgumentError, "Missing required location: parameter for sparkline" unless loc
|
|
854
|
-
raise ArgumentError, "Missing required range: parameter for sparkline" unless rng
|
|
855
|
-
|
|
856
|
-
mapped_type = case type&.to_s
|
|
857
|
-
when "win_loss" then "stacked"
|
|
858
|
-
when nil, "" then nil
|
|
859
|
-
else type.to_s
|
|
860
|
-
end
|
|
861
|
-
sparkline_group(sparklines: [{ data_ref: rng.to_s, location_ref: loc.to_s }], type: mapped_type, **opts)
|
|
862
|
-
end
|
|
863
|
-
|
|
864
772
|
# Merges a range of cells into a single cell.
|
|
865
773
|
#
|
|
866
774
|
# @example Merge with string range
|
|
867
775
|
# sheet.merge("A1:C1")
|
|
868
776
|
#
|
|
869
|
-
# @
|
|
870
|
-
# @param range [String, Hash, nil] Cell range (e.g. "A1:B2") or hash of coordinates.
|
|
871
|
-
# @param row [Integer, nil] Single row index.
|
|
872
|
-
# @param col_start [Integer, String, nil] Starting column.
|
|
873
|
-
# @param col_end [Integer, String, nil] Ending column.
|
|
874
|
-
# @param row_start [Integer, nil] Starting row index.
|
|
875
|
-
# @param row_end [Integer, nil] Ending row index.
|
|
777
|
+
# @param range [String] Cell range (e.g. "A1:B2").
|
|
876
778
|
# @return [void]
|
|
877
779
|
# @api public
|
|
878
|
-
#: (
|
|
879
|
-
def merge(range
|
|
880
|
-
canonical = DslHelpers.normalize_merge_range(
|
|
881
|
-
range,
|
|
882
|
-
row: row, col_start: col_start, col_end: col_end,
|
|
883
|
-
row_start: row_start, row_end: row_end,
|
|
884
|
-
strict_excel_mode: @strict_excel_mode
|
|
885
|
-
)
|
|
780
|
+
#: (String range) -> void
|
|
781
|
+
def merge(range)
|
|
782
|
+
canonical = DslHelpers.normalize_merge_range(range, strict_excel_mode: @strict_excel_mode)
|
|
886
783
|
@merge_cells_ranges << canonical unless @merge_cells_ranges.include?(canonical)
|
|
887
784
|
end
|
|
888
785
|
|
|
889
|
-
#
|
|
786
|
+
# Configures or queries freeze panes (<pane state="frozen">).
|
|
787
|
+
#
|
|
788
|
+
# When called with no arguments, returns the {Elements::FreezePane} value object or nil.
|
|
789
|
+
# When called with arguments, configures the freeze pane and returns nil.
|
|
890
790
|
#
|
|
891
791
|
# @param row [Integer, nil] Number of rows to freeze from top (0-based split position).
|
|
892
792
|
# @param column [Integer, String, nil] Number of columns to freeze from left (0-based or letter).
|
|
893
|
-
# @param
|
|
894
|
-
# @
|
|
793
|
+
# @param top_left_cell [String, nil] Top-left cell reference in bottom-right pane.
|
|
794
|
+
# @param active_pane [String, Symbol, nil] Active pane identifier.
|
|
795
|
+
# @return [Elements::FreezePane, nil, void]
|
|
895
796
|
# @api public
|
|
896
|
-
#: (
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
return Elements::FreezePane.new(**@freeze_pane)
|
|
901
|
-
|
|
902
|
-
return @freeze_pane
|
|
797
|
+
#: () -> Elements::FreezePane?
|
|
798
|
+
#: (?row: Integer | nil, ?column: (Integer | String)?, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
799
|
+
def freeze_pane(row: nil, column: nil, top_left_cell: nil, active_pane: nil)
|
|
800
|
+
if row.nil? && column.nil? && top_left_cell.nil? && active_pane.nil?
|
|
801
|
+
return @freeze_pane ? Elements::FreezePane.new(**@freeze_pane) : nil
|
|
903
802
|
end
|
|
904
803
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
804
|
+
c = column ? Elements::Cell._column_index(column) : 0
|
|
805
|
+
entry = { row: row || 0, column: c }
|
|
806
|
+
entry[:top_left_cell] = top_left_cell if top_left_cell
|
|
807
|
+
entry[:active_pane] = active_pane.to_s if active_pane
|
|
808
|
+
@freeze_pane = entry
|
|
908
809
|
nil
|
|
909
810
|
end
|
|
910
811
|
|
|
@@ -913,7 +814,7 @@ module Xlsxrb
|
|
|
913
814
|
# @param opts [Elements::FreezePane, Hash, nil] Freeze pane options.
|
|
914
815
|
# @return [void]
|
|
915
816
|
# @api public
|
|
916
|
-
#: (untyped opts) -> void
|
|
817
|
+
#: (Elements::FreezePane | Hash[Symbol, untyped] | nil opts) -> void
|
|
917
818
|
def freeze_pane=(opts)
|
|
918
819
|
if opts.nil?
|
|
919
820
|
@freeze_pane = nil
|
|
@@ -921,32 +822,34 @@ module Xlsxrb
|
|
|
921
822
|
h = opts.respond_to?(:to_h) ? opts.to_h : opts
|
|
922
823
|
c = h[:column] || h[:col]
|
|
923
824
|
c = Elements::Cell._column_index(c) if c
|
|
924
|
-
|
|
825
|
+
entry = { row: h[:row] || 0, column: c || 0 }
|
|
826
|
+
entry[:top_left_cell] = h[:top_left_cell] if h[:top_left_cell]
|
|
827
|
+
entry[:active_pane] = h[:active_pane].to_s if h[:active_pane]
|
|
828
|
+
@freeze_pane = entry
|
|
925
829
|
end
|
|
926
830
|
nil
|
|
927
831
|
end
|
|
928
832
|
|
|
929
|
-
# Splits window panes without freezing or queries split pane settings.
|
|
833
|
+
# Splits window panes without freezing or queries split pane settings (<pane>).
|
|
834
|
+
#
|
|
835
|
+
# When called with no arguments, returns the {Elements::SplitPane} value object or nil.
|
|
836
|
+
# When called with arguments, configures the split pane and returns nil.
|
|
930
837
|
#
|
|
931
838
|
# @param x_split [Integer, nil] Horizontal split offset in points.
|
|
932
839
|
# @param y_split [Integer, nil] Vertical split offset in points.
|
|
933
840
|
# @param top_left_cell [String, nil] Top-left cell reference in bottom-right pane.
|
|
934
841
|
# @param active_pane [String, Symbol, nil] Active pane identifier.
|
|
935
|
-
# @
|
|
936
|
-
# @return [Elements::SplitPane, Hash<Symbol, untyped>, nil, void]
|
|
842
|
+
# @return [Elements::SplitPane, nil, void]
|
|
937
843
|
# @api public
|
|
938
|
-
#: (
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
return Elements::SplitPane.new(**@split_pane)
|
|
943
|
-
|
|
944
|
-
return @split_pane
|
|
844
|
+
#: () -> Elements::SplitPane?
|
|
845
|
+
#: (?x_split: Integer | nil, ?y_split: Integer | nil, ?top_left_cell: String?, ?active_pane: (String | Symbol)?) -> void
|
|
846
|
+
def split_pane(x_split: nil, y_split: nil, top_left_cell: nil, active_pane: nil)
|
|
847
|
+
if x_split.nil? && y_split.nil? && top_left_cell.nil? && active_pane.nil?
|
|
848
|
+
return @split_pane ? Elements::SplitPane.new(**@split_pane) : nil
|
|
945
849
|
end
|
|
946
850
|
|
|
947
851
|
entry = { x_split: x_split || 0, y_split: y_split || 0, top_left_cell: top_left_cell }
|
|
948
852
|
entry[:active_pane] = active_pane.to_s if active_pane
|
|
949
|
-
entry[:state] = state.to_s if state
|
|
950
853
|
@split_pane = entry
|
|
951
854
|
nil
|
|
952
855
|
end
|
|
@@ -956,7 +859,7 @@ module Xlsxrb
|
|
|
956
859
|
# @param opts [Elements::SplitPane, Hash, nil] Split pane options.
|
|
957
860
|
# @return [void]
|
|
958
861
|
# @api public
|
|
959
|
-
#: (untyped opts) -> void
|
|
862
|
+
#: (Elements::SplitPane | Hash[Symbol, untyped] | nil opts) -> void
|
|
960
863
|
def split_pane=(opts)
|
|
961
864
|
if opts.nil?
|
|
962
865
|
@split_pane = nil
|
|
@@ -964,31 +867,29 @@ module Xlsxrb
|
|
|
964
867
|
h = opts.respond_to?(:to_h) ? opts.to_h : opts
|
|
965
868
|
entry = { x_split: h[:x_split] || 0, y_split: h[:y_split] || 0, top_left_cell: h[:top_left_cell] }
|
|
966
869
|
entry[:active_pane] = h[:active_pane].to_s if h[:active_pane]
|
|
967
|
-
entry[:state] = h[:state].to_s if h[:state]
|
|
968
870
|
@split_pane = entry
|
|
969
871
|
end
|
|
970
872
|
nil
|
|
971
873
|
end
|
|
972
874
|
|
|
973
|
-
#
|
|
875
|
+
# Configures or queries the active cell and selection area (<selection>).
|
|
876
|
+
#
|
|
877
|
+
# When called with no arguments, returns the selection ({Elements::Selection}, Array, or nil).
|
|
878
|
+
# When called with arguments, updates the selection and returns nil.
|
|
974
879
|
#
|
|
975
880
|
# @param active_cell [String, nil] Active cell reference (e.g. "A1") or range (e.g. "A1:D10").
|
|
976
881
|
# @param sqref [String, nil] Selected range reference (e.g. "A1:D10").
|
|
977
882
|
# @param pane [String, Symbol, nil] Target pane (:topLeft, :topRight, :bottomLeft, :bottomRight).
|
|
978
|
-
# @return [Elements::Selection, Array<Elements::Selection>,
|
|
883
|
+
# @return [Elements::Selection, Array<Elements::Selection>, nil, void]
|
|
979
884
|
# @api public
|
|
980
|
-
#: (
|
|
885
|
+
#: () -> (Elements::Selection | Array[Elements::Selection])?
|
|
886
|
+
#: (?String? active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
981
887
|
def selection(active_cell = nil, sqref: nil, pane: nil)
|
|
982
888
|
if active_cell.nil? && sqref.nil? && pane.nil?
|
|
983
889
|
return nil if @selection.nil?
|
|
890
|
+
return @selection.map { |s| Elements::Selection.new(**s) } if @selection.is_a?(Array)
|
|
984
891
|
|
|
985
|
-
|
|
986
|
-
return @selection.map { |s| Elements::Selection.new(**s) } if @selection.is_a?(Array)
|
|
987
|
-
|
|
988
|
-
return Elements::Selection.new(**@selection)
|
|
989
|
-
end
|
|
990
|
-
|
|
991
|
-
return @selection
|
|
892
|
+
return Elements::Selection.new(**@selection)
|
|
992
893
|
end
|
|
993
894
|
|
|
994
895
|
if sqref.nil? && active_cell.is_a?(String) && active_cell.include?(":")
|
|
@@ -997,8 +898,9 @@ module Xlsxrb
|
|
|
997
898
|
else
|
|
998
899
|
sqref ||= active_cell
|
|
999
900
|
end
|
|
1000
|
-
|
|
1001
|
-
|
|
901
|
+
sel = { active_cell: active_cell, sqref: sqref }
|
|
902
|
+
sel[:pane] = pane if pane
|
|
903
|
+
@selection = sel
|
|
1002
904
|
nil
|
|
1003
905
|
end
|
|
1004
906
|
|
|
@@ -1007,7 +909,7 @@ module Xlsxrb
|
|
|
1007
909
|
# @param opts [Elements::Selection, Array<Elements::Selection, Hash>, Hash, nil]
|
|
1008
910
|
# @return [void]
|
|
1009
911
|
# @api public
|
|
1010
|
-
#: (untyped opts) -> void
|
|
912
|
+
#: (Elements::Selection | Array[Elements::Selection | Hash[Symbol, untyped]] | Hash[Symbol, untyped] | nil opts) -> void
|
|
1011
913
|
def selection=(opts)
|
|
1012
914
|
@selection = if opts.nil?
|
|
1013
915
|
nil
|
|
@@ -1019,16 +921,9 @@ module Xlsxrb
|
|
|
1019
921
|
nil
|
|
1020
922
|
end
|
|
1021
923
|
|
|
1022
|
-
# @deprecated Use {#selection} instead.
|
|
1023
|
-
#: (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
1024
|
-
def select_cell(...)
|
|
1025
|
-
warn "[DEPRECATION] `select_cell` is deprecated; use `selection` instead.", uplevel: 1
|
|
1026
|
-
selection(...)
|
|
1027
|
-
end
|
|
1028
|
-
|
|
1029
924
|
# Configures or queries page margins in inches for printing (<pageMargins>).
|
|
1030
925
|
#
|
|
1031
|
-
# When called with no arguments, returns the
|
|
926
|
+
# When called with no arguments, returns the {Elements::PageMargins} value object or nil.
|
|
1032
927
|
# When called with arguments, configures page margins and returns nil.
|
|
1033
928
|
#
|
|
1034
929
|
# @param left [Float, nil] Left margin.
|
|
@@ -1037,15 +932,13 @@ module Xlsxrb
|
|
|
1037
932
|
# @param bottom [Float, nil] Bottom margin.
|
|
1038
933
|
# @param header [Float, nil] Header margin.
|
|
1039
934
|
# @param footer [Float, nil] Footer margin.
|
|
1040
|
-
# @return [Elements::PageMargins,
|
|
935
|
+
# @return [Elements::PageMargins, nil, void]
|
|
1041
936
|
# @api public
|
|
1042
|
-
#: (
|
|
937
|
+
#: () -> Elements::PageMargins?
|
|
938
|
+
#: (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> void
|
|
1043
939
|
def page_margins(left: nil, right: nil, top: nil, bottom: nil, header: nil, footer: nil)
|
|
1044
940
|
if left.nil? && right.nil? && top.nil? && bottom.nil? && header.nil? && footer.nil?
|
|
1045
|
-
return
|
|
1046
|
-
return Elements::PageMargins.new(**@page_margins) if defined?(Elements::PageMargins)
|
|
1047
|
-
|
|
1048
|
-
return @page_margins
|
|
941
|
+
return @page_margins ? Elements::PageMargins.new(**@page_margins) : nil
|
|
1049
942
|
end
|
|
1050
943
|
|
|
1051
944
|
@page_margins = DslHelpers.normalize_page_margins(
|
|
@@ -1059,7 +952,7 @@ module Xlsxrb
|
|
|
1059
952
|
# @param opts [Hash, Elements::PageMargins, nil]
|
|
1060
953
|
# @return [void]
|
|
1061
954
|
# @api public
|
|
1062
|
-
#: (untyped opts) -> void
|
|
955
|
+
#: (Hash[Symbol, untyped] | Elements::PageMargins | nil opts) -> void
|
|
1063
956
|
def page_margins=(opts)
|
|
1064
957
|
if opts.nil?
|
|
1065
958
|
@page_margins = nil
|
|
@@ -1072,17 +965,16 @@ module Xlsxrb
|
|
|
1072
965
|
|
|
1073
966
|
# Configures or queries page setup configuration (<pageSetup>).
|
|
1074
967
|
#
|
|
1075
|
-
# When called with no arguments, returns the
|
|
968
|
+
# When called with no arguments, returns the {Elements::PageSetup} value object.
|
|
1076
969
|
# When called with keyword arguments, updates page setup and returns nil.
|
|
1077
970
|
#
|
|
1078
971
|
# @param opts [Hash] Page setup options (e.g. orientation: :landscape, paper_size: 9).
|
|
1079
|
-
# @return [Elements::PageSetup,
|
|
972
|
+
# @return [Elements::PageSetup, void]
|
|
1080
973
|
# @api public
|
|
1081
|
-
#: (
|
|
974
|
+
#: () -> Elements::PageSetup
|
|
975
|
+
#: (**untyped opts) -> void
|
|
1082
976
|
def page_setup(**opts)
|
|
1083
|
-
if opts.empty?
|
|
1084
|
-
return defined?(Elements::PageSetup) ? Elements::PageSetup.new(**@page_setup) : @page_setup
|
|
1085
|
-
end
|
|
977
|
+
return Elements::PageSetup.new(**@page_setup) if opts.empty?
|
|
1086
978
|
|
|
1087
979
|
@page_setup.merge!(opts)
|
|
1088
980
|
@sheet_properties[:fit_to_page] = true if (opts.key?(:fit_to_width) || opts.key?(:fit_to_height)) && !@sheet_properties.key?(:fit_to_page)
|
|
@@ -1094,44 +986,20 @@ module Xlsxrb
|
|
|
1094
986
|
# @param opts [Hash, Elements::PageSetup]
|
|
1095
987
|
# @return [void]
|
|
1096
988
|
# @api public
|
|
1097
|
-
#: (untyped opts) -> void
|
|
989
|
+
#: (Hash[Symbol, untyped] | Elements::PageSetup opts) -> void
|
|
1098
990
|
def page_setup=(opts)
|
|
1099
991
|
h = opts.respond_to?(:to_h) ? opts.to_h : (opts || {})
|
|
1100
992
|
@page_setup = h.transform_keys(&:to_sym)
|
|
1101
993
|
nil
|
|
1102
994
|
end
|
|
1103
995
|
|
|
1104
|
-
#
|
|
1105
|
-
# When enabled, optionally sets fit_to_width and/or fit_to_height on page_setup.
|
|
996
|
+
# Returns whether page setup fits content to page width/height.
|
|
1106
997
|
#
|
|
1107
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#fit_to_page=} or {#page_setup} with :fit_to_width/:fit_to_height instead.
|
|
1108
|
-
# @param enabled [Boolean, nil] Whether to fit to page.
|
|
1109
|
-
# @param width [Integer, nil] Pages wide to fit to.
|
|
1110
|
-
# @param height [Integer, nil] Pages tall to fit to.
|
|
1111
|
-
# @return [Boolean, void]
|
|
1112
|
-
# @api public
|
|
1113
|
-
#: (?bool? enabled, ?width: Integer?, ?height: Integer?) -> (bool | void)
|
|
1114
|
-
def fit_to_page(enabled = OMITTED, width: nil, height: nil)
|
|
1115
|
-
if enabled.equal?(OMITTED) && width.nil? && height.nil?
|
|
1116
|
-
return @sheet_properties[:fit_to_page] ? true : false
|
|
1117
|
-
end
|
|
1118
|
-
|
|
1119
|
-
@sheet_properties[:fit_to_page] = if enabled.equal?(OMITTED)
|
|
1120
|
-
true
|
|
1121
|
-
else
|
|
1122
|
-
enabled ? true : false
|
|
1123
|
-
end
|
|
1124
|
-
page_setup(fit_to_width: width) if width
|
|
1125
|
-
page_setup(fit_to_height: height) if height
|
|
1126
|
-
end
|
|
1127
|
-
|
|
1128
|
-
# @deprecated Use {#fit_to_page} instead. Will be removed in 0.2.0.
|
|
1129
998
|
# @return [Boolean]
|
|
1130
999
|
# @api public
|
|
1131
1000
|
#: () -> bool
|
|
1132
1001
|
def fit_to_page?
|
|
1133
|
-
|
|
1134
|
-
fit_to_page
|
|
1002
|
+
@sheet_properties[:fit_to_page] ? true : false
|
|
1135
1003
|
end
|
|
1136
1004
|
|
|
1137
1005
|
# Sets whether page setup fits content to page width/height.
|
|
@@ -1146,17 +1014,16 @@ module Xlsxrb
|
|
|
1146
1014
|
|
|
1147
1015
|
# Configures or queries headers and footers for printing (<headerFooter>).
|
|
1148
1016
|
#
|
|
1149
|
-
# When called with no arguments, returns the
|
|
1017
|
+
# When called with no arguments, returns the {Elements::HeaderFooter} value object.
|
|
1150
1018
|
# When called with keyword arguments, updates headers and footers and returns nil.
|
|
1151
1019
|
#
|
|
1152
1020
|
# @param opts [Hash] Header and footer options (e.g. odd_header: "&CHeader Text").
|
|
1153
|
-
# @return [Elements::HeaderFooter,
|
|
1021
|
+
# @return [Elements::HeaderFooter, void]
|
|
1154
1022
|
# @api public
|
|
1155
|
-
#: (
|
|
1023
|
+
#: () -> Elements::HeaderFooter
|
|
1024
|
+
#: (**untyped opts) -> void
|
|
1156
1025
|
def header_footer(**opts)
|
|
1157
|
-
if opts.empty?
|
|
1158
|
-
return defined?(Elements::HeaderFooter) ? Elements::HeaderFooter.new(**@header_footer) : @header_footer
|
|
1159
|
-
end
|
|
1026
|
+
return Elements::HeaderFooter.new(**@header_footer) if opts.empty?
|
|
1160
1027
|
|
|
1161
1028
|
@header_footer.merge!(opts)
|
|
1162
1029
|
nil
|
|
@@ -1167,7 +1034,7 @@ module Xlsxrb
|
|
|
1167
1034
|
# @param opts [Hash, Elements::HeaderFooter]
|
|
1168
1035
|
# @return [void]
|
|
1169
1036
|
# @api public
|
|
1170
|
-
#: (untyped opts) -> void
|
|
1037
|
+
#: (Hash[Symbol, untyped] | Elements::HeaderFooter opts) -> void
|
|
1171
1038
|
def header_footer=(opts)
|
|
1172
1039
|
h = opts.respond_to?(:to_h) ? opts.to_h : (opts || {})
|
|
1173
1040
|
@header_footer = h.transform_keys(&:to_sym)
|
|
@@ -1177,22 +1044,16 @@ module Xlsxrb
|
|
|
1177
1044
|
# Configures or queries print options (<printOptions>).
|
|
1178
1045
|
#
|
|
1179
1046
|
# When called with no arguments, returns the {Elements::PrintOptions} value object.
|
|
1180
|
-
# When called with
|
|
1047
|
+
# When called with keyword options, configures print options and returns nil.
|
|
1181
1048
|
#
|
|
1182
|
-
# @param name [Symbol, String, Hash, Elements::MetadataRecord, nil] Option name or hash/record of options.
|
|
1183
|
-
# @param value [Object, nil] Option value.
|
|
1184
1049
|
# @param opts [Hash] Additional print options.
|
|
1185
1050
|
# @return [Elements::PrintOptions, void]
|
|
1186
1051
|
# @api public
|
|
1187
|
-
#: (
|
|
1188
|
-
|
|
1189
|
-
|
|
1052
|
+
#: () -> Elements::PrintOptions
|
|
1053
|
+
#: (**untyped opts) -> void
|
|
1054
|
+
def print_options(**opts)
|
|
1055
|
+
return Elements::PrintOptions.new(**@print_options) if opts.empty?
|
|
1190
1056
|
|
|
1191
|
-
if name.is_a?(Hash) || (name.respond_to?(:to_h) && !name.is_a?(Symbol) && !name.is_a?(String))
|
|
1192
|
-
opts = name.to_h.merge(opts)
|
|
1193
|
-
name = nil
|
|
1194
|
-
end
|
|
1195
|
-
@print_options[name.to_sym] = value if name && !value.nil?
|
|
1196
1057
|
opts.each { |k, v| @print_options[k.to_sym] = v }
|
|
1197
1058
|
nil
|
|
1198
1059
|
end
|
|
@@ -1215,57 +1076,34 @@ module Xlsxrb
|
|
|
1215
1076
|
# @param name [String] Defined name identifier.
|
|
1216
1077
|
# @param value [Object, nil] Cell reference, formula, or constant.
|
|
1217
1078
|
# @param hidden [Boolean] Whether the defined name is hidden from Excel's UI.
|
|
1218
|
-
# @param column [Integer, String, nil] Deprecated alias for columns.
|
|
1219
1079
|
# @param columns [Integer, String, nil] Column index or letter for coordinate-based reference.
|
|
1220
|
-
# @param
|
|
1221
|
-
# @param row [Integer, Range, nil] Deprecated alias for rows.
|
|
1222
|
-
# @param rows [Integer, Range, nil] Row or row range (1-based) for coordinate-based reference.
|
|
1080
|
+
# @param rows [Integer, Range, nil] Row or row range (0-based) for coordinate-based reference.
|
|
1223
1081
|
# @param range [String, nil] Cell range reference (e.g. "A1:A10").
|
|
1224
1082
|
# @param sheet [String, nil] Reference sheet name (defaults to current sheet).
|
|
1225
1083
|
# @param scope [String, Symbol, nil] Scope identifier (:workbook or sheet name).
|
|
1226
|
-
# @param local [Boolean] Deprecated alias for scope: :current.
|
|
1227
1084
|
# @return [void]
|
|
1228
1085
|
# @api public
|
|
1229
|
-
#: (String name, ?untyped value, ?hidden: bool, ?
|
|
1230
|
-
def defined_name(name, value = nil, hidden: false,
|
|
1231
|
-
warn "[DEPRECATION] `col:` is deprecated; use `column:` (or `columns:`) instead.", uplevel: 1 if col
|
|
1232
|
-
warn "[DEPRECATION] `local:` is deprecated; use `scope:` instead.", uplevel: 1 if local
|
|
1233
|
-
warn "[Xlsxrb DEPRECATION] defined_name keyword column: is deprecated; use columns: instead.", uplevel: 1 unless column.nil?
|
|
1234
|
-
warn "[Xlsxrb DEPRECATION] defined_name keyword row: is deprecated; use rows: instead.", uplevel: 1 unless row.nil?
|
|
1235
|
-
c_arg = column || columns || col
|
|
1236
|
-
r_arg = row || rows
|
|
1086
|
+
#: (String name, ?untyped value, ?hidden: bool, ?columns: untyped, ?rows: untyped, ?range: untyped, ?sheet: String?, ?scope: (String | Symbol)?) -> void
|
|
1087
|
+
def defined_name(name, value = nil, hidden: false, columns: nil, rows: nil, range: nil, sheet: nil, scope: nil)
|
|
1237
1088
|
ref_sheet = sheet || @name
|
|
1238
|
-
normalized_val = DslHelpers.normalize_defined_name_value(value, sheet: ref_sheet,
|
|
1089
|
+
normalized_val = DslHelpers.normalize_defined_name_value(value, sheet: ref_sheet, columns: columns, rows: rows, range: range)
|
|
1239
1090
|
entry = { name: name, value: normalized_val, hidden: hidden }
|
|
1240
1091
|
local_sheet = if scope
|
|
1241
1092
|
scope == :workbook ? nil : scope.to_s
|
|
1242
|
-
elsif local
|
|
1243
|
-
@name || sheet
|
|
1244
|
-
else
|
|
1245
|
-
sheet
|
|
1246
1093
|
end
|
|
1247
1094
|
entry[:local_sheet_name] = local_sheet if local_sheet
|
|
1248
1095
|
@defined_names << entry
|
|
1249
1096
|
end
|
|
1250
1097
|
|
|
1251
|
-
#
|
|
1252
|
-
#
|
|
1253
|
-
# @example Set print area range
|
|
1254
|
-
# sheet.print_area("A1:H50")
|
|
1098
|
+
# Returns the print area for the worksheet, or nil if none.
|
|
1255
1099
|
#
|
|
1256
1100
|
# @example Get print area range
|
|
1257
1101
|
# sheet.print_area #=> "A1:H50"
|
|
1258
1102
|
#
|
|
1259
|
-
# @
|
|
1260
|
-
# @return [String, nil, void]
|
|
1103
|
+
# @return [String, nil]
|
|
1261
1104
|
# @api public
|
|
1262
|
-
#: (
|
|
1263
|
-
|
|
1264
|
-
return @print_area if range.nil?
|
|
1265
|
-
|
|
1266
|
-
@print_area = range&.to_s
|
|
1267
|
-
nil
|
|
1268
|
-
end
|
|
1105
|
+
#: () -> String?
|
|
1106
|
+
attr_reader :print_area
|
|
1269
1107
|
|
|
1270
1108
|
# Sets the print area for the worksheet.
|
|
1271
1109
|
#
|
|
@@ -1279,31 +1117,27 @@ module Xlsxrb
|
|
|
1279
1117
|
|
|
1280
1118
|
# Sets or gets repeating print titles (rows and/or columns) for pagination.
|
|
1281
1119
|
#
|
|
1120
|
+
# When called with no arguments, returns the {Elements::PrintTitles} value object or nil.
|
|
1121
|
+
# When called with arguments, updates print titles and returns nil.
|
|
1122
|
+
#
|
|
1282
1123
|
# @example Set repeating header rows
|
|
1283
1124
|
# sheet.print_titles(rows: "1:2")
|
|
1284
1125
|
#
|
|
1285
1126
|
# @example Get repeating print titles
|
|
1286
|
-
# sheet.print_titles #=>
|
|
1127
|
+
# sheet.print_titles #=> #<Xlsxrb::Elements::PrintTitles ...>
|
|
1287
1128
|
#
|
|
1288
|
-
# @param rows [String, nil] Repeating row range (e.g. "1:2").
|
|
1289
1129
|
# @param rows [String, Integer, Range, nil] Repeating row range (e.g. "1:2" or 0-based 0..1).
|
|
1290
1130
|
# @param columns [String, Integer, Symbol, Range, nil] Repeating column range (e.g. "A:B" or 0..1).
|
|
1291
|
-
# @param cols [String, Integer, Symbol, Range, nil] Deprecated alias for columns.
|
|
1292
1131
|
# @return [Elements::PrintTitles, nil, void]
|
|
1293
1132
|
# @api public
|
|
1294
|
-
#: (
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
return Elements::PrintTitles.new(**@print_titles)
|
|
1300
|
-
end
|
|
1133
|
+
#: () -> Elements::PrintTitles?
|
|
1134
|
+
#: (?rows: (String | Integer | Range[Integer])?, ?columns: (String | Integer | Symbol | Range[untyped])?) -> void
|
|
1135
|
+
def print_titles(rows: nil, columns: nil)
|
|
1136
|
+
return @print_titles ? Elements::PrintTitles.new(**@print_titles) : nil if rows.nil? && columns.nil?
|
|
1301
1137
|
|
|
1302
|
-
warn "[DEPRECATION] `cols:` is deprecated; use `columns:` instead.", uplevel: 1 if cols && columns.nil?
|
|
1303
|
-
c = columns || cols
|
|
1304
1138
|
norm_rows = DslHelpers.normalize_print_titles_rows(rows)
|
|
1305
|
-
norm_cols = DslHelpers.normalize_print_titles_columns(
|
|
1306
|
-
@print_titles = Elements::PrintTitles.new(rows: norm_rows, columns: norm_cols
|
|
1139
|
+
norm_cols = DslHelpers.normalize_print_titles_columns(columns)
|
|
1140
|
+
@print_titles = Elements::PrintTitles.new(rows: norm_rows, columns: norm_cols)
|
|
1307
1141
|
nil
|
|
1308
1142
|
end
|
|
1309
1143
|
|
|
@@ -1380,21 +1214,19 @@ module Xlsxrb
|
|
|
1380
1214
|
print_titles(rows: existing_rows, columns: cols_str)
|
|
1381
1215
|
end
|
|
1382
1216
|
|
|
1383
|
-
#
|
|
1217
|
+
# Sets or queries sheet-level protection with optional password hashing (<sheetProtection>).
|
|
1384
1218
|
#
|
|
1385
|
-
# When called with no arguments, returns the
|
|
1219
|
+
# When called with no arguments, returns the {Elements::SheetProtection} value object or nil.
|
|
1386
1220
|
# When called with keyword arguments, sets sheet protection and returns nil.
|
|
1387
1221
|
#
|
|
1388
1222
|
# @param opts [Hash] Protection options (e.g. password: "secret", select_locked_cells: true).
|
|
1389
|
-
# @return [Elements::SheetProtection,
|
|
1223
|
+
# @return [Elements::SheetProtection, nil, void]
|
|
1390
1224
|
# @api public
|
|
1391
|
-
#: (
|
|
1225
|
+
#: () -> Elements::SheetProtection?
|
|
1226
|
+
#: (**untyped opts) -> void
|
|
1392
1227
|
def sheet_protection(**opts)
|
|
1393
1228
|
if opts.empty?
|
|
1394
|
-
|
|
1395
|
-
return Elements::SheetProtection.new(**@sheet_protection) if defined?(Elements::SheetProtection)
|
|
1396
|
-
|
|
1397
|
-
@sheet_protection
|
|
1229
|
+
@sheet_protection ? Elements::SheetProtection.new(**@sheet_protection) : nil
|
|
1398
1230
|
else
|
|
1399
1231
|
@sheet_protection = DslHelpers.normalize_protection_options(opts)
|
|
1400
1232
|
nil
|
|
@@ -1406,7 +1238,7 @@ module Xlsxrb
|
|
|
1406
1238
|
# @param opts [Elements::SheetProtection, Hash, Boolean, nil]
|
|
1407
1239
|
# @return [void]
|
|
1408
1240
|
# @api public
|
|
1409
|
-
#: (untyped opts) -> void
|
|
1241
|
+
#: (Elements::SheetProtection | Hash[Symbol, untyped] | bool | nil opts) -> void
|
|
1410
1242
|
def sheet_protection=(opts)
|
|
1411
1243
|
if opts.nil? || opts == false
|
|
1412
1244
|
@sheet_protection = nil
|
|
@@ -1419,60 +1251,50 @@ module Xlsxrb
|
|
|
1419
1251
|
nil
|
|
1420
1252
|
end
|
|
1421
1253
|
|
|
1422
|
-
# @deprecated Use {#sheet_protection} instead.
|
|
1423
|
-
#: (**untyped opts) -> void
|
|
1424
|
-
def protect_sheet(...)
|
|
1425
|
-
warn "[DEPRECATION] `protect_sheet` is deprecated; use `sheet_protection` instead.", uplevel: 1
|
|
1426
|
-
sheet_protection(...)
|
|
1427
|
-
end
|
|
1428
|
-
|
|
1429
1254
|
# Inserts an embedded image from raw binary data.
|
|
1430
1255
|
#
|
|
1431
1256
|
# @param file_data [String] Binary image data.
|
|
1432
1257
|
# @param ext [String] File extension ("png", "jpeg", etc.).
|
|
1433
1258
|
# @param from_column [Integer, nil] Top-left starting column (0-based).
|
|
1434
|
-
# @param from_col [Integer, nil] Deprecated alias for from_column.
|
|
1435
1259
|
# @param from_row [Integer] Top-left starting row (0-based).
|
|
1436
1260
|
# @param to_column [Integer, nil] Bottom-right ending column (0-based).
|
|
1437
|
-
# @param to_col [Integer, nil] Deprecated alias for to_column.
|
|
1438
1261
|
# @param to_row [Integer] Bottom-right ending row (0-based).
|
|
1439
1262
|
# @param opts [Hash] Additional image anchoring options.
|
|
1440
1263
|
# @return [void]
|
|
1441
1264
|
# @api public
|
|
1442
|
-
#: (String file_data, ?ext: ::String, ?from_column: ::Integer?, ?
|
|
1443
|
-
def image(file_data, ext: "png", from_column: nil,
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
tc = to_column || to_col || 5
|
|
1448
|
-
img = { file_data: file_data, ext: ext, from_column: fc, from_col: fc, from_row: from_row, to_column: tc, to_col: tc, to_row: to_row }
|
|
1265
|
+
#: (String file_data, ?ext: ::String, ?from_column: ::Integer?, ?from_row: ::Integer, ?to_column: ::Integer?, ?to_row: ::Integer, **untyped opts) -> void
|
|
1266
|
+
def image(file_data, ext: "png", from_column: nil, from_row: 0, to_column: nil, to_row: 10, **opts)
|
|
1267
|
+
fc = from_column || 0
|
|
1268
|
+
tc = to_column || 5
|
|
1269
|
+
img = { file_data: file_data, ext: ext, from_column: fc, from_row: from_row, to_column: tc, to_row: to_row }
|
|
1449
1270
|
img.merge!(opts)
|
|
1450
1271
|
@images << img
|
|
1451
1272
|
end
|
|
1452
1273
|
|
|
1453
|
-
#
|
|
1454
|
-
#
|
|
1455
|
-
# @example Set background image from binary data
|
|
1456
|
-
# sheet.background_image(png_bytes, ext: "png")
|
|
1457
|
-
#
|
|
1458
|
-
# @example Set background image from file path
|
|
1459
|
-
# sheet.background_image("path/to/background.png")
|
|
1274
|
+
# Gets the worksheet background image (<picture>).
|
|
1460
1275
|
#
|
|
1461
|
-
# @
|
|
1462
|
-
# @param file_data [String, Hash, Elements::Image, nil] Image binary data, file path, or image options hash.
|
|
1463
|
-
# @param ext [String, nil] Image extension ("png", "jpeg", "jpg", "gif", etc.).
|
|
1464
|
-
# @param opts [Hash] Additional image options.
|
|
1465
|
-
# @return [Hash, nil]
|
|
1276
|
+
# @return [Elements::BackgroundImage, nil]
|
|
1466
1277
|
# @api public
|
|
1467
|
-
#: (
|
|
1468
|
-
def background_image
|
|
1469
|
-
|
|
1470
|
-
|
|
1278
|
+
#: () -> Elements::BackgroundImage?
|
|
1279
|
+
def background_image
|
|
1280
|
+
return nil unless @background_image
|
|
1281
|
+
|
|
1282
|
+
@background_image.is_a?(Elements::BackgroundImage) ? @background_image : Elements::BackgroundImage.new(**@background_image)
|
|
1283
|
+
end
|
|
1471
1284
|
|
|
1472
|
-
|
|
1285
|
+
# Sets the worksheet background image (<picture>).
|
|
1286
|
+
#
|
|
1287
|
+
# @param val [String, Hash, Elements::Image, nil] Image binary data, file path, or image options hash.
|
|
1288
|
+
# @return [untyped]
|
|
1289
|
+
# @api public
|
|
1290
|
+
#: (untyped val) -> untyped
|
|
1291
|
+
def background_image=(val)
|
|
1292
|
+
if val.nil?
|
|
1293
|
+
@background_image = nil
|
|
1294
|
+
return
|
|
1473
1295
|
end
|
|
1474
1296
|
|
|
1475
|
-
data =
|
|
1297
|
+
data = val
|
|
1476
1298
|
inferred_ext = nil
|
|
1477
1299
|
if data.is_a?(String) && !data.include?("\x00") && File.file?(data)
|
|
1478
1300
|
inferred_ext = File.extname(data).delete_prefix(".").downcase
|
|
@@ -1485,7 +1307,7 @@ module Xlsxrb
|
|
|
1485
1307
|
data = data.data
|
|
1486
1308
|
end
|
|
1487
1309
|
|
|
1488
|
-
final_ext = (
|
|
1310
|
+
final_ext = (inferred_ext || (val.is_a?(Hash) ? val[:ext] : nil) || "png").to_s.delete_prefix(".").downcase
|
|
1489
1311
|
mime = case final_ext
|
|
1490
1312
|
when "png" then "image/png"
|
|
1491
1313
|
when "jpg", "jpeg" then "image/jpeg"
|
|
@@ -1496,75 +1318,46 @@ module Xlsxrb
|
|
|
1496
1318
|
else "application/octet-stream"
|
|
1497
1319
|
end
|
|
1498
1320
|
|
|
1321
|
+
opts = val.is_a?(Hash) ? val : {}
|
|
1499
1322
|
@background_image = {
|
|
1500
1323
|
data: data&.b,
|
|
1501
1324
|
file_data: data&.b,
|
|
1325
|
+
extension: final_ext,
|
|
1502
1326
|
ext: final_ext,
|
|
1327
|
+
path: "background.#{final_ext}",
|
|
1503
1328
|
filename: "background.#{final_ext}",
|
|
1504
1329
|
content_type: mime
|
|
1505
1330
|
}.merge(opts).freeze
|
|
1506
|
-
end
|
|
1507
|
-
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
1508
|
-
alias background_picture background_image
|
|
1509
|
-
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
1510
|
-
alias picture background_image
|
|
1511
|
-
|
|
1512
|
-
#: (untyped val) -> untyped
|
|
1513
|
-
def background_image=(val)
|
|
1514
|
-
if val.nil?
|
|
1515
|
-
@background_image = nil
|
|
1516
|
-
else
|
|
1517
|
-
background_image(val)
|
|
1518
|
-
end
|
|
1519
1331
|
val
|
|
1520
1332
|
end
|
|
1521
|
-
# @deprecated Use {#background_image=} instead. Will be removed in 0.2.0.
|
|
1522
|
-
alias background_picture= background_image=
|
|
1523
|
-
# @deprecated Use {#background_image=} instead. Will be removed in 0.2.0.
|
|
1524
|
-
alias picture= background_image=
|
|
1525
1333
|
|
|
1526
1334
|
# Inserts a drawing shape (e.g. rectangle, callout, arrow).
|
|
1527
1335
|
#
|
|
1528
1336
|
# @param preset [String] Shape preset name (e.g. "rect", "roundRect").
|
|
1529
1337
|
# @param text [String, nil] Shape label text.
|
|
1530
1338
|
# @param from_column [Integer, nil] Top-left column.
|
|
1531
|
-
# @param from_col [Integer, nil] Deprecated alias for from_column.
|
|
1532
1339
|
# @param from_row [Integer] Top-left row.
|
|
1533
1340
|
# @param to_column [Integer, nil] Bottom-right column.
|
|
1534
|
-
# @param to_col [Integer, nil] Deprecated alias for to_column.
|
|
1535
1341
|
# @param to_row [Integer] Bottom-right row.
|
|
1536
1342
|
# @param opts [Hash] Additional shape formatting options.
|
|
1537
1343
|
# @return [void]
|
|
1538
1344
|
# @api public
|
|
1539
|
-
#: (**untyped opts) -> void
|
|
1540
|
-
def shape(preset: "rect", text: nil, from_column: nil,
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
tc = to_column || to_col || 5
|
|
1545
|
-
shape_data = { preset: preset, text: text, from_column: fc, from_col: fc, from_row: from_row, to_column: tc, to_col: tc, to_row: to_row }
|
|
1345
|
+
#: (?preset: String, ?text: String?, ?from_column: Integer?, ?from_row: Integer, ?to_column: Integer?, ?to_row: Integer, **untyped opts) -> void
|
|
1346
|
+
def shape(preset: "rect", text: nil, from_column: nil, from_row: 0, to_column: nil, to_row: 5, **opts)
|
|
1347
|
+
fc = from_column || 0
|
|
1348
|
+
tc = to_column || 5
|
|
1349
|
+
shape_data = { preset: preset, text: text, from_column: fc, from_row: from_row, to_column: tc, to_row: to_row }
|
|
1546
1350
|
shape_data[:name] = opts.delete(:name) || "Shape #{@shapes.size + 1}"
|
|
1547
1351
|
shape_data.merge!(opts)
|
|
1548
1352
|
@shapes << shape_data
|
|
1549
1353
|
end
|
|
1550
1354
|
|
|
1551
|
-
# Gets
|
|
1355
|
+
# Gets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
1552
1356
|
#
|
|
1553
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#state=} instead.
|
|
1554
|
-
# @param new_state [Symbol, nil] The new state.
|
|
1555
1357
|
# @return [Symbol]
|
|
1556
1358
|
# @api public
|
|
1557
|
-
#:
|
|
1558
|
-
|
|
1559
|
-
if new_state
|
|
1560
|
-
val = new_state.to_sym
|
|
1561
|
-
raise ArgumentError, "Invalid sheet state ':#{val}'. Allowed states are :visible, :hidden, :very_hidden" unless VALID_SHEET_STATES.include?(val)
|
|
1562
|
-
|
|
1563
|
-
@state = val
|
|
1564
|
-
else
|
|
1565
|
-
@state
|
|
1566
|
-
end
|
|
1567
|
-
end
|
|
1359
|
+
#: Symbol
|
|
1360
|
+
attr_reader :state
|
|
1568
1361
|
|
|
1569
1362
|
# Sets the sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
1570
1363
|
#
|
|
@@ -1579,30 +1372,13 @@ module Xlsxrb
|
|
|
1579
1372
|
@state = val
|
|
1580
1373
|
end
|
|
1581
1374
|
|
|
1582
|
-
# Gets
|
|
1375
|
+
# Gets the worksheet tab color.
|
|
1583
1376
|
#
|
|
1584
|
-
# @
|
|
1585
|
-
# @overload tab_color()
|
|
1586
|
-
# Returns the current tab color specification.
|
|
1587
|
-
# @return [String, Hash, nil]
|
|
1588
|
-
# @overload tab_color(spec, **opts)
|
|
1589
|
-
# Sets the tab color using an RGB hex string or color options.
|
|
1590
|
-
# @param spec [String, Hash, Symbol, nil] RGB hex string (e.g. "FF0000"), theme/indexed hash, or nil.
|
|
1591
|
-
# @param opts [Hash] Color keyword arguments (e.g. theme: 1, tint: 0.5, indexed: 9, auto: true).
|
|
1592
|
-
# @return [String, Hash, nil]
|
|
1377
|
+
# @return [String, Hash, nil]
|
|
1593
1378
|
# @api public
|
|
1594
|
-
#: (
|
|
1595
|
-
def tab_color
|
|
1596
|
-
|
|
1597
|
-
@sheet_properties[:tab_color]
|
|
1598
|
-
else
|
|
1599
|
-
color = if opts.empty?
|
|
1600
|
-
spec
|
|
1601
|
-
else
|
|
1602
|
-
spec.is_a?(Hash) ? spec.merge(opts) : opts
|
|
1603
|
-
end
|
|
1604
|
-
@sheet_properties[:tab_color] = color
|
|
1605
|
-
end
|
|
1379
|
+
#: () -> (String | Hash[Symbol, untyped] | nil)
|
|
1380
|
+
def tab_color
|
|
1381
|
+
@sheet_properties[:tab_color]
|
|
1606
1382
|
end
|
|
1607
1383
|
|
|
1608
1384
|
# Sets the tab color of this worksheet.
|
|
@@ -1617,48 +1393,32 @@ module Xlsxrb
|
|
|
1617
1393
|
|
|
1618
1394
|
# Sets a single sheet property.
|
|
1619
1395
|
#
|
|
1620
|
-
# @param name [Symbol, String] Property name.
|
|
1621
|
-
# @param value [Object] Property value.
|
|
1622
|
-
# @return [void]
|
|
1623
|
-
# @api public
|
|
1624
|
-
#: (Symbol | String name, untyped value) -> void
|
|
1625
|
-
def sheet_property(name, value)
|
|
1626
|
-
sheet_properties(name, value)
|
|
1627
|
-
end
|
|
1628
|
-
|
|
1629
1396
|
# Configures or queries sheet properties (<sheetPr>).
|
|
1630
1397
|
#
|
|
1631
1398
|
# When called with no arguments, returns the {Elements::SheetProperties} value object.
|
|
1632
|
-
# When called with
|
|
1399
|
+
# When called with keyword options, configures properties and returns nil.
|
|
1633
1400
|
#
|
|
1634
|
-
# @param name [Symbol, String, Hash, Elements::MetadataRecord, nil] Property name or hash/record of properties.
|
|
1635
|
-
# @param value [Object, nil] Property value when name is provided.
|
|
1636
1401
|
# @param opts [Hash] Additional sheet properties.
|
|
1637
1402
|
# @return [Elements::SheetProperties, void]
|
|
1638
1403
|
# @api public
|
|
1639
|
-
#: (
|
|
1640
|
-
|
|
1641
|
-
|
|
1404
|
+
#: () -> Elements::SheetProperties
|
|
1405
|
+
#: (**untyped opts) -> void
|
|
1406
|
+
def sheet_properties(**opts)
|
|
1407
|
+
return Elements::SheetProperties.new(**@sheet_properties) if opts.empty?
|
|
1642
1408
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
name = nil
|
|
1646
|
-
end
|
|
1647
|
-
if name && !value.nil?
|
|
1648
|
-
sym = name.to_sym
|
|
1409
|
+
opts.each do |k, v|
|
|
1410
|
+
sym = k.to_sym
|
|
1649
1411
|
if sym == :state
|
|
1650
|
-
val =
|
|
1412
|
+
val = v.to_sym
|
|
1651
1413
|
raise ArgumentError, "Invalid sheet state ':#{val}'. Allowed states are :visible, :hidden, :very_hidden" unless VALID_SHEET_STATES.include?(val)
|
|
1652
1414
|
|
|
1653
1415
|
@state = val
|
|
1654
|
-
return nil
|
|
1655
1416
|
elsif sym == :hidden
|
|
1656
|
-
@state =
|
|
1657
|
-
|
|
1417
|
+
@state = v ? :hidden : :visible
|
|
1418
|
+
else
|
|
1419
|
+
@sheet_properties[sym] = v
|
|
1658
1420
|
end
|
|
1659
|
-
@sheet_properties[name.to_sym] = value
|
|
1660
1421
|
end
|
|
1661
|
-
opts.each { |k, v| sheet_properties(k, v) }
|
|
1662
1422
|
nil
|
|
1663
1423
|
end
|
|
1664
1424
|
|
|
@@ -1671,29 +1431,23 @@ module Xlsxrb
|
|
|
1671
1431
|
def sheet_properties=(opts)
|
|
1672
1432
|
h = opts.respond_to?(:to_h) ? opts.to_h : (opts || {})
|
|
1673
1433
|
@sheet_properties = {}
|
|
1674
|
-
|
|
1434
|
+
sheet_properties(**h)
|
|
1675
1435
|
nil
|
|
1676
1436
|
end
|
|
1677
1437
|
|
|
1678
1438
|
# Configures or queries sheet view display properties (<sheetView>).
|
|
1679
1439
|
#
|
|
1680
1440
|
# When called with no arguments, returns the {Elements::SheetView} value object.
|
|
1681
|
-
# When called with
|
|
1441
|
+
# When called with keyword options, configures view properties and returns nil.
|
|
1682
1442
|
#
|
|
1683
|
-
# @param name [Symbol, String, Hash, Elements::MetadataRecord, nil] View property name or hash/record of properties.
|
|
1684
|
-
# @param value [Object, nil] View property value when name is provided.
|
|
1685
1443
|
# @param opts [Hash] Additional view properties.
|
|
1686
1444
|
# @return [Elements::SheetView, void]
|
|
1687
1445
|
# @api public
|
|
1688
|
-
#: (
|
|
1689
|
-
|
|
1690
|
-
|
|
1446
|
+
#: () -> Elements::SheetView
|
|
1447
|
+
#: (**untyped opts) -> void
|
|
1448
|
+
def sheet_view(**opts)
|
|
1449
|
+
return Elements::SheetView.new(**@sheet_view) if opts.empty?
|
|
1691
1450
|
|
|
1692
|
-
if name.is_a?(Hash) || (name.respond_to?(:to_h) && !name.is_a?(Symbol) && !name.is_a?(String))
|
|
1693
|
-
opts = name.to_h.merge(opts)
|
|
1694
|
-
name = nil
|
|
1695
|
-
end
|
|
1696
|
-
@sheet_view[name.to_sym] = value if name && !value.nil?
|
|
1697
1451
|
opts.each { |k, v| @sheet_view[k.to_sym] = v }
|
|
1698
1452
|
nil
|
|
1699
1453
|
end
|
|
@@ -1713,41 +1467,20 @@ module Xlsxrb
|
|
|
1713
1467
|
# Configures or queries sheet format properties (<sheetFormatPr>).
|
|
1714
1468
|
#
|
|
1715
1469
|
# When called with no arguments, returns the {Elements::SheetFormat} value object.
|
|
1716
|
-
# When called with
|
|
1470
|
+
# When called with keyword options, configures format properties and returns nil.
|
|
1717
1471
|
#
|
|
1718
1472
|
# @example Using keyword arguments
|
|
1719
1473
|
# sheet.sheet_format(default_row_height: 24, default_column_width: 15)
|
|
1720
1474
|
#
|
|
1721
|
-
# @example Using property name and value
|
|
1722
|
-
# sheet.sheet_format(:default_row_height, 24)
|
|
1723
|
-
#
|
|
1724
|
-
# @param name [Symbol, String, Hash, Elements::MetadataRecord, nil] Property name or hash/record of properties.
|
|
1725
|
-
# @param value [Object, nil] Property value when name is provided.
|
|
1726
1475
|
# @param opts [Hash] Keyword arguments for sheet format properties.
|
|
1727
1476
|
# @return [Elements::SheetFormat, void]
|
|
1728
1477
|
# @api public
|
|
1729
|
-
#: (
|
|
1730
|
-
|
|
1731
|
-
|
|
1478
|
+
#: () -> Elements::SheetFormat
|
|
1479
|
+
#: (**untyped opts) -> void
|
|
1480
|
+
def sheet_format(**opts)
|
|
1481
|
+
return Elements::SheetFormat.new(**@sheet_format) if opts.empty?
|
|
1732
1482
|
|
|
1733
|
-
|
|
1734
|
-
@sheet_format.merge!(name.to_h)
|
|
1735
|
-
elsif name && value
|
|
1736
|
-
@sheet_format[name.to_sym] = value
|
|
1737
|
-
end
|
|
1738
|
-
if opts.key?(:default_col_width) && !opts.key?(:default_column_width)
|
|
1739
|
-
warn "[DEPRECATION] `default_col_width:` is deprecated; use `default_column_width:` instead.", uplevel: 1
|
|
1740
|
-
opts[:default_column_width] = opts[:default_col_width]
|
|
1741
|
-
end
|
|
1742
|
-
if opts.key?(:base_col_width) && !opts.key?(:base_column_width)
|
|
1743
|
-
warn "[DEPRECATION] `base_col_width:` is deprecated; use `base_column_width:` instead.", uplevel: 1
|
|
1744
|
-
opts[:base_column_width] = opts[:base_col_width]
|
|
1745
|
-
end
|
|
1746
|
-
if opts.key?(:outline_level_col) && !opts.key?(:outline_level_column)
|
|
1747
|
-
warn "[DEPRECATION] `outline_level_col:` is deprecated; use `outline_level_column:` instead.", uplevel: 1
|
|
1748
|
-
opts[:outline_level_column] = opts[:outline_level_col]
|
|
1749
|
-
end
|
|
1750
|
-
@sheet_format.merge!(opts) unless opts.empty?
|
|
1483
|
+
opts.each { |k, v| @sheet_format[k.to_sym] = v }
|
|
1751
1484
|
nil
|
|
1752
1485
|
end
|
|
1753
1486
|
|
|
@@ -1759,8 +1492,7 @@ module Xlsxrb
|
|
|
1759
1492
|
#: (Hash[Symbol, untyped] | Elements::SheetFormat opts) -> void
|
|
1760
1493
|
def sheet_format=(opts)
|
|
1761
1494
|
h = opts.respond_to?(:to_h) ? opts.to_h : (opts || {})
|
|
1762
|
-
@sheet_format =
|
|
1763
|
-
sheet_format(h)
|
|
1495
|
+
@sheet_format = h.transform_keys(&:to_sym)
|
|
1764
1496
|
nil
|
|
1765
1497
|
end
|
|
1766
1498
|
|
|
@@ -1774,13 +1506,6 @@ module Xlsxrb
|
|
|
1774
1506
|
@row_breaks << { id: row_index, max: 16_383, man: 1 }
|
|
1775
1507
|
end
|
|
1776
1508
|
|
|
1777
|
-
# @deprecated Use {#row_break} instead.
|
|
1778
|
-
#: (Integer row_num) -> void
|
|
1779
|
-
def page_break_row(row_num)
|
|
1780
|
-
warn "[DEPRECATION] `page_break_row` is deprecated; use `row_break` instead.", uplevel: 1
|
|
1781
|
-
row_break(row_num)
|
|
1782
|
-
end
|
|
1783
|
-
|
|
1784
1509
|
# Inserts a vertical page break after the specified column.
|
|
1785
1510
|
#
|
|
1786
1511
|
# @param col [Integer, String, Symbol] Column index (0-based) or letter ("B", :B).
|
|
@@ -1792,13 +1517,6 @@ module Xlsxrb
|
|
|
1792
1517
|
@col_breaks << { id: col_index, max: 1_048_575, man: 1 }
|
|
1793
1518
|
end
|
|
1794
1519
|
|
|
1795
|
-
# @deprecated Use {#column_break} instead.
|
|
1796
|
-
#: (Integer | String | Symbol col_index) -> void
|
|
1797
|
-
def page_break_col(col_index)
|
|
1798
|
-
warn "[DEPRECATION] `page_break_col` is deprecated; use `column_break` instead.", uplevel: 1
|
|
1799
|
-
column_break(col_index)
|
|
1800
|
-
end
|
|
1801
|
-
|
|
1802
1520
|
# Adds a protected range to the worksheet.
|
|
1803
1521
|
#
|
|
1804
1522
|
# @param name [String] Name of the protected range.
|
|
@@ -1814,8 +1532,6 @@ module Xlsxrb
|
|
|
1814
1532
|
entry.merge!(opts) unless opts.empty?
|
|
1815
1533
|
@protected_ranges << DslHelpers.normalize_protection_options(entry)
|
|
1816
1534
|
end
|
|
1817
|
-
# @deprecated Use {#protected_range} instead. Will be removed in 0.2.0.
|
|
1818
|
-
alias add_protected_range protected_range
|
|
1819
1535
|
|
|
1820
1536
|
# Adds a cell watch to the worksheet.
|
|
1821
1537
|
#
|
|
@@ -1826,8 +1542,6 @@ module Xlsxrb
|
|
|
1826
1542
|
def cell_watch(ref)
|
|
1827
1543
|
@cell_watches << ref.to_s
|
|
1828
1544
|
end
|
|
1829
|
-
# @deprecated Use {#cell_watch} instead. Will be removed in 0.2.0.
|
|
1830
|
-
alias add_cell_watch cell_watch
|
|
1831
1545
|
|
|
1832
1546
|
# Adds an ignored error entry for the worksheet.
|
|
1833
1547
|
#
|
|
@@ -1840,65 +1554,25 @@ module Xlsxrb
|
|
|
1840
1554
|
@ignored_errors << { sqref: sqref.to_s }.merge(opts)
|
|
1841
1555
|
end
|
|
1842
1556
|
|
|
1843
|
-
# @deprecated Use {#ignored_error} instead. Will be removed in 0.2.0.
|
|
1844
|
-
#: (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
|
|
1845
|
-
def ignore_error(sqref, **opts)
|
|
1846
|
-
warn "[DEPRECATION] #ignore_error is deprecated; use #ignored_error instead.", uplevel: 1
|
|
1847
|
-
ignored_error(sqref, **opts)
|
|
1848
|
-
end
|
|
1849
|
-
|
|
1850
|
-
# @deprecated Use {#ignored_error} instead. Will be removed in 0.2.0.
|
|
1851
|
-
#: (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
|
|
1852
|
-
def add_ignored_error(sqref, **opts)
|
|
1853
|
-
warn "[DEPRECATION] #add_ignored_error is deprecated; use #ignored_error instead.", uplevel: 1
|
|
1854
|
-
ignored_error(sqref, **opts)
|
|
1855
|
-
end
|
|
1856
|
-
|
|
1857
1557
|
# Returns ignored error rules configured for this worksheet.
|
|
1858
1558
|
#
|
|
1859
|
-
# @return [Array<
|
|
1559
|
+
# @return [Array<Elements::IgnoredError>]
|
|
1860
1560
|
# @api public
|
|
1861
|
-
#: () -> Array[
|
|
1561
|
+
#: () -> Array[Elements::IgnoredError]
|
|
1862
1562
|
def ignored_errors
|
|
1863
1563
|
@ignored_errors.map { |ie| ie.is_a?(Elements::IgnoredError) ? ie : Elements::IgnoredError.new(**ie) }.freeze
|
|
1864
1564
|
end
|
|
1865
1565
|
|
|
1866
|
-
# Gets
|
|
1566
|
+
# Gets phonetic (furigana) guide properties for the sheet.
|
|
1867
1567
|
#
|
|
1868
|
-
# @
|
|
1869
|
-
# @overload phonetic_properties()
|
|
1870
|
-
# Returns the current phonetic properties.
|
|
1871
|
-
# @return [Hash, nil]
|
|
1872
|
-
# @overload phonetic_properties(props = nil, font_id: nil, type: nil, alignment: nil)
|
|
1873
|
-
# Sets phonetic properties.
|
|
1874
|
-
# @param spec [Hash, Integer, nil]
|
|
1875
|
-
# @param font_id [Integer, nil]
|
|
1876
|
-
# @param type [Symbol, String, nil]
|
|
1877
|
-
# @param alignment [Symbol, String, nil]
|
|
1878
|
-
# @return [Hash, nil]
|
|
1568
|
+
# @return [Elements::PhoneticProperties, nil]
|
|
1879
1569
|
# @api public
|
|
1880
|
-
#: (
|
|
1881
|
-
def phonetic_properties
|
|
1882
|
-
|
|
1883
|
-
return nil unless @phonetic_properties
|
|
1570
|
+
#: () -> Elements::PhoneticProperties?
|
|
1571
|
+
def phonetic_properties
|
|
1572
|
+
return nil unless @phonetic_properties
|
|
1884
1573
|
|
|
1885
|
-
|
|
1886
|
-
elsif !spec.equal?(OMITTED) && spec.nil? && font_id.nil? && type.nil? && alignment.nil? && opts.empty?
|
|
1887
|
-
@phonetic_properties = nil
|
|
1888
|
-
else
|
|
1889
|
-
props = if spec.is_a?(Hash)
|
|
1890
|
-
spec.merge(opts)
|
|
1891
|
-
elsif spec.is_a?(Integer)
|
|
1892
|
-
{ font_id: spec, type: type, alignment: alignment }.merge(opts)
|
|
1893
|
-
else
|
|
1894
|
-
{ font_id: font_id, type: type, alignment: alignment }.merge(opts)
|
|
1895
|
-
end
|
|
1896
|
-
props.compact!
|
|
1897
|
-
@phonetic_properties = WorksheetBuilder.normalize_phonetic_properties(props)
|
|
1898
|
-
end
|
|
1574
|
+
@phonetic_properties.is_a?(Elements::PhoneticProperties) ? @phonetic_properties : Elements::PhoneticProperties.new(**@phonetic_properties)
|
|
1899
1575
|
end
|
|
1900
|
-
# @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
|
|
1901
|
-
alias phonetic_pr phonetic_properties
|
|
1902
1576
|
|
|
1903
1577
|
# Sets phonetic (furigana) guide properties for the sheet.
|
|
1904
1578
|
#
|
|
@@ -1921,8 +1595,6 @@ module Xlsxrb
|
|
|
1921
1595
|
end
|
|
1922
1596
|
spec
|
|
1923
1597
|
end
|
|
1924
|
-
# @deprecated Use {#phonetic_properties=} instead. Will be removed in 0.2.0.
|
|
1925
|
-
alias phonetic_pr= phonetic_properties=
|
|
1926
1598
|
|
|
1927
1599
|
# Normalizes phonetic properties to OOXML schema values.
|
|
1928
1600
|
#
|
|
@@ -1958,17 +1630,13 @@ module Xlsxrb
|
|
|
1958
1630
|
res
|
|
1959
1631
|
end
|
|
1960
1632
|
|
|
1961
|
-
#
|
|
1633
|
+
# Gets the internal code name of the worksheet.
|
|
1962
1634
|
#
|
|
1963
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#code_name=} instead.
|
|
1964
|
-
# @param val [String, Symbol, nil] The code name.
|
|
1965
1635
|
# @return [String, nil]
|
|
1966
1636
|
# @api public
|
|
1967
|
-
#: (
|
|
1968
|
-
def code_name
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
@sheet_properties[:code_name] = val&.to_s
|
|
1637
|
+
#: () -> String?
|
|
1638
|
+
def code_name
|
|
1639
|
+
@sheet_properties[:code_name]
|
|
1972
1640
|
end
|
|
1973
1641
|
|
|
1974
1642
|
# Sets the internal code name of the worksheet.
|
|
@@ -1981,36 +1649,16 @@ module Xlsxrb
|
|
|
1981
1649
|
@sheet_properties[:code_name] = val&.to_s
|
|
1982
1650
|
end
|
|
1983
1651
|
|
|
1984
|
-
#
|
|
1985
|
-
#
|
|
1986
|
-
# @example Instruct Excel to recalculate formulas when loading sheet
|
|
1987
|
-
# sheet.sheet_calc_properties = { full_calc_on_load: true }
|
|
1652
|
+
# Gets worksheet calculation properties (<sheetCalcPr>).
|
|
1988
1653
|
#
|
|
1989
|
-
# @
|
|
1990
|
-
# @param spec [Hash, nil] Calculation properties hash.
|
|
1991
|
-
# @param full_calc_on_load [Boolean, nil] Whether to recalculate when loading.
|
|
1992
|
-
# @return [Hash, nil]
|
|
1654
|
+
# @return [Elements::SheetCalcProperties, nil]
|
|
1993
1655
|
# @api public
|
|
1994
|
-
#: (
|
|
1995
|
-
def sheet_calc_properties
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
return nil unless calc
|
|
1999
|
-
|
|
2000
|
-
return calc.is_a?(Elements::SheetCalcProperties) ? calc : Elements::SheetCalcProperties.new(**calc)
|
|
2001
|
-
end
|
|
2002
|
-
|
|
2003
|
-
warn "[DEPRECATION] Calling #sheet_calc_properties with arguments is deprecated and will be removed in 0.2.0. Use #sheet_calc_properties= instead.", uplevel: 1
|
|
2004
|
-
if !spec.equal?(OMITTED) && spec.nil? && full_calc_on_load.nil? && opts.empty?
|
|
2005
|
-
@sheet_properties.delete(:full_calc_on_load)
|
|
2006
|
-
return @sheet_calc_pr = nil
|
|
2007
|
-
end
|
|
1656
|
+
#: () -> Elements::SheetCalcProperties?
|
|
1657
|
+
def sheet_calc_properties
|
|
1658
|
+
calc = @sheet_calc_pr || (@sheet_properties[:full_calc_on_load] ? { full_calc_on_load: true } : nil)
|
|
1659
|
+
return nil unless calc
|
|
2008
1660
|
|
|
2009
|
-
|
|
2010
|
-
pr[:full_calc_on_load] = full_calc_on_load unless full_calc_on_load.nil?
|
|
2011
|
-
pr.merge!(opts) unless opts.empty?
|
|
2012
|
-
@sheet_properties[:full_calc_on_load] = pr[:full_calc_on_load] unless pr[:full_calc_on_load].nil?
|
|
2013
|
-
@sheet_calc_pr = pr
|
|
1661
|
+
calc.is_a?(Elements::SheetCalcProperties) ? calc : Elements::SheetCalcProperties.new(**calc)
|
|
2014
1662
|
end
|
|
2015
1663
|
|
|
2016
1664
|
# Sets worksheet calculation properties (<sheetCalcPr>).
|
|
@@ -2031,40 +1679,68 @@ module Xlsxrb
|
|
|
2031
1679
|
spec
|
|
2032
1680
|
end
|
|
2033
1681
|
|
|
2034
|
-
#
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1682
|
+
# Builds and returns the in-memory {Elements::Worksheet}. Cells carry their style
|
|
1683
|
+
# names; {WorkbookBuilder#build} resolves them to style indexes.
|
|
1684
|
+
#
|
|
1685
|
+
# @deprecated Read the sheet from the workbook that {Xlsxrb.build} returns. This
|
|
1686
|
+
# method will be private in version 0.3.0.
|
|
1687
|
+
# @return [Elements::Worksheet]
|
|
1688
|
+
# @api public
|
|
1689
|
+
#: () -> Elements::Worksheet
|
|
1690
|
+
def build
|
|
1691
|
+
Deprecation.warn("WorksheetBuilder#build is deprecated; read the sheet from the workbook that Xlsxrb.build returns. It will be private in version 0.3.0.")
|
|
1692
|
+
snapshot(@rows.dup.freeze).worksheet
|
|
1693
|
+
end
|
|
1694
|
+
|
|
1695
|
+
# Ends the sheet block: rows can no longer be added, and the sheet's state is taken
|
|
1696
|
+
# as it is now.
|
|
1697
|
+
#
|
|
1698
|
+
# @return [Snapshot]
|
|
1699
|
+
# @api private
|
|
1700
|
+
#: () -> Snapshot
|
|
1701
|
+
def close
|
|
1702
|
+
@closed = true
|
|
1703
|
+
snapshot(@rows.freeze)
|
|
2039
1704
|
end
|
|
2040
1705
|
|
|
2041
|
-
#
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
1706
|
+
# Internal: returns styles for later processing by WorkbookBuilder
|
|
1707
|
+
# @return [Hash{String => StyleBuilder}]
|
|
1708
|
+
#: Hash[String, StyleBuilder]
|
|
1709
|
+
attr_reader :styles
|
|
1710
|
+
|
|
1711
|
+
private
|
|
1712
|
+
|
|
1713
|
+
#: () -> void
|
|
1714
|
+
def check_open!
|
|
1715
|
+
raise Error, "Sheet '#{@name}' is closed: add its rows inside its sheet block" if @closed
|
|
2046
1716
|
end
|
|
2047
1717
|
|
|
2048
|
-
#
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
1718
|
+
# The style that a Date or Time cell without a cell style inherits, to give the cell
|
|
1719
|
+
# in its place: the row style, or the sheet's column style in a row without one. The
|
|
1720
|
+
# workbook then gives the cell a variant of that style with the default date or
|
|
1721
|
+
# date-time format, so it keeps the style's font, fill, and border, as StreamWriter
|
|
1722
|
+
# does. Returns nil for a style index or for no style.
|
|
1723
|
+
#: (untyped row_style, Integer column_index) -> (String | Symbol | Hash[Symbol, untyped])?
|
|
1724
|
+
def inherited_date_style(row_style, column_index)
|
|
1725
|
+
style = if !row_style.nil?
|
|
1726
|
+
row_style
|
|
1727
|
+
elsif @column_style_clocks.key?(column_index)
|
|
1728
|
+
@columns.find { |column| column.index == column_index }&.style_index
|
|
1729
|
+
end
|
|
1730
|
+
style if style.is_a?(String) || style.is_a?(Symbol) || style.is_a?(Hash)
|
|
2053
1731
|
end
|
|
2054
1732
|
|
|
2055
|
-
#
|
|
2056
|
-
#: (
|
|
2057
|
-
def
|
|
2058
|
-
|
|
2059
|
-
|
|
1733
|
+
# Returns the number format code of the sheet style named +style_name+, if it has one.
|
|
1734
|
+
#: (untyped style_name) -> String?
|
|
1735
|
+
def format_code_of(style_name)
|
|
1736
|
+
number_format = @styles[style_name]&.number_format
|
|
1737
|
+
return nil unless number_format
|
|
1738
|
+
|
|
1739
|
+
number_format.is_a?(String) ? number_format : Ooxml::Utils::BUILTIN_NUM_FMT_CODES[number_format]
|
|
2060
1740
|
end
|
|
2061
1741
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
# @return [Elements::Worksheet]
|
|
2065
|
-
# @api public
|
|
2066
|
-
#: () -> Elements::Worksheet
|
|
2067
|
-
def build
|
|
1742
|
+
#: (Array[PendingRow] rows) -> Snapshot
|
|
1743
|
+
def snapshot(rows)
|
|
2068
1744
|
facade_meta = {}
|
|
2069
1745
|
facade_meta[:hyperlinks] = @hyperlinks unless @hyperlinks.empty?
|
|
2070
1746
|
facade_meta[:auto_filter] = @auto_filter if @auto_filter
|
|
@@ -2092,7 +1768,7 @@ module Xlsxrb
|
|
|
2092
1768
|
facade_meta[:sheet_format] = @sheet_format unless @sheet_format.empty?
|
|
2093
1769
|
facade_meta[:sheet_view] = @sheet_view unless @sheet_view.empty?
|
|
2094
1770
|
facade_meta[:row_breaks] = @row_breaks unless @row_breaks.empty?
|
|
2095
|
-
facade_meta[:
|
|
1771
|
+
facade_meta[:column_breaks] = @col_breaks unless @col_breaks.empty?
|
|
2096
1772
|
facade_meta[:protected_ranges] = @protected_ranges unless @protected_ranges.empty?
|
|
2097
1773
|
facade_meta[:cell_watches] = @cell_watches unless @cell_watches.empty?
|
|
2098
1774
|
facade_meta[:ignored_errors] = @ignored_errors unless @ignored_errors.empty?
|
|
@@ -2105,11 +1781,8 @@ module Xlsxrb
|
|
|
2105
1781
|
hl_hash = {}
|
|
2106
1782
|
@hyperlinks.each do |h|
|
|
2107
1783
|
if h.is_a?(Elements::Hyperlink)
|
|
2108
|
-
ref_val = if h.respond_to?(:
|
|
2109
|
-
|
|
2110
|
-
elsif h.respond_to?(:ref)
|
|
2111
|
-
h.ref
|
|
2112
|
-
end
|
|
1784
|
+
ref_val = h.ref if h.respond_to?(:ref)
|
|
1785
|
+
ref_val ||= h.cell if h.respond_to?(:cell)
|
|
2113
1786
|
ref = ref_val.to_s.upcase
|
|
2114
1787
|
hl_hash[ref] = h unless ref.empty?
|
|
2115
1788
|
else
|
|
@@ -2126,41 +1799,19 @@ module Xlsxrb
|
|
|
2126
1799
|
cm_hash = {}
|
|
2127
1800
|
@comments.each do |c|
|
|
2128
1801
|
obj = c.is_a?(Elements::Comment) ? c : Elements::Comment.new(**c)
|
|
2129
|
-
ref = obj.ref.to_s.upcase
|
|
1802
|
+
ref = (obj.respond_to?(:ref) ? obj.ref : obj[:ref]).to_s.upcase
|
|
2130
1803
|
cm_hash[ref] = obj
|
|
2131
1804
|
end
|
|
2132
1805
|
|
|
2133
1806
|
tc_hash = {}
|
|
2134
1807
|
@threaded_comments.each do |c|
|
|
2135
1808
|
obj = c.is_a?(Elements::ThreadedComment) ? c : Elements::ThreadedComment.new(**c)
|
|
2136
|
-
ref = obj.ref.to_s.upcase
|
|
1809
|
+
ref = (obj.respond_to?(:ref) ? obj.ref : obj[:ref]).to_s.upcase
|
|
2137
1810
|
(tc_hash[ref] ||= []) << obj
|
|
2138
1811
|
end
|
|
2139
1812
|
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
else
|
|
2143
|
-
@rows.map do |row|
|
|
2144
|
-
new_cells = row.cells.map do |cell|
|
|
2145
|
-
hl = hl_hash[cell.ref]
|
|
2146
|
-
cm = cm_hash[cell.ref]
|
|
2147
|
-
tcs = tc_hash[cell.ref]
|
|
2148
|
-
if hl || cm || tcs
|
|
2149
|
-
cell.with(
|
|
2150
|
-
hyperlink: hl || cell.hyperlink,
|
|
2151
|
-
comment: cm || cell.comment,
|
|
2152
|
-
threaded_comments: (tcs ? (cell.threaded_comments + tcs) : cell.threaded_comments)
|
|
2153
|
-
)
|
|
2154
|
-
else
|
|
2155
|
-
cell
|
|
2156
|
-
end
|
|
2157
|
-
end
|
|
2158
|
-
row.with(cells: new_cells)
|
|
2159
|
-
end
|
|
2160
|
-
end
|
|
2161
|
-
|
|
2162
|
-
Elements::Worksheet.new(
|
|
2163
|
-
name: @name, rows: rows, columns: @columns, charts: @charts,
|
|
1813
|
+
frame = Elements::Worksheet.new(
|
|
1814
|
+
name: @name, rows: [], columns: @columns, charts: @charts,
|
|
2164
1815
|
conditional_formats: @conditional_formats,
|
|
2165
1816
|
data_validations: @data_validations,
|
|
2166
1817
|
unmapped_data: facade_meta.empty? ? {} : { facade: facade_meta },
|
|
@@ -2176,6 +1827,9 @@ module Xlsxrb
|
|
|
2176
1827
|
tables: @tables,
|
|
2177
1828
|
shapes: @shapes,
|
|
2178
1829
|
freeze_pane: @freeze_pane,
|
|
1830
|
+
split_pane: @split_pane,
|
|
1831
|
+
filter_columns: @filter_columns,
|
|
1832
|
+
sort_state: @sort_state,
|
|
2179
1833
|
page_setup: @page_setup,
|
|
2180
1834
|
page_margins: @page_margins,
|
|
2181
1835
|
header_footer: @header_footer,
|
|
@@ -2194,75 +1848,733 @@ module Xlsxrb
|
|
|
2194
1848
|
sheet_calc_properties: @sheet_calc_pr,
|
|
2195
1849
|
background_image: @background_image
|
|
2196
1850
|
)
|
|
1851
|
+
Snapshot.new(frame, rows, hl_hash, cm_hash, tc_hash, @column_style_clocks.dup)
|
|
2197
1852
|
end
|
|
1853
|
+
end
|
|
2198
1854
|
|
|
2199
|
-
|
|
2200
|
-
#
|
|
2201
|
-
|
|
2202
|
-
|
|
1855
|
+
class WorksheetBuilder
|
|
1856
|
+
# A row as given to {WorksheetBuilder#row}, kept until the workbook resolves its
|
|
1857
|
+
# style names, so that its cells are created once.
|
|
1858
|
+
#
|
|
1859
|
+
# @api private
|
|
1860
|
+
class PendingRow
|
|
1861
|
+
#: Integer
|
|
1862
|
+
attr_reader :index
|
|
1863
|
+
# Cell values; Hashes with :formula and rich text runs are already converted.
|
|
1864
|
+
#: Array[untyped]
|
|
1865
|
+
attr_reader :values
|
|
1866
|
+
# Style of each cell: a name, an index, or nil; or one of these for every cell.
|
|
1867
|
+
#: untyped
|
|
1868
|
+
attr_reader :styles
|
|
1869
|
+
# Number format codes of the cells' sheet styles: an Array, one code, or nil.
|
|
1870
|
+
#: untyped
|
|
1871
|
+
attr_reader :format_codes
|
|
1872
|
+
# Number of columns the row spans, including styled cells past the last value.
|
|
1873
|
+
#: Integer
|
|
1874
|
+
attr_reader :width
|
|
1875
|
+
#: (Float | Integer)?
|
|
1876
|
+
attr_reader :height
|
|
1877
|
+
#: untyped
|
|
1878
|
+
attr_reader :hidden
|
|
1879
|
+
#: bool
|
|
1880
|
+
attr_reader :custom_height
|
|
1881
|
+
#: untyped
|
|
1882
|
+
attr_reader :collapsed
|
|
1883
|
+
#: Integer?
|
|
1884
|
+
attr_reader :outline_level
|
|
1885
|
+
# The row style as given: a name, an index, an inline Hash, or nil.
|
|
1886
|
+
#: untyped
|
|
1887
|
+
attr_reader :style
|
|
1888
|
+
# The style log clock when the row was added: its styles are the definitions made before.
|
|
1889
|
+
#: Integer
|
|
1890
|
+
attr_reader :clock
|
|
1891
|
+
|
|
1892
|
+
#: (Integer index, Array[untyped] values, untyped styles, untyped format_codes, Integer width, (Float | Integer)? height, untyped hidden, bool custom_height, untyped collapsed, Integer? outline_level, untyped style, Integer clock) -> void
|
|
1893
|
+
def initialize(index, values, styles, format_codes, width, height, hidden, custom_height, collapsed, outline_level, style, clock)
|
|
1894
|
+
@index = index
|
|
1895
|
+
@values = values
|
|
1896
|
+
@styles = styles
|
|
1897
|
+
@format_codes = format_codes
|
|
1898
|
+
@width = width
|
|
1899
|
+
@height = height
|
|
1900
|
+
@hidden = hidden
|
|
1901
|
+
@custom_height = custom_height
|
|
1902
|
+
@collapsed = collapsed
|
|
1903
|
+
@outline_level = outline_level
|
|
1904
|
+
@style = style
|
|
1905
|
+
@clock = clock
|
|
1906
|
+
end
|
|
1907
|
+
|
|
1908
|
+
#: (hidden: untyped, collapsed: untyped, outline_level: Integer?) -> PendingRow
|
|
1909
|
+
def with_outline(hidden:, collapsed:, outline_level:)
|
|
1910
|
+
PendingRow.new(@index, @values, @styles, @format_codes, @width, @height, hidden, @custom_height, collapsed, outline_level, @style, @clock)
|
|
1911
|
+
end
|
|
1912
|
+
|
|
1913
|
+
# Returns whether every cell of the row is within Excel's row and column limits.
|
|
1914
|
+
#: () -> bool
|
|
1915
|
+
def within_limits?
|
|
1916
|
+
Elements::Cell.valid_coordinates?(@index, 0) && @width <= 16_384
|
|
1917
|
+
end
|
|
1918
|
+
|
|
1919
|
+
# Returns the row's cells with their style names, as {WorksheetBuilder#build} gives them.
|
|
1920
|
+
#: () -> Array[Elements::Cell]
|
|
1921
|
+
def named_cells
|
|
1922
|
+
values = @values
|
|
1923
|
+
styles = @styles
|
|
1924
|
+
codes = @format_codes
|
|
1925
|
+
style_lookup = styles.is_a?(Array)
|
|
1926
|
+
code_lookup = codes.is_a?(Array)
|
|
1927
|
+
all_valid = within_limits?
|
|
1928
|
+
cells = [] #: Array[Elements::Cell]
|
|
1929
|
+
col_index = 0
|
|
1930
|
+
while col_index < @width
|
|
1931
|
+
value = col_index < values.size ? values[col_index] : nil
|
|
1932
|
+
style = style_lookup ? styles[col_index] : styles
|
|
1933
|
+
unless value.nil? && style.nil?
|
|
1934
|
+
code = code_lookup ? codes[col_index] : codes
|
|
1935
|
+
cells << PendingRow.cell(@index, col_index, value, style, code, all_valid || Elements::Cell.valid_coordinates?(@index, col_index))
|
|
1936
|
+
end
|
|
1937
|
+
col_index += 1
|
|
1938
|
+
end
|
|
1939
|
+
cells
|
|
1940
|
+
end
|
|
1941
|
+
|
|
1942
|
+
#: (Array[Elements::Cell] cells, untyped style_index) -> Elements::Row
|
|
1943
|
+
def to_row(cells, style_index)
|
|
1944
|
+
Elements::Row.new(
|
|
1945
|
+
index: @index,
|
|
1946
|
+
cells: cells,
|
|
1947
|
+
height: @height,
|
|
1948
|
+
hidden: @hidden,
|
|
1949
|
+
custom_height: @custom_height,
|
|
1950
|
+
collapsed: @collapsed,
|
|
1951
|
+
outline_level: @outline_level,
|
|
1952
|
+
style_index: style_index,
|
|
1953
|
+
unmapped_data: Elements::EMPTY_HASH
|
|
1954
|
+
)
|
|
1955
|
+
end
|
|
1956
|
+
|
|
1957
|
+
# Creates a cell for +value+ with +style+ (a name, an index, or nil).
|
|
1958
|
+
# +valid_coordinates+ tells whether the cell is within Excel's limits; a valid cell
|
|
1959
|
+
# has no errors, so it skips the checks of Cell.new.
|
|
1960
|
+
#: (Integer row_index, Integer column_index, untyped value, untyped style, String? format_code, bool valid_coordinates) -> Elements::Cell
|
|
1961
|
+
def self.cell(row_index, column_index, value, style, format_code, valid_coordinates)
|
|
1962
|
+
formula = nil
|
|
1963
|
+
if value.is_a?(Elements::Formula)
|
|
1964
|
+
formula = value
|
|
1965
|
+
value = formula.cached_value
|
|
1966
|
+
valid_coordinates &&= Elements::Cell.valid_value?(value)
|
|
1967
|
+
end
|
|
1968
|
+
raw_value = value&.to_s
|
|
1969
|
+
if valid_coordinates && !style.is_a?(Integer)
|
|
1970
|
+
Elements::Cell.fast_create(row_index, column_index, value, style, formula, raw_value, format_code)
|
|
1971
|
+
else
|
|
1972
|
+
Elements::Cell.new(row_index: row_index, column_index: column_index, value: value, formula: formula,
|
|
1973
|
+
style: style, raw_value: raw_value, format_code: format_code)
|
|
1974
|
+
end
|
|
1975
|
+
end
|
|
1976
|
+
end
|
|
1977
|
+
|
|
1978
|
+
# The state of a sheet when its block ended: the worksheet without its rows, the
|
|
1979
|
+
# pending rows, and the hyperlinks and comments to attach to their cells.
|
|
1980
|
+
#
|
|
1981
|
+
# @api private
|
|
1982
|
+
class Snapshot
|
|
1983
|
+
# The worksheet with every part except its rows.
|
|
1984
|
+
#: Elements::Worksheet
|
|
1985
|
+
attr_reader :frame
|
|
1986
|
+
#: Array[PendingRow]
|
|
1987
|
+
attr_reader :rows
|
|
1988
|
+
# The style log clock when each column's style was set.
|
|
1989
|
+
#: Hash[Integer, Integer]
|
|
1990
|
+
attr_reader :column_style_clocks
|
|
1991
|
+
|
|
1992
|
+
#: (Elements::Worksheet frame, Array[PendingRow] rows, Hash[String, untyped] hyperlinks, Hash[String, untyped] comments, Hash[String, Array[untyped]] threaded_comments, Hash[Integer, Integer] column_style_clocks) -> void
|
|
1993
|
+
def initialize(frame, rows, hyperlinks, comments, threaded_comments, column_style_clocks)
|
|
1994
|
+
@frame = frame
|
|
1995
|
+
@rows = rows
|
|
1996
|
+
@column_style_clocks = column_style_clocks
|
|
1997
|
+
@hyperlinks = hyperlinks
|
|
1998
|
+
@comments = comments
|
|
1999
|
+
@threaded_comments = threaded_comments
|
|
2000
|
+
@links = !(hyperlinks.empty? && comments.empty? && threaded_comments.empty?)
|
|
2001
|
+
end
|
|
2002
|
+
|
|
2003
|
+
# Returns the worksheet with +rows+, or with the rows' named cells by default.
|
|
2004
|
+
#: (?Array[Elements::Row]? rows, ?Array[Elements::Column]? columns) -> Elements::Worksheet
|
|
2005
|
+
def worksheet(rows = nil, columns = nil)
|
|
2006
|
+
rows ||= @rows.map { |row| row.to_row(attach_links(row.named_cells), row.style) }
|
|
2007
|
+
@frame.with(rows: rows, columns: columns || @frame.columns, errors: nil)
|
|
2008
|
+
end
|
|
2009
|
+
|
|
2010
|
+
# Attaches the sheet's hyperlinks and comments to the cells they refer to.
|
|
2011
|
+
#: (Array[Elements::Cell] cells) -> Array[Elements::Cell]
|
|
2012
|
+
def attach_links(cells)
|
|
2013
|
+
return cells unless @links
|
|
2014
|
+
|
|
2015
|
+
cells.map do |cell|
|
|
2016
|
+
hl = @hyperlinks[cell.ref]
|
|
2017
|
+
cm = @comments[cell.ref]
|
|
2018
|
+
tcs = @threaded_comments[cell.ref]
|
|
2019
|
+
if hl || cm || tcs
|
|
2020
|
+
cell.with(
|
|
2021
|
+
hyperlink: hl || cell.hyperlink,
|
|
2022
|
+
comment: cm || cell.comment,
|
|
2023
|
+
threaded_comments: (tcs ? (cell.threaded_comments + tcs) : cell.threaded_comments)
|
|
2024
|
+
)
|
|
2025
|
+
else
|
|
2026
|
+
cell
|
|
2027
|
+
end
|
|
2028
|
+
end
|
|
2029
|
+
end
|
|
2030
|
+
end
|
|
2203
2031
|
end
|
|
2204
2032
|
|
|
2205
|
-
#
|
|
2033
|
+
# Stands in for the {Elements::Worksheet} of a sheet defined in {Xlsxrb.build}, as
|
|
2034
|
+
# returned by {WorkbookBuilder#sheet}. It answers the same methods with the same
|
|
2035
|
+
# results. The worksheet is built the first time one of them is called, or when the
|
|
2036
|
+
# object is frozen (as Ractor.make_shareable does), so a sheet whose return value is
|
|
2037
|
+
# never used costs nothing.
|
|
2206
2038
|
#
|
|
2039
|
+
# @deprecated Read the sheet from the workbook that {Xlsxrb.build} returns. In version
|
|
2040
|
+
# 0.3.0, {WorkbookBuilder#sheet} will return the sheet's {WorksheetBuilder}, and
|
|
2041
|
+
# {WorkbookBuilder#[]} will return the {WorksheetBuilder} of an existing sheet.
|
|
2207
2042
|
# @api public
|
|
2208
|
-
class
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
# @param columns [Array, nil] Column header names or definition hashes.
|
|
2213
|
-
# @param name [String, nil] Table name identifier.
|
|
2214
|
-
# @param display_name [String, nil] Table display name.
|
|
2215
|
-
# @param style [String, nil] Built-in table style name (e.g. "TableStyleMedium2").
|
|
2216
|
-
# @param opts [Hash] Additional table properties.
|
|
2217
|
-
#: (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
2218
|
-
def initialize(ref = nil, columns: nil, name: nil, display_name: nil, style: nil, **opts)
|
|
2219
|
-
@options = opts.dup
|
|
2220
|
-
@options[:ref] = ref if ref
|
|
2221
|
-
@options[:columns] = columns.is_a?(Array) ? columns.dup : [columns] if columns
|
|
2222
|
-
@options[:name] = name if name
|
|
2223
|
-
@options[:display_name] = display_name if display_name
|
|
2224
|
-
@options[:style] = style if style
|
|
2225
|
-
end
|
|
2043
|
+
class DeferredWorksheet
|
|
2044
|
+
DEPRECATION_MESSAGE = "Using the sheet that WorkbookBuilder#sheet and #[] return is deprecated; " \
|
|
2045
|
+
"read it from the workbook that Xlsxrb.build returns. In version 0.3.0, sheet will return " \
|
|
2046
|
+
"the sheet's WorksheetBuilder, and #[] will return the WorksheetBuilder of an existing sheet."
|
|
2226
2047
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
@options[key.to_sym]
|
|
2048
|
+
#: (WorksheetBuilder::Snapshot snapshot) -> void
|
|
2049
|
+
def initialize(snapshot)
|
|
2050
|
+
@snapshot = snapshot
|
|
2051
|
+
@built_worksheet = nil
|
|
2232
2052
|
end
|
|
2233
2053
|
|
|
2234
|
-
#
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2054
|
+
# Returns the worksheet, building it on first use.
|
|
2055
|
+
#
|
|
2056
|
+
# @return [Elements::Worksheet]
|
|
2057
|
+
# @api public
|
|
2058
|
+
#: () -> Elements::Worksheet
|
|
2059
|
+
def worksheet = built_worksheet
|
|
2240
2060
|
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
if val
|
|
2245
|
-
@options[:ref] = val.to_s
|
|
2246
|
-
else
|
|
2247
|
-
@options[:ref]
|
|
2248
|
-
end
|
|
2061
|
+
#: (untyped other) -> bool
|
|
2062
|
+
def ==(other)
|
|
2063
|
+
built_worksheet == (other.is_a?(DeferredWorksheet) ? other.built_worksheet : other)
|
|
2249
2064
|
end
|
|
2250
2065
|
|
|
2251
|
-
#: (
|
|
2252
|
-
def
|
|
2253
|
-
|
|
2066
|
+
#: (untyped other) -> bool
|
|
2067
|
+
def eql?(other)
|
|
2068
|
+
built_worksheet.eql?(other.is_a?(DeferredWorksheet) ? other.built_worksheet : other)
|
|
2254
2069
|
end
|
|
2255
2070
|
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2071
|
+
#: () -> Integer
|
|
2072
|
+
def hash = built_worksheet.hash
|
|
2073
|
+
|
|
2074
|
+
#: () -> String
|
|
2075
|
+
def inspect = built_worksheet.inspect
|
|
2076
|
+
|
|
2077
|
+
#: () -> String
|
|
2078
|
+
def to_s = built_worksheet.to_s
|
|
2079
|
+
|
|
2080
|
+
#: (untyped printer) -> untyped
|
|
2081
|
+
def pretty_print(printer) = printer.pp(built_worksheet)
|
|
2082
|
+
|
|
2083
|
+
# Builds the worksheet before freezing, so that a frozen stand-in still answers.
|
|
2084
|
+
#: () -> self
|
|
2085
|
+
def freeze
|
|
2086
|
+
built_worksheet
|
|
2087
|
+
@snapshot = nil
|
|
2088
|
+
super
|
|
2089
|
+
end
|
|
2090
|
+
|
|
2091
|
+
# Elements::Worksheet methods, written out as the method_missing policy in
|
|
2092
|
+
# ARCHITECTURE.md requires. A test checks that they cover every public method.
|
|
2093
|
+
|
|
2094
|
+
#: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
|
|
2095
|
+
def [](ref_or_row, col = nil) = built_worksheet[ref_or_row, col]
|
|
2096
|
+
|
|
2097
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2098
|
+
def all?(...) = built_worksheet.all?(...)
|
|
2099
|
+
|
|
2100
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2101
|
+
def any?(...) = built_worksheet.any?(...)
|
|
2102
|
+
|
|
2103
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2104
|
+
def auto_filter(...) = built_worksheet.auto_filter(...)
|
|
2105
|
+
|
|
2106
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2107
|
+
def background_image(...) = built_worksheet.background_image(...)
|
|
2108
|
+
|
|
2109
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2110
|
+
def cell_watches(...) = built_worksheet.cell_watches(...)
|
|
2111
|
+
|
|
2112
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2113
|
+
def cells(...) = built_worksheet.cells(...)
|
|
2114
|
+
|
|
2115
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2116
|
+
def chain(...) = built_worksheet.chain(...)
|
|
2117
|
+
|
|
2118
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2119
|
+
def charts(...) = built_worksheet.charts(...)
|
|
2120
|
+
|
|
2121
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2122
|
+
def chunk(...) = built_worksheet.chunk(...)
|
|
2123
|
+
|
|
2124
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2125
|
+
def chunk_while(...) = built_worksheet.chunk_while(...)
|
|
2126
|
+
|
|
2127
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2128
|
+
def code_name(...) = built_worksheet.code_name(...)
|
|
2129
|
+
|
|
2130
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2131
|
+
def collect(...) = built_worksheet.collect(...)
|
|
2132
|
+
|
|
2133
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2134
|
+
def collect_concat(...) = built_worksheet.collect_concat(...)
|
|
2135
|
+
|
|
2136
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2137
|
+
def column_breaks(...) = built_worksheet.column_breaks(...)
|
|
2138
|
+
|
|
2139
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2140
|
+
def column_range(...) = built_worksheet.column_range(...)
|
|
2141
|
+
|
|
2142
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2143
|
+
def columns(...) = built_worksheet.columns(...)
|
|
2144
|
+
|
|
2145
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2146
|
+
def comment(...) = built_worksheet.comment(...)
|
|
2147
|
+
|
|
2148
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2149
|
+
def comments(...) = built_worksheet.comments(...)
|
|
2150
|
+
|
|
2151
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2152
|
+
def comments_by_ref(...) = built_worksheet.comments_by_ref(...)
|
|
2153
|
+
|
|
2154
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2155
|
+
def compact(...) = built_worksheet.compact(...)
|
|
2156
|
+
|
|
2157
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2158
|
+
def conditional_formats(...) = built_worksheet.conditional_formats(...)
|
|
2159
|
+
|
|
2160
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2161
|
+
def count(...) = built_worksheet.count(...)
|
|
2162
|
+
|
|
2163
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2164
|
+
def cycle(...) = built_worksheet.cycle(...)
|
|
2165
|
+
|
|
2166
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2167
|
+
def data_validations(...) = built_worksheet.data_validations(...)
|
|
2168
|
+
|
|
2169
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2170
|
+
def date1904?(...) = built_worksheet.date1904?(...)
|
|
2171
|
+
|
|
2172
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2173
|
+
def deconstruct(...) = built_worksheet.deconstruct(...)
|
|
2174
|
+
|
|
2175
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2176
|
+
def deconstruct_keys(...) = built_worksheet.deconstruct_keys(...)
|
|
2177
|
+
|
|
2178
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2179
|
+
def detect(...) = built_worksheet.detect(...)
|
|
2180
|
+
|
|
2181
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2182
|
+
def dimension(...) = built_worksheet.dimension(...)
|
|
2183
|
+
|
|
2184
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2185
|
+
def dimension_bounds(...) = built_worksheet.dimension_bounds(...)
|
|
2186
|
+
|
|
2187
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2188
|
+
def drop(...) = built_worksheet.drop(...)
|
|
2189
|
+
|
|
2190
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2191
|
+
def drop_while(...) = built_worksheet.drop_while(...)
|
|
2192
|
+
|
|
2193
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2194
|
+
def each(...) = built_worksheet.each(...)
|
|
2195
|
+
|
|
2196
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2197
|
+
def each_cell(...) = built_worksheet.each_cell(...)
|
|
2198
|
+
|
|
2199
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2200
|
+
def each_cons(...) = built_worksheet.each_cons(...)
|
|
2201
|
+
|
|
2202
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2203
|
+
def each_entry(...) = built_worksheet.each_entry(...)
|
|
2204
|
+
|
|
2205
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2206
|
+
def each_row(...) = built_worksheet.each_row(...)
|
|
2207
|
+
|
|
2208
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2209
|
+
def each_row_values(...) = built_worksheet.each_row_values(...)
|
|
2210
|
+
|
|
2211
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2212
|
+
def each_slice(...) = built_worksheet.each_slice(...)
|
|
2213
|
+
|
|
2214
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2215
|
+
def each_with_index(...) = built_worksheet.each_with_index(...)
|
|
2216
|
+
|
|
2217
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2218
|
+
def each_with_object(...) = built_worksheet.each_with_object(...)
|
|
2219
|
+
|
|
2220
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2221
|
+
def entries(...) = built_worksheet.entries(...)
|
|
2222
|
+
|
|
2223
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2224
|
+
def errors(...) = built_worksheet.errors(...)
|
|
2225
|
+
|
|
2226
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2227
|
+
def filter(...) = built_worksheet.filter(...)
|
|
2228
|
+
|
|
2229
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2230
|
+
def filter_columns(...) = built_worksheet.filter_columns(...)
|
|
2231
|
+
|
|
2232
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2233
|
+
def filter_map(...) = built_worksheet.filter_map(...)
|
|
2234
|
+
|
|
2235
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2236
|
+
def find(...) = built_worksheet.find(...)
|
|
2237
|
+
|
|
2238
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2239
|
+
def find_all(...) = built_worksheet.find_all(...)
|
|
2240
|
+
|
|
2241
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2242
|
+
def find_index(...) = built_worksheet.find_index(...)
|
|
2243
|
+
|
|
2244
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2245
|
+
def first(...) = built_worksheet.first(...)
|
|
2246
|
+
|
|
2247
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2248
|
+
def first_row(...) = built_worksheet.first_row(...)
|
|
2249
|
+
|
|
2250
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2251
|
+
def fit_to_page?(...) = built_worksheet.fit_to_page?(...)
|
|
2252
|
+
|
|
2253
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2254
|
+
def flat_map(...) = built_worksheet.flat_map(...)
|
|
2255
|
+
|
|
2256
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2257
|
+
def formatted_value(...) = built_worksheet.formatted_value(...)
|
|
2258
|
+
|
|
2259
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2260
|
+
def freeze_pane(...) = built_worksheet.freeze_pane(...)
|
|
2261
|
+
|
|
2262
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2263
|
+
def full_calc_on_load?(...) = built_worksheet.full_calc_on_load?(...)
|
|
2264
|
+
|
|
2265
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2266
|
+
def grep(...) = built_worksheet.grep(...)
|
|
2267
|
+
|
|
2268
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2269
|
+
def grep_v(...) = built_worksheet.grep_v(...)
|
|
2270
|
+
|
|
2271
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2272
|
+
def group_by(...) = built_worksheet.group_by(...)
|
|
2273
|
+
|
|
2274
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2275
|
+
def header_footer(...) = built_worksheet.header_footer(...)
|
|
2276
|
+
|
|
2277
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2278
|
+
def header_footer_images(...) = built_worksheet.header_footer_images(...)
|
|
2279
|
+
|
|
2280
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2281
|
+
def hidden?(...) = built_worksheet.hidden?(...)
|
|
2282
|
+
|
|
2283
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2284
|
+
def hyperlink(...) = built_worksheet.hyperlink(...)
|
|
2285
|
+
|
|
2286
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2287
|
+
def hyperlinks(...) = built_worksheet.hyperlinks(...)
|
|
2288
|
+
|
|
2289
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2290
|
+
def ignored_errors(...) = built_worksheet.ignored_errors(...)
|
|
2291
|
+
|
|
2292
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2293
|
+
def images(...) = built_worksheet.images(...)
|
|
2294
|
+
|
|
2295
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2296
|
+
def images_at(...) = built_worksheet.images_at(...)
|
|
2297
|
+
|
|
2298
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2299
|
+
def include?(...) = built_worksheet.include?(...)
|
|
2300
|
+
|
|
2301
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2302
|
+
def inject(...) = built_worksheet.inject(...)
|
|
2303
|
+
|
|
2304
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2305
|
+
def last_row(...) = built_worksheet.last_row(...)
|
|
2306
|
+
|
|
2307
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2308
|
+
def lazy(...) = built_worksheet.lazy(...)
|
|
2309
|
+
|
|
2310
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2311
|
+
def map(...) = built_worksheet.map(...)
|
|
2312
|
+
|
|
2313
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2314
|
+
def max(...) = built_worksheet.max(...)
|
|
2315
|
+
|
|
2316
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2317
|
+
def max_by(...) = built_worksheet.max_by(...)
|
|
2318
|
+
|
|
2319
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2320
|
+
def member?(...) = built_worksheet.member?(...)
|
|
2321
|
+
|
|
2322
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2323
|
+
def merged_cells(...) = built_worksheet.merged_cells(...)
|
|
2324
|
+
|
|
2325
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2326
|
+
def min(...) = built_worksheet.min(...)
|
|
2327
|
+
|
|
2328
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2329
|
+
def min_by(...) = built_worksheet.min_by(...)
|
|
2330
|
+
|
|
2331
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2332
|
+
def minmax(...) = built_worksheet.minmax(...)
|
|
2333
|
+
|
|
2334
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2335
|
+
def minmax_by(...) = built_worksheet.minmax_by(...)
|
|
2336
|
+
|
|
2337
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2338
|
+
def name(...) = built_worksheet.name(...)
|
|
2339
|
+
|
|
2340
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2341
|
+
def none?(...) = built_worksheet.none?(...)
|
|
2342
|
+
|
|
2343
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2344
|
+
def one?(...) = built_worksheet.one?(...)
|
|
2345
|
+
|
|
2346
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2347
|
+
def outline_properties(...) = built_worksheet.outline_properties(...)
|
|
2348
|
+
|
|
2349
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2350
|
+
def pad_empty_cells?(...) = built_worksheet.pad_empty_cells?(...)
|
|
2351
|
+
|
|
2352
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2353
|
+
def pad_empty_rows?(...) = built_worksheet.pad_empty_rows?(...)
|
|
2354
|
+
|
|
2355
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2356
|
+
def page_margins(...) = built_worksheet.page_margins(...)
|
|
2357
|
+
|
|
2358
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2359
|
+
def page_setup(...) = built_worksheet.page_setup(...)
|
|
2360
|
+
|
|
2361
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2362
|
+
def partition(...) = built_worksheet.partition(...)
|
|
2363
|
+
|
|
2364
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2365
|
+
def phonetic_properties(...) = built_worksheet.phonetic_properties(...)
|
|
2366
|
+
|
|
2367
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2368
|
+
def pivot_tables(...) = built_worksheet.pivot_tables(...)
|
|
2369
|
+
|
|
2370
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2371
|
+
def print_area(...) = built_worksheet.print_area(...)
|
|
2372
|
+
|
|
2373
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2374
|
+
def print_options(...) = built_worksheet.print_options(...)
|
|
2375
|
+
|
|
2376
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2377
|
+
def print_titles(...) = built_worksheet.print_titles(...)
|
|
2378
|
+
|
|
2379
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2380
|
+
def protected_ranges(...) = built_worksheet.protected_ranges(...)
|
|
2381
|
+
|
|
2382
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2383
|
+
def reduce(...) = built_worksheet.reduce(...)
|
|
2384
|
+
|
|
2385
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2386
|
+
def reject(...) = built_worksheet.reject(...)
|
|
2387
|
+
|
|
2388
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2389
|
+
def reverse_each(...) = built_worksheet.reverse_each(...)
|
|
2390
|
+
|
|
2391
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2392
|
+
def row_at(...) = built_worksheet.row_at(...)
|
|
2393
|
+
|
|
2394
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2395
|
+
def row_breaks(...) = built_worksheet.row_breaks(...)
|
|
2396
|
+
|
|
2397
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2398
|
+
def row_range(...) = built_worksheet.row_range(...)
|
|
2399
|
+
|
|
2400
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2401
|
+
def rows(...) = built_worksheet.rows(...)
|
|
2402
|
+
|
|
2403
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2404
|
+
def select(...) = built_worksheet.select(...)
|
|
2405
|
+
|
|
2406
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2407
|
+
def selection(...) = built_worksheet.selection(...)
|
|
2408
|
+
|
|
2409
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2410
|
+
def shapes(...) = built_worksheet.shapes(...)
|
|
2411
|
+
|
|
2412
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2413
|
+
def sheet_calc_properties(...) = built_worksheet.sheet_calc_properties(...)
|
|
2414
|
+
|
|
2415
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2416
|
+
def sheet_format(...) = built_worksheet.sheet_format(...)
|
|
2417
|
+
|
|
2418
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2419
|
+
def sheet_properties(...) = built_worksheet.sheet_properties(...)
|
|
2420
|
+
|
|
2421
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2422
|
+
def sheet_protection(...) = built_worksheet.sheet_protection(...)
|
|
2423
|
+
|
|
2424
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2425
|
+
def sheet_view(...) = built_worksheet.sheet_view(...)
|
|
2426
|
+
|
|
2427
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2428
|
+
def slice_after(...) = built_worksheet.slice_after(...)
|
|
2429
|
+
|
|
2430
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2431
|
+
def slice_before(...) = built_worksheet.slice_before(...)
|
|
2432
|
+
|
|
2433
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2434
|
+
def slice_when(...) = built_worksheet.slice_when(...)
|
|
2435
|
+
|
|
2436
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2437
|
+
def sort(...) = built_worksheet.sort(...)
|
|
2438
|
+
|
|
2439
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2440
|
+
def sort_by(...) = built_worksheet.sort_by(...)
|
|
2441
|
+
|
|
2442
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2443
|
+
def sort_state(...) = built_worksheet.sort_state(...)
|
|
2444
|
+
|
|
2445
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2446
|
+
def sparkline_groups(...) = built_worksheet.sparkline_groups(...)
|
|
2447
|
+
|
|
2448
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2449
|
+
def split_pane(...) = built_worksheet.split_pane(...)
|
|
2450
|
+
|
|
2451
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2452
|
+
def state(...) = built_worksheet.state(...)
|
|
2453
|
+
|
|
2454
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2455
|
+
def styles(...) = built_worksheet.styles(...)
|
|
2456
|
+
|
|
2457
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2458
|
+
def sum(...) = built_worksheet.sum(...)
|
|
2459
|
+
|
|
2460
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2461
|
+
def tab_color(...) = built_worksheet.tab_color(...)
|
|
2462
|
+
|
|
2463
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2464
|
+
def tables(...) = built_worksheet.tables(...)
|
|
2465
|
+
|
|
2466
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2467
|
+
def take(...) = built_worksheet.take(...)
|
|
2468
|
+
|
|
2469
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2470
|
+
def take_while(...) = built_worksheet.take_while(...)
|
|
2471
|
+
|
|
2472
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2473
|
+
def tally(...) = built_worksheet.tally(...)
|
|
2474
|
+
|
|
2475
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2476
|
+
def threaded_comment(...) = built_worksheet.threaded_comment(...)
|
|
2477
|
+
|
|
2478
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2479
|
+
def threaded_comments(...) = built_worksheet.threaded_comments(...)
|
|
2480
|
+
|
|
2481
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2482
|
+
def threaded_comments_at(...) = built_worksheet.threaded_comments_at(...)
|
|
2483
|
+
|
|
2484
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2485
|
+
def threaded_comments_by_ref(...) = built_worksheet.threaded_comments_by_ref(...)
|
|
2486
|
+
|
|
2487
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2488
|
+
def to_a(...) = built_worksheet.to_a(...)
|
|
2489
|
+
|
|
2490
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2491
|
+
def to_h(...) = built_worksheet.to_h(...)
|
|
2492
|
+
|
|
2493
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2494
|
+
def to_set(...) = built_worksheet.to_set(...)
|
|
2495
|
+
|
|
2496
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2497
|
+
def trim_empty_rows?(...) = built_worksheet.trim_empty_rows?(...)
|
|
2498
|
+
|
|
2499
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2500
|
+
def uniq(...) = built_worksheet.uniq(...)
|
|
2501
|
+
|
|
2502
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2503
|
+
def unmapped_data(...) = built_worksheet.unmapped_data(...)
|
|
2504
|
+
|
|
2505
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2506
|
+
def valid?(...) = built_worksheet.valid?(...)
|
|
2507
|
+
|
|
2508
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2509
|
+
def very_hidden?(...) = built_worksheet.very_hidden?(...)
|
|
2510
|
+
|
|
2511
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2512
|
+
def visible?(...) = built_worksheet.visible?(...)
|
|
2513
|
+
|
|
2514
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2515
|
+
def with(...) = built_worksheet.with(...)
|
|
2516
|
+
|
|
2517
|
+
#: (*untyped, **untyped) ?{ (*untyped) -> untyped } -> untyped
|
|
2518
|
+
def zip(...) = built_worksheet.zip(...)
|
|
2519
|
+
|
|
2520
|
+
protected
|
|
2521
|
+
|
|
2522
|
+
# Returns the worksheet, building it on first use with a deprecation warning that
|
|
2523
|
+
# points at the caller of the public method.
|
|
2524
|
+
#: () -> Elements::Worksheet
|
|
2525
|
+
def built_worksheet
|
|
2526
|
+
@built_worksheet ||= begin
|
|
2527
|
+
Deprecation.warn(DEPRECATION_MESSAGE, uplevel: 2)
|
|
2528
|
+
@snapshot&.worksheet || raise(Error, "worksheet is not available")
|
|
2529
|
+
end
|
|
2530
|
+
end
|
|
2531
|
+
end
|
|
2532
|
+
|
|
2533
|
+
# Builder context for configuring an Excel Table (ListObject) in block form.
|
|
2534
|
+
#
|
|
2535
|
+
# @api public
|
|
2536
|
+
class TableBuilder
|
|
2537
|
+
# @param ref [String, nil] Table range (e.g. "A1:D10").
|
|
2538
|
+
# @param columns [Array, nil] Column header names or definition hashes.
|
|
2539
|
+
# @param name [String, nil] Table name identifier.
|
|
2540
|
+
# @param display_name [String, nil] Table display name.
|
|
2541
|
+
# @param style [String, nil] Built-in table style name (e.g. "TableStyleMedium2").
|
|
2542
|
+
# @param opts [Hash] Additional table properties.
|
|
2543
|
+
#: (?String? ref, ?columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
2544
|
+
def initialize(ref = nil, columns: nil, name: nil, display_name: nil, style: nil, **opts)
|
|
2545
|
+
@options = opts.dup
|
|
2546
|
+
@options[:ref] = ref if ref
|
|
2547
|
+
@options[:columns] = columns.is_a?(Array) ? columns.dup : [columns] if columns
|
|
2548
|
+
@options[:name] = name if name
|
|
2549
|
+
@options[:display_name] = display_name if display_name
|
|
2550
|
+
@options[:style] = style if style
|
|
2551
|
+
end
|
|
2552
|
+
|
|
2553
|
+
#: () -> String?
|
|
2554
|
+
def ref
|
|
2555
|
+
@options[:ref]
|
|
2556
|
+
end
|
|
2557
|
+
|
|
2558
|
+
#: (String val) -> String
|
|
2559
|
+
def ref=(val)
|
|
2560
|
+
@options[:ref] = val.to_s
|
|
2561
|
+
end
|
|
2562
|
+
|
|
2563
|
+
# Returns column definitions for the table.
|
|
2564
|
+
#
|
|
2565
|
+
# @return [Array<Elements::TableColumn>]
|
|
2566
|
+
# @api public
|
|
2567
|
+
#: () -> Array[Elements::TableColumn]
|
|
2568
|
+
def columns
|
|
2569
|
+
(@options[:columns] || []).each_with_index.map do |c, idx|
|
|
2570
|
+
if c.is_a?(Elements::TableColumn)
|
|
2571
|
+
c
|
|
2572
|
+
elsif c.is_a?(Hash)
|
|
2573
|
+
Elements::TableColumn.new(id: idx + 1, **c)
|
|
2574
|
+
else
|
|
2575
|
+
Elements::TableColumn.new(id: idx + 1, name: c.to_s)
|
|
2576
|
+
end
|
|
2577
|
+
end
|
|
2266
2578
|
end
|
|
2267
2579
|
|
|
2268
2580
|
#: (untyped cols) -> untyped
|
|
@@ -2287,8 +2599,6 @@ module Xlsxrb
|
|
|
2287
2599
|
(@options[:columns] ||= []) << col_spec
|
|
2288
2600
|
nil
|
|
2289
2601
|
end
|
|
2290
|
-
# @deprecated Use {#column} instead. Will be removed in 0.2.0.
|
|
2291
|
-
alias add_column column
|
|
2292
2602
|
|
|
2293
2603
|
# Appends a calculated column with formula and options.
|
|
2294
2604
|
#
|
|
@@ -2301,14 +2611,9 @@ module Xlsxrb
|
|
|
2301
2611
|
column(name, formula: formula, **opts)
|
|
2302
2612
|
end
|
|
2303
2613
|
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
if val
|
|
2308
|
-
@options[:name] = val.to_s
|
|
2309
|
-
else
|
|
2310
|
-
@options[:name]
|
|
2311
|
-
end
|
|
2614
|
+
#: () -> String?
|
|
2615
|
+
def name
|
|
2616
|
+
@options[:name]
|
|
2312
2617
|
end
|
|
2313
2618
|
|
|
2314
2619
|
#: (String val) -> String
|
|
@@ -2316,14 +2621,9 @@ module Xlsxrb
|
|
|
2316
2621
|
@options[:name] = val.to_s
|
|
2317
2622
|
end
|
|
2318
2623
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
if val
|
|
2323
|
-
@options[:display_name] = val.to_s
|
|
2324
|
-
else
|
|
2325
|
-
@options[:display_name]
|
|
2326
|
-
end
|
|
2624
|
+
#: () -> String?
|
|
2625
|
+
def display_name
|
|
2626
|
+
@options[:display_name]
|
|
2327
2627
|
end
|
|
2328
2628
|
|
|
2329
2629
|
#: (String val) -> String
|
|
@@ -2331,14 +2631,9 @@ module Xlsxrb
|
|
|
2331
2631
|
@options[:display_name] = val.to_s
|
|
2332
2632
|
end
|
|
2333
2633
|
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
if val
|
|
2338
|
-
@options[:style] = val.to_s
|
|
2339
|
-
else
|
|
2340
|
-
@options[:style]
|
|
2341
|
-
end
|
|
2634
|
+
#: () -> String?
|
|
2635
|
+
def style
|
|
2636
|
+
@options[:style]
|
|
2342
2637
|
end
|
|
2343
2638
|
|
|
2344
2639
|
#: (String val) -> String
|
|
@@ -2346,14 +2641,9 @@ module Xlsxrb
|
|
|
2346
2641
|
@options[:style] = val.to_s
|
|
2347
2642
|
end
|
|
2348
2643
|
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
if val.nil?
|
|
2353
|
-
@options[:show_row_stripes]
|
|
2354
|
-
else
|
|
2355
|
-
@options[:show_row_stripes] = val ? true : false
|
|
2356
|
-
end
|
|
2644
|
+
#: () -> bool
|
|
2645
|
+
def show_row_stripes?
|
|
2646
|
+
@options[:show_row_stripes] ? true : false
|
|
2357
2647
|
end
|
|
2358
2648
|
|
|
2359
2649
|
#: (bool val) -> bool
|
|
@@ -2361,14 +2651,9 @@ module Xlsxrb
|
|
|
2361
2651
|
@options[:show_row_stripes] = val ? true : false
|
|
2362
2652
|
end
|
|
2363
2653
|
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
if val.nil?
|
|
2368
|
-
@options[:show_column_stripes]
|
|
2369
|
-
else
|
|
2370
|
-
@options[:show_column_stripes] = val ? true : false
|
|
2371
|
-
end
|
|
2654
|
+
#: () -> bool
|
|
2655
|
+
def show_column_stripes?
|
|
2656
|
+
@options[:show_column_stripes] ? true : false
|
|
2372
2657
|
end
|
|
2373
2658
|
|
|
2374
2659
|
#: (bool val) -> bool
|
|
@@ -2376,14 +2661,9 @@ module Xlsxrb
|
|
|
2376
2661
|
@options[:show_column_stripes] = val ? true : false
|
|
2377
2662
|
end
|
|
2378
2663
|
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
if val.nil?
|
|
2383
|
-
@options[:show_first_column]
|
|
2384
|
-
else
|
|
2385
|
-
@options[:show_first_column] = val ? true : false
|
|
2386
|
-
end
|
|
2664
|
+
#: () -> bool
|
|
2665
|
+
def show_first_column?
|
|
2666
|
+
@options[:show_first_column] ? true : false
|
|
2387
2667
|
end
|
|
2388
2668
|
|
|
2389
2669
|
#: (bool val) -> bool
|
|
@@ -2391,14 +2671,9 @@ module Xlsxrb
|
|
|
2391
2671
|
@options[:show_first_column] = val ? true : false
|
|
2392
2672
|
end
|
|
2393
2673
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
if val.nil?
|
|
2398
|
-
@options[:show_last_column]
|
|
2399
|
-
else
|
|
2400
|
-
@options[:show_last_column] = val ? true : false
|
|
2401
|
-
end
|
|
2674
|
+
#: () -> bool
|
|
2675
|
+
def show_last_column?
|
|
2676
|
+
@options[:show_last_column] ? true : false
|
|
2402
2677
|
end
|
|
2403
2678
|
|
|
2404
2679
|
#: (bool val) -> bool
|
|
@@ -2406,14 +2681,9 @@ module Xlsxrb
|
|
|
2406
2681
|
@options[:show_last_column] = val ? true : false
|
|
2407
2682
|
end
|
|
2408
2683
|
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
if val.nil?
|
|
2413
|
-
@options[:totals_row_count] || @options[:total_row_count]
|
|
2414
|
-
else
|
|
2415
|
-
@options[:totals_row_count] = val.to_i
|
|
2416
|
-
end
|
|
2684
|
+
#: () -> Integer?
|
|
2685
|
+
def totals_row_count
|
|
2686
|
+
@options[:totals_row_count]
|
|
2417
2687
|
end
|
|
2418
2688
|
|
|
2419
2689
|
#: (Integer val) -> Integer
|
|
@@ -2421,31 +2691,16 @@ module Xlsxrb
|
|
|
2421
2691
|
@options[:totals_row_count] = val.to_i
|
|
2422
2692
|
end
|
|
2423
2693
|
|
|
2424
|
-
#
|
|
2425
|
-
#: (?Integer? val) -> Integer?
|
|
2426
|
-
def total_row_count(val = nil)
|
|
2427
|
-
warn "[DEPRECATION] #total_row_count is deprecated; use #totals_row_count instead.", uplevel: 1
|
|
2428
|
-
totals_row_count(val)
|
|
2429
|
-
end
|
|
2430
|
-
|
|
2431
|
-
# @deprecated Use {#totals_row_count=} instead. Will be removed in 0.2.0.
|
|
2432
|
-
#: (Integer val) -> Integer
|
|
2433
|
-
def total_row_count=(val)
|
|
2434
|
-
warn "[DEPRECATION] #total_row_count= is deprecated; use #totals_row_count= instead.", uplevel: 1
|
|
2435
|
-
self.totals_row_count = val
|
|
2436
|
-
end
|
|
2437
|
-
|
|
2438
|
-
# Gets or sets whether the table has a totals row.
|
|
2694
|
+
# Returns whether the table has a totals row.
|
|
2439
2695
|
#
|
|
2440
|
-
# @
|
|
2441
|
-
#: (
|
|
2442
|
-
def totals_row
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
rc
|
|
2696
|
+
# @return [Boolean]
|
|
2697
|
+
#: () -> bool
|
|
2698
|
+
def totals_row?
|
|
2699
|
+
rc = @options[:totals_row_count]
|
|
2700
|
+
if rc
|
|
2701
|
+
rc.positive?
|
|
2446
2702
|
else
|
|
2447
|
-
@options[:
|
|
2448
|
-
val ? true : false
|
|
2703
|
+
@options[:totals_row] ? true : false
|
|
2449
2704
|
end
|
|
2450
2705
|
end
|
|
2451
2706
|
|
|
@@ -2455,28 +2710,9 @@ module Xlsxrb
|
|
|
2455
2710
|
val
|
|
2456
2711
|
end
|
|
2457
2712
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
warn "[DEPRECATION] #total_row is deprecated; use #totals_row instead.", uplevel: 1
|
|
2462
|
-
totals_row(val)
|
|
2463
|
-
end
|
|
2464
|
-
|
|
2465
|
-
# @deprecated Use {#totals_row=} instead. Will be removed in 0.2.0.
|
|
2466
|
-
#: (bool val) -> bool
|
|
2467
|
-
def total_row=(val)
|
|
2468
|
-
warn "[DEPRECATION] #total_row= is deprecated; use #totals_row= instead.", uplevel: 1
|
|
2469
|
-
self.totals_row = val
|
|
2470
|
-
end
|
|
2471
|
-
|
|
2472
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#auto_filter=} instead.
|
|
2473
|
-
#: (?bool? val) -> bool?
|
|
2474
|
-
def auto_filter(val = nil)
|
|
2475
|
-
if val.nil?
|
|
2476
|
-
@options[:auto_filter]
|
|
2477
|
-
else
|
|
2478
|
-
@options[:auto_filter] = val ? true : false
|
|
2479
|
-
end
|
|
2713
|
+
#: () -> bool
|
|
2714
|
+
def auto_filter?
|
|
2715
|
+
@options[:auto_filter] != false
|
|
2480
2716
|
end
|
|
2481
2717
|
|
|
2482
2718
|
#: (bool val) -> bool
|
|
@@ -2502,92 +2738,39 @@ module Xlsxrb
|
|
|
2502
2738
|
@options[:sqref] = sqref if sqref
|
|
2503
2739
|
end
|
|
2504
2740
|
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
# @api public
|
|
2509
|
-
#: (untyped key) -> untyped
|
|
2510
|
-
def [](key)
|
|
2511
|
-
warn "[Xlsxrb DEPRECATION] DataValidationBuilder#[] is deprecated; use dedicated property accessors instead.", uplevel: 1
|
|
2512
|
-
@options[key.to_sym]
|
|
2513
|
-
end
|
|
2514
|
-
|
|
2515
|
-
# @deprecated Use dedicated property accessors instead. Will be removed in 0.2.0.
|
|
2516
|
-
# @param key [Symbol, String]
|
|
2517
|
-
# @param value [Object]
|
|
2518
|
-
# @return [Object]
|
|
2519
|
-
# @api public
|
|
2520
|
-
#: (untyped key, untyped value) -> untyped
|
|
2521
|
-
def []=(key, value)
|
|
2522
|
-
warn "[Xlsxrb DEPRECATION] DataValidationBuilder#[]= is deprecated; use dedicated property accessors instead.", uplevel: 1
|
|
2523
|
-
@options[key.to_sym] = value
|
|
2524
|
-
end
|
|
2525
|
-
|
|
2526
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#sqref=} instead.
|
|
2527
|
-
#: (?String? val) -> String?
|
|
2528
|
-
def sqref(val = nil)
|
|
2529
|
-
if val
|
|
2530
|
-
@options[:sqref] = val.to_s
|
|
2531
|
-
else
|
|
2532
|
-
@options[:sqref]
|
|
2533
|
-
end
|
|
2741
|
+
#: () -> String?
|
|
2742
|
+
def sqref
|
|
2743
|
+
@options[:sqref]
|
|
2534
2744
|
end
|
|
2535
2745
|
|
|
2536
2746
|
#: (String val) -> String
|
|
2537
2747
|
def sqref=(val)
|
|
2538
2748
|
@options[:sqref] = val.to_s
|
|
2539
2749
|
end
|
|
2540
|
-
# @deprecated Use {#sqref} instead. Will be removed in 0.2.0.
|
|
2541
|
-
alias range sqref
|
|
2542
|
-
# @deprecated Use {#sqref=} instead. Will be removed in 0.2.0.
|
|
2543
|
-
alias range= sqref=
|
|
2544
2750
|
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
if val
|
|
2549
|
-
@options[:columns] = val
|
|
2550
|
-
else
|
|
2551
|
-
@options[:columns]
|
|
2552
|
-
end
|
|
2751
|
+
#: () -> untyped
|
|
2752
|
+
def columns
|
|
2753
|
+
@options[:columns]
|
|
2553
2754
|
end
|
|
2554
2755
|
|
|
2555
2756
|
#: (untyped val) -> untyped
|
|
2556
2757
|
def columns=(val)
|
|
2557
2758
|
@options[:columns] = val
|
|
2558
2759
|
end
|
|
2559
|
-
# @deprecated Use {#columns} instead. Will be removed in 0.2.0.
|
|
2560
|
-
alias col columns
|
|
2561
|
-
# @deprecated Use {#columns=} instead. Will be removed in 0.2.0.
|
|
2562
|
-
alias col= columns=
|
|
2563
2760
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
if val
|
|
2568
|
-
@options[:rows] = val
|
|
2569
|
-
else
|
|
2570
|
-
@options[:rows]
|
|
2571
|
-
end
|
|
2761
|
+
#: () -> untyped
|
|
2762
|
+
def rows
|
|
2763
|
+
@options[:rows]
|
|
2572
2764
|
end
|
|
2573
2765
|
|
|
2574
2766
|
#: (untyped val) -> untyped
|
|
2575
2767
|
def rows=(val)
|
|
2576
2768
|
@options[:rows] = val
|
|
2577
2769
|
end
|
|
2578
|
-
# @deprecated Use {#rows} instead. Will be removed in 0.2.0.
|
|
2579
|
-
alias row rows
|
|
2580
|
-
# @deprecated Use {#rows=} instead. Will be removed in 0.2.0.
|
|
2581
|
-
alias row= rows=
|
|
2582
2770
|
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
if val
|
|
2587
|
-
@options[:except_rows] = val
|
|
2588
|
-
else
|
|
2589
|
-
@options[:except_rows]
|
|
2590
|
-
end
|
|
2771
|
+
#: () -> untyped
|
|
2772
|
+
def except_rows
|
|
2773
|
+
@options[:except_rows]
|
|
2591
2774
|
end
|
|
2592
2775
|
|
|
2593
2776
|
#: (untyped val) -> untyped
|
|
@@ -2600,47 +2783,21 @@ module Xlsxrb
|
|
|
2600
2783
|
# @example
|
|
2601
2784
|
# b.list = ["Option1", "Option2"]
|
|
2602
2785
|
#
|
|
2603
|
-
# @param val [Array<Object>, nil]
|
|
2604
2786
|
# @return [Array<Object>, nil]
|
|
2605
2787
|
# @api public
|
|
2606
|
-
#: (
|
|
2607
|
-
def list
|
|
2608
|
-
|
|
2609
|
-
@options[:list] = val
|
|
2610
|
-
@options[:in] = val
|
|
2611
|
-
else
|
|
2612
|
-
@options[:list] || @options[:in]
|
|
2613
|
-
end
|
|
2788
|
+
#: () -> untyped
|
|
2789
|
+
def list
|
|
2790
|
+
@options[:list]
|
|
2614
2791
|
end
|
|
2615
2792
|
|
|
2616
2793
|
#: (Array[untyped] val) -> untyped
|
|
2617
2794
|
def list=(val)
|
|
2618
2795
|
@options[:list] = val
|
|
2619
|
-
@options[:in] = val
|
|
2620
|
-
end
|
|
2621
|
-
|
|
2622
|
-
# @deprecated Use {#list} instead.
|
|
2623
|
-
#: (?Array[untyped]? val) -> untyped
|
|
2624
|
-
def in(val = nil)
|
|
2625
|
-
warn "[DEPRECATION] `DataValidationBuilder#in` is deprecated; use `list` instead.", uplevel: 1
|
|
2626
|
-
list(val)
|
|
2627
|
-
end
|
|
2628
|
-
|
|
2629
|
-
# @deprecated Use {#list=} instead.
|
|
2630
|
-
#: (Array[untyped] val) -> untyped
|
|
2631
|
-
def in=(val)
|
|
2632
|
-
warn "[DEPRECATION] `DataValidationBuilder#in=` is deprecated; use `list=` instead.", uplevel: 1
|
|
2633
|
-
self.list = val
|
|
2634
2796
|
end
|
|
2635
2797
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
if val
|
|
2640
|
-
@options[:type] = val
|
|
2641
|
-
else
|
|
2642
|
-
@options[:type]
|
|
2643
|
-
end
|
|
2798
|
+
#: () -> untyped
|
|
2799
|
+
def type
|
|
2800
|
+
@options[:type]
|
|
2644
2801
|
end
|
|
2645
2802
|
|
|
2646
2803
|
#: (untyped val) -> untyped
|
|
@@ -2648,14 +2805,9 @@ module Xlsxrb
|
|
|
2648
2805
|
@options[:type] = val
|
|
2649
2806
|
end
|
|
2650
2807
|
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
if val
|
|
2655
|
-
@options[:operator] = val
|
|
2656
|
-
else
|
|
2657
|
-
@options[:operator]
|
|
2658
|
-
end
|
|
2808
|
+
#: () -> untyped
|
|
2809
|
+
def operator
|
|
2810
|
+
@options[:operator]
|
|
2659
2811
|
end
|
|
2660
2812
|
|
|
2661
2813
|
#: (untyped val) -> untyped
|
|
@@ -2663,14 +2815,9 @@ module Xlsxrb
|
|
|
2663
2815
|
@options[:operator] = val
|
|
2664
2816
|
end
|
|
2665
2817
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
if val
|
|
2670
|
-
@options[:formula1] = val
|
|
2671
|
-
else
|
|
2672
|
-
@options[:formula1]
|
|
2673
|
-
end
|
|
2818
|
+
#: () -> untyped
|
|
2819
|
+
def formula1
|
|
2820
|
+
@options[:formula1]
|
|
2674
2821
|
end
|
|
2675
2822
|
|
|
2676
2823
|
#: (untyped val) -> untyped
|
|
@@ -2678,14 +2825,9 @@ module Xlsxrb
|
|
|
2678
2825
|
@options[:formula1] = val
|
|
2679
2826
|
end
|
|
2680
2827
|
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
if val
|
|
2685
|
-
@options[:formula2] = val
|
|
2686
|
-
else
|
|
2687
|
-
@options[:formula2]
|
|
2688
|
-
end
|
|
2828
|
+
#: () -> untyped
|
|
2829
|
+
def formula2
|
|
2830
|
+
@options[:formula2]
|
|
2689
2831
|
end
|
|
2690
2832
|
|
|
2691
2833
|
#: (untyped val) -> untyped
|
|
@@ -2693,14 +2835,9 @@ module Xlsxrb
|
|
|
2693
2835
|
@options[:formula2] = val
|
|
2694
2836
|
end
|
|
2695
2837
|
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
if val.nil?
|
|
2700
|
-
@options[:allow_blank]
|
|
2701
|
-
else
|
|
2702
|
-
@options[:allow_blank] = val ? true : false
|
|
2703
|
-
end
|
|
2838
|
+
#: () -> bool
|
|
2839
|
+
def allow_blank?
|
|
2840
|
+
@options[:allow_blank] ? true : false
|
|
2704
2841
|
end
|
|
2705
2842
|
|
|
2706
2843
|
#: (bool val) -> bool
|
|
@@ -2708,14 +2845,9 @@ module Xlsxrb
|
|
|
2708
2845
|
@options[:allow_blank] = val ? true : false
|
|
2709
2846
|
end
|
|
2710
2847
|
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
if val.nil?
|
|
2715
|
-
@options[:show_input_message]
|
|
2716
|
-
else
|
|
2717
|
-
@options[:show_input_message] = val ? true : false
|
|
2718
|
-
end
|
|
2848
|
+
#: () -> bool
|
|
2849
|
+
def show_input_message?
|
|
2850
|
+
@options[:show_input_message] ? true : false
|
|
2719
2851
|
end
|
|
2720
2852
|
|
|
2721
2853
|
#: (bool val) -> bool
|
|
@@ -2723,14 +2855,9 @@ module Xlsxrb
|
|
|
2723
2855
|
@options[:show_input_message] = val ? true : false
|
|
2724
2856
|
end
|
|
2725
2857
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
if val.nil?
|
|
2730
|
-
@options[:show_error_message]
|
|
2731
|
-
else
|
|
2732
|
-
@options[:show_error_message] = val ? true : false
|
|
2733
|
-
end
|
|
2858
|
+
#: () -> bool
|
|
2859
|
+
def show_error_message?
|
|
2860
|
+
@options[:show_error_message] ? true : false
|
|
2734
2861
|
end
|
|
2735
2862
|
|
|
2736
2863
|
#: (bool val) -> bool
|
|
@@ -2738,14 +2865,9 @@ module Xlsxrb
|
|
|
2738
2865
|
@options[:show_error_message] = val ? true : false
|
|
2739
2866
|
end
|
|
2740
2867
|
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
if val
|
|
2745
|
-
@options[:error_title] = val.to_s
|
|
2746
|
-
else
|
|
2747
|
-
@options[:error_title]
|
|
2748
|
-
end
|
|
2868
|
+
#: () -> String?
|
|
2869
|
+
def error_title
|
|
2870
|
+
@options[:error_title]
|
|
2749
2871
|
end
|
|
2750
2872
|
|
|
2751
2873
|
#: (String val) -> String
|
|
@@ -2753,33 +2875,19 @@ module Xlsxrb
|
|
|
2753
2875
|
@options[:error_title] = val.to_s
|
|
2754
2876
|
end
|
|
2755
2877
|
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
if val
|
|
2760
|
-
@options[:error] = val.to_s
|
|
2761
|
-
else
|
|
2762
|
-
@options[:error]
|
|
2763
|
-
end
|
|
2878
|
+
#: () -> String?
|
|
2879
|
+
def error_message
|
|
2880
|
+
@options[:error]
|
|
2764
2881
|
end
|
|
2765
2882
|
|
|
2766
2883
|
#: (String val) -> String
|
|
2767
2884
|
def error_message=(val)
|
|
2768
2885
|
@options[:error] = val.to_s
|
|
2769
2886
|
end
|
|
2770
|
-
# @deprecated Use {#error_message} instead. Will be removed in 0.2.0.
|
|
2771
|
-
alias error error_message
|
|
2772
|
-
# @deprecated Use {#error_message=} instead. Will be removed in 0.2.0.
|
|
2773
|
-
alias error= error_message=
|
|
2774
2887
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
if val
|
|
2779
|
-
@options[:prompt_title] = val.to_s
|
|
2780
|
-
else
|
|
2781
|
-
@options[:prompt_title]
|
|
2782
|
-
end
|
|
2888
|
+
#: () -> String?
|
|
2889
|
+
def prompt_title
|
|
2890
|
+
@options[:prompt_title]
|
|
2783
2891
|
end
|
|
2784
2892
|
|
|
2785
2893
|
#: (String val) -> String
|
|
@@ -2787,33 +2895,19 @@ module Xlsxrb
|
|
|
2787
2895
|
@options[:prompt_title] = val.to_s
|
|
2788
2896
|
end
|
|
2789
2897
|
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
if val
|
|
2794
|
-
@options[:prompt] = val.to_s
|
|
2795
|
-
else
|
|
2796
|
-
@options[:prompt]
|
|
2797
|
-
end
|
|
2898
|
+
#: () -> String?
|
|
2899
|
+
def prompt_message
|
|
2900
|
+
@options[:prompt]
|
|
2798
2901
|
end
|
|
2799
2902
|
|
|
2800
2903
|
#: (String val) -> String
|
|
2801
2904
|
def prompt_message=(val)
|
|
2802
2905
|
@options[:prompt] = val.to_s
|
|
2803
2906
|
end
|
|
2804
|
-
# @deprecated Use {#prompt_message} instead. Will be removed in 0.2.0.
|
|
2805
|
-
alias prompt prompt_message
|
|
2806
|
-
# @deprecated Use {#prompt_message=} instead. Will be removed in 0.2.0.
|
|
2807
|
-
alias prompt= prompt_message=
|
|
2808
2907
|
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
if val
|
|
2813
|
-
@options[:error_style] = val
|
|
2814
|
-
else
|
|
2815
|
-
@options[:error_style]
|
|
2816
|
-
end
|
|
2908
|
+
#: () -> untyped
|
|
2909
|
+
def error_style
|
|
2910
|
+
@options[:error_style]
|
|
2817
2911
|
end
|
|
2818
2912
|
|
|
2819
2913
|
#: (untyped val) -> untyped
|
|
@@ -2839,92 +2933,39 @@ module Xlsxrb
|
|
|
2839
2933
|
@options[:sqref] = sqref if sqref
|
|
2840
2934
|
end
|
|
2841
2935
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
# @api public
|
|
2846
|
-
#: (untyped key) -> untyped
|
|
2847
|
-
def [](key)
|
|
2848
|
-
warn "[Xlsxrb DEPRECATION] ConditionalFormatBuilder#[] is deprecated; use dedicated property accessors instead.", uplevel: 1
|
|
2849
|
-
@options[key.to_sym]
|
|
2850
|
-
end
|
|
2851
|
-
|
|
2852
|
-
# @deprecated Use dedicated property accessors instead. Will be removed in 0.2.0.
|
|
2853
|
-
# @param key [Symbol, String]
|
|
2854
|
-
# @param value [Object]
|
|
2855
|
-
# @return [Object]
|
|
2856
|
-
# @api public
|
|
2857
|
-
#: (untyped key, untyped value) -> untyped
|
|
2858
|
-
def []=(key, value)
|
|
2859
|
-
warn "[Xlsxrb DEPRECATION] ConditionalFormatBuilder#[]= is deprecated; use dedicated property accessors instead.", uplevel: 1
|
|
2860
|
-
@options[key.to_sym] = value
|
|
2861
|
-
end
|
|
2862
|
-
|
|
2863
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#sqref=} instead.
|
|
2864
|
-
#: (?String? val) -> String?
|
|
2865
|
-
def sqref(val = nil)
|
|
2866
|
-
if val
|
|
2867
|
-
@options[:sqref] = val.to_s
|
|
2868
|
-
else
|
|
2869
|
-
@options[:sqref]
|
|
2870
|
-
end
|
|
2936
|
+
#: () -> String?
|
|
2937
|
+
def sqref
|
|
2938
|
+
@options[:sqref]
|
|
2871
2939
|
end
|
|
2872
2940
|
|
|
2873
2941
|
#: (String val) -> String
|
|
2874
2942
|
def sqref=(val)
|
|
2875
2943
|
@options[:sqref] = val.to_s
|
|
2876
2944
|
end
|
|
2877
|
-
# @deprecated Use {#sqref} instead. Will be removed in 0.2.0.
|
|
2878
|
-
alias range sqref
|
|
2879
|
-
# @deprecated Use {#sqref=} instead. Will be removed in 0.2.0.
|
|
2880
|
-
alias range= sqref=
|
|
2881
2945
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
if val
|
|
2886
|
-
@options[:columns] = val
|
|
2887
|
-
else
|
|
2888
|
-
@options[:columns]
|
|
2889
|
-
end
|
|
2946
|
+
#: () -> untyped
|
|
2947
|
+
def columns
|
|
2948
|
+
@options[:columns]
|
|
2890
2949
|
end
|
|
2891
2950
|
|
|
2892
2951
|
#: (untyped val) -> untyped
|
|
2893
2952
|
def columns=(val)
|
|
2894
2953
|
@options[:columns] = val
|
|
2895
2954
|
end
|
|
2896
|
-
# @deprecated Use {#columns} instead. Will be removed in 0.2.0.
|
|
2897
|
-
alias col columns
|
|
2898
|
-
# @deprecated Use {#columns=} instead. Will be removed in 0.2.0.
|
|
2899
|
-
alias col= columns=
|
|
2900
2955
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
if val
|
|
2905
|
-
@options[:rows] = val
|
|
2906
|
-
else
|
|
2907
|
-
@options[:rows]
|
|
2908
|
-
end
|
|
2956
|
+
#: () -> untyped
|
|
2957
|
+
def rows
|
|
2958
|
+
@options[:rows]
|
|
2909
2959
|
end
|
|
2910
2960
|
|
|
2911
2961
|
#: (untyped val) -> untyped
|
|
2912
2962
|
def rows=(val)
|
|
2913
2963
|
@options[:rows] = val
|
|
2914
2964
|
end
|
|
2915
|
-
# @deprecated Use {#rows} instead. Will be removed in 0.2.0.
|
|
2916
|
-
alias row rows
|
|
2917
|
-
# @deprecated Use {#rows=} instead. Will be removed in 0.2.0.
|
|
2918
|
-
alias row= rows=
|
|
2919
2965
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
if val
|
|
2924
|
-
@options[:except_rows] = val
|
|
2925
|
-
else
|
|
2926
|
-
@options[:except_rows]
|
|
2927
|
-
end
|
|
2966
|
+
#: () -> untyped
|
|
2967
|
+
def except_rows
|
|
2968
|
+
@options[:except_rows]
|
|
2928
2969
|
end
|
|
2929
2970
|
|
|
2930
2971
|
#: (untyped val) -> untyped
|
|
@@ -2932,14 +2973,9 @@ module Xlsxrb
|
|
|
2932
2973
|
@options[:except_rows] = val
|
|
2933
2974
|
end
|
|
2934
2975
|
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
if val
|
|
2939
|
-
@options[:type] = val
|
|
2940
|
-
else
|
|
2941
|
-
@options[:type]
|
|
2942
|
-
end
|
|
2976
|
+
#: () -> untyped
|
|
2977
|
+
def type
|
|
2978
|
+
@options[:type]
|
|
2943
2979
|
end
|
|
2944
2980
|
|
|
2945
2981
|
#: (untyped val) -> untyped
|
|
@@ -2947,14 +2983,9 @@ module Xlsxrb
|
|
|
2947
2983
|
@options[:type] = val
|
|
2948
2984
|
end
|
|
2949
2985
|
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
if val
|
|
2954
|
-
@options[:operator] = val
|
|
2955
|
-
else
|
|
2956
|
-
@options[:operator]
|
|
2957
|
-
end
|
|
2986
|
+
#: () -> untyped
|
|
2987
|
+
def operator
|
|
2988
|
+
@options[:operator]
|
|
2958
2989
|
end
|
|
2959
2990
|
|
|
2960
2991
|
#: (untyped val) -> untyped
|
|
@@ -2962,14 +2993,9 @@ module Xlsxrb
|
|
|
2962
2993
|
@options[:operator] = val
|
|
2963
2994
|
end
|
|
2964
2995
|
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
if val
|
|
2969
|
-
@options[:formula] = val
|
|
2970
|
-
else
|
|
2971
|
-
@options[:formula]
|
|
2972
|
-
end
|
|
2996
|
+
#: () -> untyped
|
|
2997
|
+
def formula
|
|
2998
|
+
@options[:formula]
|
|
2973
2999
|
end
|
|
2974
3000
|
|
|
2975
3001
|
#: (untyped val) -> untyped
|
|
@@ -2977,39 +3003,9 @@ module Xlsxrb
|
|
|
2977
3003
|
@options[:formula] = val
|
|
2978
3004
|
end
|
|
2979
3005
|
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
#: (*untyped vals) -> untyped
|
|
2984
|
-
def formulas(*vals)
|
|
2985
|
-
warn "[Xlsxrb DEPRECATION] ConditionalFormatBuilder#formulas is deprecated; use #formula instead.", uplevel: 1
|
|
2986
|
-
if vals.empty?
|
|
2987
|
-
@options[:formulas]
|
|
2988
|
-
elsif vals.size == 1 && vals.first.is_a?(Array)
|
|
2989
|
-
@options[:formulas] = vals.first
|
|
2990
|
-
else
|
|
2991
|
-
@options[:formulas] = vals
|
|
2992
|
-
end
|
|
2993
|
-
end
|
|
2994
|
-
|
|
2995
|
-
# @deprecated Use {#formula=} instead. Will be removed in 0.2.0.
|
|
2996
|
-
# @param vals [Array, Object]
|
|
2997
|
-
# @return [Array]
|
|
2998
|
-
# @api public
|
|
2999
|
-
#: (untyped vals) -> untyped
|
|
3000
|
-
def formulas=(vals)
|
|
3001
|
-
warn "[Xlsxrb DEPRECATION] ConditionalFormatBuilder#formulas= is deprecated; use #formula= instead.", uplevel: 1
|
|
3002
|
-
@options[:formulas] = vals.is_a?(Array) ? vals : [vals]
|
|
3003
|
-
end
|
|
3004
|
-
|
|
3005
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#font=} instead.
|
|
3006
|
-
#: (?untyped val) -> untyped
|
|
3007
|
-
def font(val = nil)
|
|
3008
|
-
if val
|
|
3009
|
-
@options[:font] = val
|
|
3010
|
-
else
|
|
3011
|
-
@options[:font]
|
|
3012
|
-
end
|
|
3006
|
+
#: () -> untyped
|
|
3007
|
+
def font
|
|
3008
|
+
@options[:font]
|
|
3013
3009
|
end
|
|
3014
3010
|
|
|
3015
3011
|
#: (untyped val) -> untyped
|
|
@@ -3017,14 +3013,9 @@ module Xlsxrb
|
|
|
3017
3013
|
@options[:font] = val
|
|
3018
3014
|
end
|
|
3019
3015
|
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
if val
|
|
3024
|
-
@options[:fill] = val
|
|
3025
|
-
else
|
|
3026
|
-
@options[:fill]
|
|
3027
|
-
end
|
|
3016
|
+
#: () -> untyped
|
|
3017
|
+
def fill
|
|
3018
|
+
@options[:fill]
|
|
3028
3019
|
end
|
|
3029
3020
|
|
|
3030
3021
|
#: (untyped val) -> untyped
|
|
@@ -3032,14 +3023,9 @@ module Xlsxrb
|
|
|
3032
3023
|
@options[:fill] = val
|
|
3033
3024
|
end
|
|
3034
3025
|
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
if val
|
|
3039
|
-
@options[:fill_color] = val
|
|
3040
|
-
else
|
|
3041
|
-
@options[:fill_color]
|
|
3042
|
-
end
|
|
3026
|
+
#: () -> untyped
|
|
3027
|
+
def fill_color
|
|
3028
|
+
@options[:fill_color]
|
|
3043
3029
|
end
|
|
3044
3030
|
|
|
3045
3031
|
#: (untyped val) -> untyped
|
|
@@ -3047,14 +3033,9 @@ module Xlsxrb
|
|
|
3047
3033
|
@options[:fill_color] = val
|
|
3048
3034
|
end
|
|
3049
3035
|
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
if val
|
|
3054
|
-
@options[:font_color] = val
|
|
3055
|
-
else
|
|
3056
|
-
@options[:font_color]
|
|
3057
|
-
end
|
|
3036
|
+
#: () -> untyped
|
|
3037
|
+
def font_color
|
|
3038
|
+
@options[:font_color]
|
|
3058
3039
|
end
|
|
3059
3040
|
|
|
3060
3041
|
#: (untyped val) -> untyped
|
|
@@ -3062,14 +3043,9 @@ module Xlsxrb
|
|
|
3062
3043
|
@options[:font_color] = val
|
|
3063
3044
|
end
|
|
3064
3045
|
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
if val.nil?
|
|
3069
|
-
@options[:bold]
|
|
3070
|
-
else
|
|
3071
|
-
@options[:bold] = val ? true : false
|
|
3072
|
-
end
|
|
3046
|
+
#: () -> bool
|
|
3047
|
+
def bold?
|
|
3048
|
+
@options[:bold] ? true : false
|
|
3073
3049
|
end
|
|
3074
3050
|
|
|
3075
3051
|
#: (bool val) -> bool
|
|
@@ -3077,14 +3053,9 @@ module Xlsxrb
|
|
|
3077
3053
|
@options[:bold] = val ? true : false
|
|
3078
3054
|
end
|
|
3079
3055
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
if val.nil?
|
|
3084
|
-
@options[:italic]
|
|
3085
|
-
else
|
|
3086
|
-
@options[:italic] = val ? true : false
|
|
3087
|
-
end
|
|
3056
|
+
#: () -> bool
|
|
3057
|
+
def italic?
|
|
3058
|
+
@options[:italic] ? true : false
|
|
3088
3059
|
end
|
|
3089
3060
|
|
|
3090
3061
|
#: (bool val) -> bool
|
|
@@ -3092,14 +3063,9 @@ module Xlsxrb
|
|
|
3092
3063
|
@options[:italic] = val ? true : false
|
|
3093
3064
|
end
|
|
3094
3065
|
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
if val.nil?
|
|
3099
|
-
@options[:underline]
|
|
3100
|
-
else
|
|
3101
|
-
@options[:underline] = val
|
|
3102
|
-
end
|
|
3066
|
+
#: () -> untyped
|
|
3067
|
+
def underline
|
|
3068
|
+
@options[:underline]
|
|
3103
3069
|
end
|
|
3104
3070
|
|
|
3105
3071
|
#: (untyped val) -> untyped
|
|
@@ -3107,14 +3073,9 @@ module Xlsxrb
|
|
|
3107
3073
|
@options[:underline] = val
|
|
3108
3074
|
end
|
|
3109
3075
|
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
if val
|
|
3114
|
-
@options[:font_name] = val.to_s
|
|
3115
|
-
else
|
|
3116
|
-
@options[:font_name]
|
|
3117
|
-
end
|
|
3076
|
+
#: () -> String?
|
|
3077
|
+
def font_name
|
|
3078
|
+
@options[:font_name]
|
|
3118
3079
|
end
|
|
3119
3080
|
|
|
3120
3081
|
#: (String val) -> String
|
|
@@ -3122,55 +3083,19 @@ module Xlsxrb
|
|
|
3122
3083
|
@options[:font_name] = val.to_s
|
|
3123
3084
|
end
|
|
3124
3085
|
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
if val
|
|
3129
|
-
@options[:font_size] = val
|
|
3130
|
-
@options[:size] = val
|
|
3131
|
-
else
|
|
3132
|
-
@options[:font_size] || @options[:size]
|
|
3133
|
-
end
|
|
3086
|
+
#: () -> untyped
|
|
3087
|
+
def font_size
|
|
3088
|
+
@options[:font_size]
|
|
3134
3089
|
end
|
|
3135
3090
|
|
|
3136
3091
|
#: (untyped val) -> untyped
|
|
3137
3092
|
def font_size=(val)
|
|
3138
3093
|
@options[:font_size] = val
|
|
3139
|
-
@options[:size] = val
|
|
3140
|
-
end
|
|
3141
|
-
|
|
3142
|
-
# @deprecated Use {#font_size} instead. Will be removed in 0.2.0.
|
|
3143
|
-
def size(val = nil)
|
|
3144
|
-
warn "[DEPRECATION] `size` is deprecated; use `font_size` instead.", uplevel: 1
|
|
3145
|
-
font_size(val)
|
|
3146
|
-
end
|
|
3147
|
-
|
|
3148
|
-
# @deprecated Use {#font_size=} instead. Will be removed in 0.2.0.
|
|
3149
|
-
def size=(val)
|
|
3150
|
-
warn "[DEPRECATION] `size=` is deprecated; use `font_size=` instead.", uplevel: 1
|
|
3151
|
-
self.font_size = val
|
|
3152
|
-
end
|
|
3153
|
-
|
|
3154
|
-
# @deprecated Use {#font_size} instead. Will be removed in 0.2.0.
|
|
3155
|
-
def sz(val = nil)
|
|
3156
|
-
warn "[DEPRECATION] `sz` is deprecated; use `font_size` instead.", uplevel: 1
|
|
3157
|
-
font_size(val)
|
|
3158
3094
|
end
|
|
3159
3095
|
|
|
3160
|
-
|
|
3161
|
-
def
|
|
3162
|
-
|
|
3163
|
-
self.font_size = val
|
|
3164
|
-
end
|
|
3165
|
-
|
|
3166
|
-
# @deprecated Calling with arguments is deprecated and will be removed in 0.2.0. Use {#stop_if_true=} instead.
|
|
3167
|
-
#: (?bool? val) -> bool?
|
|
3168
|
-
def stop_if_true(val = nil)
|
|
3169
|
-
if val.nil?
|
|
3170
|
-
@options[:stop_if_true]
|
|
3171
|
-
else
|
|
3172
|
-
@options[:stop_if_true] = val ? true : false
|
|
3173
|
-
end
|
|
3096
|
+
#: () -> bool
|
|
3097
|
+
def stop_if_true?
|
|
3098
|
+
@options[:stop_if_true] ? true : false
|
|
3174
3099
|
end
|
|
3175
3100
|
|
|
3176
3101
|
#: (bool val) -> bool
|
|
@@ -3178,14 +3103,9 @@ module Xlsxrb
|
|
|
3178
3103
|
@options[:stop_if_true] = val ? true : false
|
|
3179
3104
|
end
|
|
3180
3105
|
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
if val
|
|
3185
|
-
@options[:priority] = val.to_i
|
|
3186
|
-
else
|
|
3187
|
-
@options[:priority]
|
|
3188
|
-
end
|
|
3106
|
+
#: () -> Integer?
|
|
3107
|
+
def priority
|
|
3108
|
+
@options[:priority]
|
|
3189
3109
|
end
|
|
3190
3110
|
|
|
3191
3111
|
#: (Integer val) -> Integer
|
|
@@ -3193,14 +3113,9 @@ module Xlsxrb
|
|
|
3193
3113
|
@options[:priority] = val.to_i
|
|
3194
3114
|
end
|
|
3195
3115
|
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
if val.nil?
|
|
3200
|
-
@options[:above_average]
|
|
3201
|
-
else
|
|
3202
|
-
@options[:above_average] = val ? true : false
|
|
3203
|
-
end
|
|
3116
|
+
#: () -> bool
|
|
3117
|
+
def above_average?
|
|
3118
|
+
@options[:above_average] ? true : false
|
|
3204
3119
|
end
|
|
3205
3120
|
|
|
3206
3121
|
#: (bool val) -> bool
|
|
@@ -3208,14 +3123,9 @@ module Xlsxrb
|
|
|
3208
3123
|
@options[:above_average] = val ? true : false
|
|
3209
3124
|
end
|
|
3210
3125
|
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
if val.nil?
|
|
3215
|
-
@options[:equal_average]
|
|
3216
|
-
else
|
|
3217
|
-
@options[:equal_average] = val ? true : false
|
|
3218
|
-
end
|
|
3126
|
+
#: () -> bool
|
|
3127
|
+
def equal_average?
|
|
3128
|
+
@options[:equal_average] ? true : false
|
|
3219
3129
|
end
|
|
3220
3130
|
|
|
3221
3131
|
#: (bool val) -> bool
|
|
@@ -3223,14 +3133,9 @@ module Xlsxrb
|
|
|
3223
3133
|
@options[:equal_average] = val ? true : false
|
|
3224
3134
|
end
|
|
3225
3135
|
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
if val
|
|
3230
|
-
@options[:std_dev] = val.to_i
|
|
3231
|
-
else
|
|
3232
|
-
@options[:std_dev]
|
|
3233
|
-
end
|
|
3136
|
+
#: () -> Integer?
|
|
3137
|
+
def std_dev
|
|
3138
|
+
@options[:std_dev]
|
|
3234
3139
|
end
|
|
3235
3140
|
|
|
3236
3141
|
#: (Integer val) -> Integer
|
|
@@ -3238,14 +3143,9 @@ module Xlsxrb
|
|
|
3238
3143
|
@options[:std_dev] = val.to_i
|
|
3239
3144
|
end
|
|
3240
3145
|
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
if val
|
|
3245
|
-
@options[:rank] = val.to_i
|
|
3246
|
-
else
|
|
3247
|
-
@options[:rank]
|
|
3248
|
-
end
|
|
3146
|
+
#: () -> Integer?
|
|
3147
|
+
def rank
|
|
3148
|
+
@options[:rank]
|
|
3249
3149
|
end
|
|
3250
3150
|
|
|
3251
3151
|
#: (Integer val) -> Integer
|
|
@@ -3253,14 +3153,9 @@ module Xlsxrb
|
|
|
3253
3153
|
@options[:rank] = val.to_i
|
|
3254
3154
|
end
|
|
3255
3155
|
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
if val.nil?
|
|
3260
|
-
@options[:percent]
|
|
3261
|
-
else
|
|
3262
|
-
@options[:percent] = val ? true : false
|
|
3263
|
-
end
|
|
3156
|
+
#: () -> bool
|
|
3157
|
+
def percent?
|
|
3158
|
+
@options[:percent] ? true : false
|
|
3264
3159
|
end
|
|
3265
3160
|
|
|
3266
3161
|
#: (bool val) -> bool
|
|
@@ -3268,14 +3163,9 @@ module Xlsxrb
|
|
|
3268
3163
|
@options[:percent] = val ? true : false
|
|
3269
3164
|
end
|
|
3270
3165
|
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
if val.nil?
|
|
3275
|
-
@options[:bottom]
|
|
3276
|
-
else
|
|
3277
|
-
@options[:bottom] = val ? true : false
|
|
3278
|
-
end
|
|
3166
|
+
#: () -> bool
|
|
3167
|
+
def bottom?
|
|
3168
|
+
@options[:bottom] ? true : false
|
|
3279
3169
|
end
|
|
3280
3170
|
|
|
3281
3171
|
#: (bool val) -> bool
|
|
@@ -3283,14 +3173,9 @@ module Xlsxrb
|
|
|
3283
3173
|
@options[:bottom] = val ? true : false
|
|
3284
3174
|
end
|
|
3285
3175
|
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
if val
|
|
3290
|
-
@options[:text] = val.to_s
|
|
3291
|
-
else
|
|
3292
|
-
@options[:text]
|
|
3293
|
-
end
|
|
3176
|
+
#: () -> String?
|
|
3177
|
+
def text
|
|
3178
|
+
@options[:text]
|
|
3294
3179
|
end
|
|
3295
3180
|
|
|
3296
3181
|
#: (String val) -> String
|
|
@@ -3298,14 +3183,9 @@ module Xlsxrb
|
|
|
3298
3183
|
@options[:text] = val.to_s
|
|
3299
3184
|
end
|
|
3300
3185
|
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
if val
|
|
3305
|
-
@options[:time_period] = val
|
|
3306
|
-
else
|
|
3307
|
-
@options[:time_period]
|
|
3308
|
-
end
|
|
3186
|
+
#: () -> untyped
|
|
3187
|
+
def time_period
|
|
3188
|
+
@options[:time_period]
|
|
3309
3189
|
end
|
|
3310
3190
|
|
|
3311
3191
|
#: (untyped val) -> untyped
|
|
@@ -3313,14 +3193,9 @@ module Xlsxrb
|
|
|
3313
3193
|
@options[:time_period] = val
|
|
3314
3194
|
end
|
|
3315
3195
|
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
if val
|
|
3320
|
-
@options[:color_scale] = val
|
|
3321
|
-
else
|
|
3322
|
-
@options[:color_scale]
|
|
3323
|
-
end
|
|
3196
|
+
#: () -> untyped
|
|
3197
|
+
def color_scale
|
|
3198
|
+
@options[:color_scale]
|
|
3324
3199
|
end
|
|
3325
3200
|
|
|
3326
3201
|
#: (untyped val) -> untyped
|
|
@@ -3328,14 +3203,9 @@ module Xlsxrb
|
|
|
3328
3203
|
@options[:color_scale] = val
|
|
3329
3204
|
end
|
|
3330
3205
|
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
if val
|
|
3335
|
-
@options[:data_bar] = val
|
|
3336
|
-
else
|
|
3337
|
-
@options[:data_bar]
|
|
3338
|
-
end
|
|
3206
|
+
#: () -> untyped
|
|
3207
|
+
def data_bar
|
|
3208
|
+
@options[:data_bar]
|
|
3339
3209
|
end
|
|
3340
3210
|
|
|
3341
3211
|
#: (untyped val) -> untyped
|
|
@@ -3343,14 +3213,9 @@ module Xlsxrb
|
|
|
3343
3213
|
@options[:data_bar] = val
|
|
3344
3214
|
end
|
|
3345
3215
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
if val
|
|
3350
|
-
@options[:icon_set] = val
|
|
3351
|
-
else
|
|
3352
|
-
@options[:icon_set]
|
|
3353
|
-
end
|
|
3216
|
+
#: () -> untyped
|
|
3217
|
+
def icon_set
|
|
3218
|
+
@options[:icon_set]
|
|
3354
3219
|
end
|
|
3355
3220
|
|
|
3356
3221
|
#: (untyped val) -> untyped
|
|
@@ -3358,14 +3223,9 @@ module Xlsxrb
|
|
|
3358
3223
|
@options[:icon_set] = val
|
|
3359
3224
|
end
|
|
3360
3225
|
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
if val
|
|
3365
|
-
@options[:dxf] = val
|
|
3366
|
-
else
|
|
3367
|
-
@options[:dxf]
|
|
3368
|
-
end
|
|
3226
|
+
#: () -> untyped
|
|
3227
|
+
def dxf
|
|
3228
|
+
@options[:dxf]
|
|
3369
3229
|
end
|
|
3370
3230
|
|
|
3371
3231
|
#: (untyped val) -> untyped
|
|
@@ -3373,19 +3233,13 @@ module Xlsxrb
|
|
|
3373
3233
|
@options[:dxf] = val
|
|
3374
3234
|
end
|
|
3375
3235
|
|
|
3376
|
-
# Gets
|
|
3236
|
+
# Gets the differential format identifier (dxfId).
|
|
3377
3237
|
#
|
|
3378
|
-
# @param val [Integer, nil]
|
|
3379
3238
|
# @return [Integer, nil]
|
|
3380
3239
|
# @api public
|
|
3381
|
-
#: (
|
|
3382
|
-
def dxf_id
|
|
3383
|
-
|
|
3384
|
-
@options[:dxf_id] = val.to_i
|
|
3385
|
-
@options[:format_id] = val.to_i
|
|
3386
|
-
else
|
|
3387
|
-
@options[:dxf_id] || @options[:format_id]
|
|
3388
|
-
end
|
|
3240
|
+
#: () -> Integer?
|
|
3241
|
+
def dxf_id
|
|
3242
|
+
@options[:dxf_id]
|
|
3389
3243
|
end
|
|
3390
3244
|
|
|
3391
3245
|
# Sets the differential format identifier (dxfId).
|
|
@@ -3396,21 +3250,6 @@ module Xlsxrb
|
|
|
3396
3250
|
#: (Integer val) -> Integer
|
|
3397
3251
|
def dxf_id=(val)
|
|
3398
3252
|
@options[:dxf_id] = val.to_i
|
|
3399
|
-
@options[:format_id] = val.to_i
|
|
3400
|
-
end
|
|
3401
|
-
|
|
3402
|
-
# @deprecated Use {#dxf_id} instead. Will be removed in 0.2.0.
|
|
3403
|
-
#: (?Integer? val) -> Integer?
|
|
3404
|
-
def format_id(val = nil)
|
|
3405
|
-
warn "[DEPRECATION] `format_id` is deprecated; use `dxf_id` instead.", uplevel: 1
|
|
3406
|
-
dxf_id(val)
|
|
3407
|
-
end
|
|
3408
|
-
|
|
3409
|
-
# @deprecated Use {#dxf_id=} instead. Will be removed in 0.2.0.
|
|
3410
|
-
#: (Integer val) -> Integer
|
|
3411
|
-
def format_id=(val)
|
|
3412
|
-
warn "[DEPRECATION] `format_id=` is deprecated; use `dxf_id=` instead.", uplevel: 1
|
|
3413
|
-
self.dxf_id = val
|
|
3414
3253
|
end
|
|
3415
3254
|
|
|
3416
3255
|
#: () -> Hash[Symbol, untyped]
|