xlsxrb 0.1.18 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +163 -0
- data/README.md +34 -11
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +410 -80
- data/lib/xlsxrb/chart_builder.rb +251 -386
- data/lib/xlsxrb/dsl_helpers.rb +120 -67
- 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 +43 -314
- 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 +2 -2
- data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
- data/lib/xlsxrb/ooxml/workbook_writer.rb +172 -93
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +61 -29
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +65 -47
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +28 -11
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +53 -14
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +1 -1
- data/lib/xlsxrb/ooxml/writer.rb +105 -41
- 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 +12 -116
- data/lib/xlsxrb/stream_sheet.rb +14 -261
- data/lib/xlsxrb/stream_writer.rb +623 -1476
- data/lib/xlsxrb/style_builder.rb +376 -593
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +192 -226
- data/lib/xlsxrb/worksheet_builder.rb +456 -1324
- data/lib/xlsxrb.rb +266 -1083
- data/sig/generated/xlsxrb/chart_builder.rbs +202 -205
- data/sig/generated/xlsxrb/dsl_helpers.rbs +64 -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 +3 -3
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +12 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +5 -3
- data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +7 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +20 -14
- 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 +7 -42
- data/sig/generated/xlsxrb/stream_sheet.rbs +1 -158
- data/sig/generated/xlsxrb/stream_writer.rbs +457 -976
- data/sig/generated/xlsxrb/style_builder.rbs +206 -242
- data/sig/generated/xlsxrb/workbook_builder.rbs +84 -132
- data/sig/generated/xlsxrb/worksheet_builder.rbs +309 -685
- data/sig/generated/xlsxrb.rbs +43 -190
- data/sig/rexml.rbs +8 -0
- metadata +3 -5
- data/lib/xlsxrb/utils.rb +0 -251
- data/sig/generated/xlsxrb/utils.rbs +0 -200
|
@@ -117,30 +117,6 @@ module Xlsxrb
|
|
|
117
117
|
#: Array[Elements::HeaderFooterImage]
|
|
118
118
|
attr_reader :header_footer_images
|
|
119
119
|
|
|
120
|
-
# @deprecated Worksheet instances are immutable value objects. In 0.2.0, #dimension= will be removed.
|
|
121
|
-
#: (String? new_dim) -> String?
|
|
122
|
-
def dimension=(new_dim)
|
|
123
|
-
warn "[DEPRECATION] Elements::Worksheet#dimension= is deprecated; worksheets are immutable.", uplevel: 1
|
|
124
|
-
@dimension = new_dim
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
# @deprecated Use {#date1904?} instead. Will be removed in 0.2.0.
|
|
128
|
-
#: () -> bool
|
|
129
|
-
def date1904
|
|
130
|
-
warn "[DEPRECATION] Elements::Worksheet#date1904 is deprecated; use #date1904? instead.", uplevel: 1
|
|
131
|
-
date1904?
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
# Closes the worksheet resources (no-op for in-memory worksheet).
|
|
135
|
-
#
|
|
136
|
-
# @return [void]
|
|
137
|
-
# @api public
|
|
138
|
-
#: () -> void
|
|
139
|
-
def close
|
|
140
|
-
Xlsxrb::Deprecation.warn("Elements::Worksheet#close is deprecated; in-memory worksheets do not hold file handles.", uplevel: 1)
|
|
141
|
-
nil
|
|
142
|
-
end
|
|
143
|
-
|
|
144
120
|
# Support array pattern matching.
|
|
145
121
|
#
|
|
146
122
|
# @return [Array<Object>]
|
|
@@ -150,13 +126,6 @@ module Xlsxrb
|
|
|
150
126
|
[name, rows, columns]
|
|
151
127
|
end
|
|
152
128
|
|
|
153
|
-
# @deprecated Use {#column_breaks} instead.
|
|
154
|
-
#: () -> Array[Elements::PageBreak]
|
|
155
|
-
def col_breaks
|
|
156
|
-
warn "[DEPRECATION] `col_breaks` is deprecated; use `column_breaks` instead.", uplevel: 1
|
|
157
|
-
@column_breaks
|
|
158
|
-
end
|
|
159
|
-
|
|
160
129
|
# Returns worksheet calculation properties (<sheetCalcPr>), or nil if none configured.
|
|
161
130
|
#
|
|
162
131
|
# @return [Elements::SheetCalcProperties, nil]
|
|
@@ -166,38 +135,14 @@ module Xlsxrb
|
|
|
166
135
|
@sheet_calc_pr
|
|
167
136
|
end
|
|
168
137
|
|
|
169
|
-
# @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
|
|
170
|
-
#: () -> Elements::SheetCalcProperties?
|
|
171
|
-
def sheet_calc_pr
|
|
172
|
-
warn "[DEPRECATION] #sheet_calc_pr is deprecated; use #sheet_calc_properties instead.", uplevel: 1
|
|
173
|
-
sheet_calc_properties
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
# @deprecated Use {#sheet_calc_properties} instead. Will be removed in 0.2.0.
|
|
177
|
-
#: () -> Elements::SheetCalcProperties?
|
|
178
|
-
def calc_pr
|
|
179
|
-
warn "[DEPRECATION] #calc_pr is deprecated; use #sheet_calc_properties instead.", uplevel: 1
|
|
180
|
-
sheet_calc_properties
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
# @deprecated Use {#conditional_formats} instead. Matches the ECMA-376 XML element name (<conditionalFormatting>), but {#conditional_formats} is canonical in xlsxrb. Will be removed in version 0.2.0.
|
|
184
|
-
alias conditional_formatting conditional_formats
|
|
185
|
-
# @deprecated Use {#phonetic_properties} instead. Will be removed in 0.2.0.
|
|
186
|
-
alias phonetic_pr phonetic_properties
|
|
187
|
-
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
188
|
-
alias background_picture background_image
|
|
189
|
-
# @deprecated Use {#background_image} instead. Will be removed in 0.2.0.
|
|
190
|
-
alias picture background_image
|
|
191
|
-
|
|
192
138
|
# @param name [String] The worksheet name (max 31 characters).
|
|
193
139
|
# @param rows [Array<Elements::Row>] Rows in the sheet.
|
|
194
140
|
# @param columns [Array<Elements::Column>] Column definitions.
|
|
195
141
|
# @param charts [Array<Hash>] Charts in the sheet.
|
|
196
|
-
# @param
|
|
142
|
+
# @param conditional_formats [Array<Hash, Elements::ConditionalFormat>] Conditional formatting rules.
|
|
197
143
|
# @param data_validations [Array<Hash>] Data validation rules.
|
|
198
144
|
# @param unmapped_data [Hash] Additional metadata for round-tripping.
|
|
199
145
|
# @param errors [Array<String>, nil] Validation errors.
|
|
200
|
-
# @param conditional_formats [Array<Hash>, nil] Alias for conditional_formatting.
|
|
201
146
|
# @param state [Symbol] Sheet visibility state (:visible, :hidden, or :very_hidden).
|
|
202
147
|
# @param hyperlinks [Hash{String => Hash}] Hyperlink mappings by cell reference.
|
|
203
148
|
# @param comments [Array<Hash>] Comments and notes in the sheet.
|
|
@@ -225,26 +170,21 @@ module Xlsxrb
|
|
|
225
170
|
# @param sheet_format [Hash] Sheet format properties (e.g. defaultRowHeight, defaultColWidth).
|
|
226
171
|
# @param row_breaks [Array<Integer | Hash>] Explicit page row breaks.
|
|
227
172
|
# @param column_breaks [Array<Integer | Hash>] Explicit page column breaks.
|
|
228
|
-
# @param col_breaks [Array<Integer | Hash>] Deprecated alias for column_breaks.
|
|
229
173
|
# @param protected_ranges [Array<Hash>] Protected range definitions.
|
|
230
174
|
# @param cell_watches [Array<String>] Watched cell references.
|
|
231
175
|
# @param ignored_errors [Array<Hash>] Ignored error rules.
|
|
232
176
|
# @param phonetic_properties [Hash, nil] Phonetic text properties.
|
|
233
177
|
# @param selection [Hash, Array<Hash>, nil] Active cell and selection settings.
|
|
234
|
-
# @param
|
|
178
|
+
# @param sheet_calc_properties [Hash, nil] Worksheet calculation properties.
|
|
235
179
|
# @param background_image [Hash, nil] Worksheet background image specification.
|
|
236
180
|
# @param threaded_comments [Array<Hash>] Threaded comments in the sheet.
|
|
237
|
-
#: (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[untyped], ?
|
|
238
|
-
def initialize(name:, rows: [], columns: [], charts: [],
|
|
239
|
-
warn "[Xlsxrb DEPRECATION] Passing conditional_formatting: to Worksheet.new is deprecated; use conditional_formats: instead.", uplevel: 1 unless conditional_formatting.nil?
|
|
240
|
-
warn "[Xlsxrb DEPRECATION] Passing col_breaks: to Worksheet.new is deprecated; use column_breaks: instead.", uplevel: 1 unless col_breaks.nil?
|
|
241
|
-
warn "[Xlsxrb DEPRECATION] Worksheet.new(sheet_calc_pr:) is deprecated and will be removed in v0.2.0. Use sheet_calc_properties: instead.", uplevel: 1 unless sheet_calc_pr.nil?
|
|
181
|
+
#: (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[untyped], ?data_validations: Array[untyped], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?, ?conditional_formats: Array[untyped]?, ?state: Symbol, ?hyperlinks: Hash[String, untyped], ?comments: Array[untyped], ?images: Array[Elements::Image], ?styles: (Elements::Styles | Hash[untyped, untyped])?, ?date1904: bool, ?dimension: String?, ?trim_empty_rows: bool, ?pad_empty_rows: bool, ?pad_empty_cells: bool, ?print_area: String?, ?print_titles: untyped, ?sparkline_groups: Array[untyped], ?merged_cells: Array[String], ?auto_filter: String?, ?tables: Array[untyped], ?shapes: Array[untyped], ?freeze_pane: untyped, ?page_setup: untyped, ?page_margins: untyped, ?header_footer: untyped, ?print_options: untyped, ?sheet_protection: untyped, ?sheet_view: untyped, ?sheet_properties: untyped, ?sheet_format: untyped, ?row_breaks: Array[untyped], ?column_breaks: Array[untyped]?, ?protected_ranges: Array[untyped], ?cell_watches: Array[String], ?ignored_errors: Array[untyped], ?phonetic_properties: untyped, ?selection: untyped, ?sheet_calc_properties: untyped, ?background_image: untyped, ?threaded_comments: Array[untyped], ?pivot_tables: Array[untyped]?, ?split_pane: untyped, ?filter_columns: Hash[Integer, untyped]?, ?sort_state: untyped, ?header_footer_images: Array[untyped]?) -> void
|
|
182
|
+
def initialize(name:, rows: [], columns: [], charts: [], data_validations: [], unmapped_data: {}, errors: nil, conditional_formats: nil, state: :visible, hyperlinks: {}, comments: [], images: [], styles: nil, date1904: false, dimension: nil, trim_empty_rows: false, pad_empty_rows: false, pad_empty_cells: false, print_area: nil, print_titles: nil, sparkline_groups: [], merged_cells: [], auto_filter: nil, tables: [], shapes: [], freeze_pane: nil, page_setup: {}, page_margins: nil, header_footer: {}, print_options: {}, sheet_protection: nil, sheet_view: {}, sheet_properties: {}, sheet_format: {}, row_breaks: [], column_breaks: nil, protected_ranges: [], cell_watches: [], ignored_errors: [], phonetic_properties: nil, selection: nil, sheet_calc_properties: nil, background_image: nil, threaded_comments: [], pivot_tables: nil, split_pane: nil, filter_columns: nil, sort_state: nil, header_footer_images: nil)
|
|
242
183
|
@name = name
|
|
243
184
|
@rows = (rows || []).freeze
|
|
244
185
|
@columns = (columns || []).freeze
|
|
245
186
|
@charts = (charts || []).map { |c| c.is_a?(Elements::Chart) ? c : Elements::Chart.new(**c) }.freeze
|
|
246
|
-
|
|
247
|
-
cf = raw_cfs.map do |c|
|
|
187
|
+
cf = (conditional_formats || []).map do |c|
|
|
248
188
|
if c.is_a?(Hash)
|
|
249
189
|
Elements::ConditionalFormat.new(**c)
|
|
250
190
|
else
|
|
@@ -252,7 +192,6 @@ module Xlsxrb
|
|
|
252
192
|
end
|
|
253
193
|
end
|
|
254
194
|
@conditional_formats = cf.freeze
|
|
255
|
-
@conditional_formatting = @conditional_formats
|
|
256
195
|
@data_validations = (data_validations || []).map { |dv| dv.is_a?(Elements::DataValidation) ? dv : Elements::DataValidation.new(**dv) }.freeze
|
|
257
196
|
@unmapped_data = (unmapped_data || {}).freeze
|
|
258
197
|
computed_errors = errors || self.class.validate(@name, @rows)
|
|
@@ -280,13 +219,16 @@ module Xlsxrb
|
|
|
280
219
|
elsif print_titles.is_a?(Elements::PrintTitles)
|
|
281
220
|
print_titles
|
|
282
221
|
else
|
|
283
|
-
|
|
222
|
+
pt_cols = print_titles[:columns] || print_titles[:cols]
|
|
223
|
+
Elements::PrintTitles.new(rows: print_titles[:rows], columns: pt_cols)
|
|
284
224
|
end
|
|
285
225
|
@sparkline_groups = (sparkline_groups || []).map do |sg|
|
|
286
226
|
if sg.is_a?(Hash)
|
|
287
227
|
sls = (sg[:sparklines] || []).map do |s|
|
|
288
228
|
if s.is_a?(Hash)
|
|
289
|
-
|
|
229
|
+
sqref = s[:sqref] || s[:location_ref] || s[:location]
|
|
230
|
+
formula = s[:formula] || s[:data_ref] || s[:f] || s[:data]
|
|
231
|
+
Elements::Sparkline.new(sqref: sqref&.to_s, formula: formula&.to_s)
|
|
290
232
|
elsif s.is_a?(Elements::Sparkline)
|
|
291
233
|
s
|
|
292
234
|
else
|
|
@@ -315,7 +257,7 @@ module Xlsxrb
|
|
|
315
257
|
Elements::TableColumn.new(name: col.to_s, id: idx + 1)
|
|
316
258
|
end
|
|
317
259
|
end
|
|
318
|
-
si = tb[:style_info] || (tb
|
|
260
|
+
si = tb[:style_info] || Elements::Table.style_info_from(tb)
|
|
319
261
|
si = Elements::TableStyleInfo.new(**si) if si.is_a?(Hash)
|
|
320
262
|
Elements::Table.new(**tb, columns: cols, style_info: si)
|
|
321
263
|
else
|
|
@@ -365,7 +307,7 @@ module Xlsxrb
|
|
|
365
307
|
Elements::PageBreak.new(id: brk.to_i, max: 16_383, man: 1)
|
|
366
308
|
end
|
|
367
309
|
end.freeze
|
|
368
|
-
raw_col_breaks = column_breaks ||
|
|
310
|
+
raw_col_breaks = column_breaks || []
|
|
369
311
|
breaks = raw_col_breaks.map do |brk|
|
|
370
312
|
if brk.is_a?(Elements::PageBreak)
|
|
371
313
|
brk
|
|
@@ -377,7 +319,6 @@ module Xlsxrb
|
|
|
377
319
|
end
|
|
378
320
|
end.freeze
|
|
379
321
|
@column_breaks = breaks
|
|
380
|
-
@col_breaks = breaks
|
|
381
322
|
pr = protected_ranges || unmapped_data[:protected_ranges] || unmapped_data.dig(:facade, :protected_ranges) || []
|
|
382
323
|
@protected_ranges = pr.map { |r| r.is_a?(Elements::ProtectedRange) ? r : Elements::ProtectedRange.new(**r) }.freeze
|
|
383
324
|
@cell_watches = (cell_watches || unmapped_data[:cell_watches] || unmapped_data.dig(:facade, :cell_watches) || []).freeze
|
|
@@ -400,13 +341,12 @@ module Xlsxrb
|
|
|
400
341
|
else
|
|
401
342
|
Elements::Selection.new(**selection)
|
|
402
343
|
end
|
|
403
|
-
full_calc = if @sheet_properties.respond_to?(:full_calc_on_load)
|
|
404
|
-
@sheet_properties.full_calc_on_load
|
|
405
|
-
|
|
344
|
+
full_calc = if @sheet_properties.respond_to?(:full_calc_on_load?)
|
|
345
|
+
@sheet_properties.full_calc_on_load?
|
|
346
|
+
elsif @sheet_properties.is_a?(Hash)
|
|
406
347
|
@sheet_properties[:full_calc_on_load]
|
|
407
348
|
end
|
|
408
|
-
|
|
409
|
-
calc = resolved_calc || unmapped_data[:sheet_calc_properties] || unmapped_data[:sheet_calc_pr] || unmapped_data.dig(:facade, :sheet_calc_pr) || (full_calc ? { full_calc_on_load: true } : nil)
|
|
349
|
+
calc = sheet_calc_properties || unmapped_data[:sheet_calc_properties] || unmapped_data[:sheet_calc_pr] || unmapped_data.dig(:facade, :sheet_calc_properties) || unmapped_data.dig(:facade, :sheet_calc_pr) || (full_calc ? { full_calc_on_load: true } : nil)
|
|
410
350
|
@sheet_calc_pr = if calc.nil?
|
|
411
351
|
nil
|
|
412
352
|
elsif calc.is_a?(Elements::SheetCalcProperties)
|
|
@@ -434,18 +374,18 @@ module Xlsxrb
|
|
|
434
374
|
end
|
|
435
375
|
fc = filter_columns || unmapped_data[:filter_columns] || unmapped_data.dig(:facade, :filter_columns) || {}
|
|
436
376
|
@filter_columns = fc.to_h do |k, v|
|
|
437
|
-
|
|
377
|
+
column_id = k.to_i
|
|
438
378
|
val = case v
|
|
439
379
|
when Elements::FilterColumn
|
|
440
380
|
v
|
|
441
381
|
when Hash
|
|
442
|
-
Elements::FilterColumn.
|
|
382
|
+
Elements::FilterColumn.from_spec(column_id, v)
|
|
443
383
|
when Array
|
|
444
|
-
Elements::FilterColumn.new(
|
|
384
|
+
Elements::FilterColumn.new(column_id: column_id, filters: v)
|
|
445
385
|
else
|
|
446
|
-
Elements::FilterColumn.new(
|
|
386
|
+
Elements::FilterColumn.new(column_id: column_id, filters: [v.to_s])
|
|
447
387
|
end
|
|
448
|
-
[
|
|
388
|
+
[column_id, val]
|
|
449
389
|
end.freeze
|
|
450
390
|
st = sort_state || unmapped_data[:sort_state] || unmapped_data.dig(:facade, :sort_state)
|
|
451
391
|
@sort_state = if st.nil?
|
|
@@ -465,30 +405,16 @@ module Xlsxrb
|
|
|
465
405
|
# @api public
|
|
466
406
|
#: () -> bool
|
|
467
407
|
def trim_empty_rows?
|
|
468
|
-
@trim_empty_rows
|
|
408
|
+
@trim_empty_rows
|
|
469
409
|
end
|
|
470
410
|
|
|
471
|
-
#
|
|
472
|
-
#: () -> bool
|
|
473
|
-
def trim_empty_rows
|
|
474
|
-
warn "[DEPRECATION] #trim_empty_rows is deprecated; use #trim_empty_rows? instead.", uplevel: 1
|
|
475
|
-
trim_empty_rows?
|
|
476
|
-
end
|
|
477
|
-
|
|
478
|
-
# Returns whether skipped rows are padded during iteration.
|
|
411
|
+
# Returns whether empty rows are yielded for skipped row numbers during iteration.
|
|
479
412
|
#
|
|
480
413
|
# @return [Boolean]
|
|
481
414
|
# @api public
|
|
482
415
|
#: () -> bool
|
|
483
416
|
def pad_empty_rows?
|
|
484
|
-
@pad_empty_rows
|
|
485
|
-
end
|
|
486
|
-
|
|
487
|
-
# @deprecated Use {#pad_empty_rows?} instead. Will be removed in 0.2.0.
|
|
488
|
-
#: () -> bool
|
|
489
|
-
def pad_empty_rows
|
|
490
|
-
warn "[DEPRECATION] #pad_empty_rows is deprecated; use #pad_empty_rows? instead.", uplevel: 1
|
|
491
|
-
pad_empty_rows?
|
|
417
|
+
@pad_empty_rows
|
|
492
418
|
end
|
|
493
419
|
|
|
494
420
|
# Returns whether missing cells within rows are padded during iteration.
|
|
@@ -497,14 +423,7 @@ module Xlsxrb
|
|
|
497
423
|
# @api public
|
|
498
424
|
#: () -> bool
|
|
499
425
|
def pad_empty_cells?
|
|
500
|
-
@pad_empty_cells
|
|
501
|
-
end
|
|
502
|
-
|
|
503
|
-
# @deprecated Use {#pad_empty_cells?} instead. Will be removed in 0.2.0.
|
|
504
|
-
#: () -> bool
|
|
505
|
-
def pad_empty_cells
|
|
506
|
-
warn "[DEPRECATION] #pad_empty_cells is deprecated; use #pad_empty_cells? instead.", uplevel: 1
|
|
507
|
-
pad_empty_cells?
|
|
426
|
+
@pad_empty_cells
|
|
508
427
|
end
|
|
509
428
|
|
|
510
429
|
# Returns whether the worksheet uses the 1904 date system.
|
|
@@ -548,7 +467,7 @@ module Xlsxrb
|
|
|
548
467
|
# @api public
|
|
549
468
|
#: () -> String?
|
|
550
469
|
def code_name
|
|
551
|
-
sheet_properties.
|
|
470
|
+
sheet_properties.code_name
|
|
552
471
|
end
|
|
553
472
|
|
|
554
473
|
# Returns whether fit-to-page is enabled for page setup on this worksheet.
|
|
@@ -557,18 +476,7 @@ module Xlsxrb
|
|
|
557
476
|
# @api public
|
|
558
477
|
#: () -> bool
|
|
559
478
|
def fit_to_page?
|
|
560
|
-
|
|
561
|
-
sheet_properties.fit_to_page ? true : false
|
|
562
|
-
else
|
|
563
|
-
sheet_properties[:fit_to_page] ? true : false
|
|
564
|
-
end
|
|
565
|
-
end
|
|
566
|
-
|
|
567
|
-
# @deprecated Use {#fit_to_page?} instead. Will be removed in 0.2.0.
|
|
568
|
-
#: () -> bool
|
|
569
|
-
def fit_to_page
|
|
570
|
-
warn "[DEPRECATION] #fit_to_page is deprecated; use #fit_to_page? instead.", uplevel: 1
|
|
571
|
-
fit_to_page?
|
|
479
|
+
sheet_properties.fit_to_page?
|
|
572
480
|
end
|
|
573
481
|
|
|
574
482
|
# Returns whether full calculation on load is enabled on this worksheet.
|
|
@@ -577,14 +485,7 @@ module Xlsxrb
|
|
|
577
485
|
# @api public
|
|
578
486
|
#: () -> bool
|
|
579
487
|
def full_calc_on_load?
|
|
580
|
-
@sheet_calc_pr&.full_calc_on_load == true || sheet_properties.full_calc_on_load == true
|
|
581
|
-
end
|
|
582
|
-
|
|
583
|
-
# @deprecated Use {#full_calc_on_load?} instead. Will be removed in 0.2.0.
|
|
584
|
-
#: () -> bool
|
|
585
|
-
def full_calc_on_load
|
|
586
|
-
warn "[DEPRECATION] #full_calc_on_load is deprecated; use #full_calc_on_load? instead.", uplevel: 1
|
|
587
|
-
full_calc_on_load?
|
|
488
|
+
@sheet_calc_pr&.to_h&.[](:full_calc_on_load) == true || sheet_properties.to_h[:full_calc_on_load] == true
|
|
588
489
|
end
|
|
589
490
|
|
|
590
491
|
# Returns the outline and grouping properties of the worksheet, or an empty hash if none configured.
|
|
@@ -604,8 +505,6 @@ module Xlsxrb
|
|
|
604
505
|
res[:apply_styles] = props[:apply_styles] unless props[:apply_styles].nil?
|
|
605
506
|
res
|
|
606
507
|
end
|
|
607
|
-
# @deprecated Use {#outline_properties} instead. Will be removed in 0.2.0.
|
|
608
|
-
alias outline_pr outline_properties
|
|
609
508
|
|
|
610
509
|
# Iterate over rows in the worksheet.
|
|
611
510
|
#
|
|
@@ -701,7 +600,7 @@ module Xlsxrb
|
|
|
701
600
|
row_consumer = lambda do |row|
|
|
702
601
|
while current_expected_idx < row.index
|
|
703
602
|
empty_row = Row.new(index: current_expected_idx)
|
|
704
|
-
inner_consumer.call(pad_cells ? empty_row.
|
|
603
|
+
inner_consumer.call(pad_cells ? empty_row.padded : empty_row)
|
|
705
604
|
current_expected_idx += 1
|
|
706
605
|
end
|
|
707
606
|
inner_consumer.call(row)
|
|
@@ -710,7 +609,7 @@ module Xlsxrb
|
|
|
710
609
|
end
|
|
711
610
|
|
|
712
611
|
rows.each do |row|
|
|
713
|
-
row_to_yield = pad_cells ? row.
|
|
612
|
+
row_to_yield = pad_cells ? row.padded : row
|
|
714
613
|
row_consumer.call(row_to_yield)
|
|
715
614
|
end
|
|
716
615
|
end
|
|
@@ -775,25 +674,6 @@ module Xlsxrb
|
|
|
775
674
|
images.select { |img| img.ref == ref }
|
|
776
675
|
end
|
|
777
676
|
|
|
778
|
-
# Yields self with images loaded or returns self.
|
|
779
|
-
#
|
|
780
|
-
# @deprecated Access {#images} directly. Lazy-loading is automatic. Will be removed in 0.2.0.
|
|
781
|
-
# @yield [sheet]
|
|
782
|
-
# @yieldparam sheet [Elements::Worksheet]
|
|
783
|
-
# @return [Elements::Worksheet, void]
|
|
784
|
-
# @api public
|
|
785
|
-
#: () { (Elements::Worksheet) -> void } -> void
|
|
786
|
-
#: () -> Elements::Worksheet
|
|
787
|
-
def with_images
|
|
788
|
-
warn "[DEPRECATION] `with_images` is deprecated; access `images` directly.", uplevel: 1
|
|
789
|
-
if block_given?
|
|
790
|
-
yield self
|
|
791
|
-
nil
|
|
792
|
-
else
|
|
793
|
-
self
|
|
794
|
-
end
|
|
795
|
-
end
|
|
796
|
-
|
|
797
677
|
# Returns whether the worksheet is valid according to OOXML specifications.
|
|
798
678
|
#
|
|
799
679
|
# @return [Boolean]
|
|
@@ -927,18 +807,6 @@ module Xlsxrb
|
|
|
927
807
|
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
928
808
|
# @return [Elements::Cell, nil]
|
|
929
809
|
# @api public
|
|
930
|
-
# Access a cell by reference (e.g. "A1") or 0-based coordinate indices (row, col).
|
|
931
|
-
#
|
|
932
|
-
# @deprecated Use {#[]} instead (e.g. sheet["A1"] or sheet[0, 0]). Will be removed in 0.2.0.
|
|
933
|
-
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
934
|
-
# @param col [Integer, String, Symbol, nil] Optional 0-based column index or column letter/Symbol.
|
|
935
|
-
# @return [Elements::Cell, nil]
|
|
936
|
-
# @api public
|
|
937
|
-
#: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> Elements::Cell?
|
|
938
|
-
def cell(ref_or_row, col = nil)
|
|
939
|
-
self[ref_or_row, col]
|
|
940
|
-
end
|
|
941
|
-
|
|
942
810
|
# Returns the formatted string representation of a cell's value.
|
|
943
811
|
#
|
|
944
812
|
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "A1") or 0-based row index.
|
|
@@ -947,83 +815,7 @@ module Xlsxrb
|
|
|
947
815
|
# @api public
|
|
948
816
|
#: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col) -> String?
|
|
949
817
|
def formatted_value(ref_or_row, col = nil)
|
|
950
|
-
|
|
951
|
-
end
|
|
952
|
-
|
|
953
|
-
# Returns a new Worksheet with the specified cell updated.
|
|
954
|
-
#
|
|
955
|
-
# @example
|
|
956
|
-
# new_sheet = sheet.update_cell("B1", value: "Updated")
|
|
957
|
-
#
|
|
958
|
-
# @param ref_or_row [String, Symbol, Integer] Cell reference (e.g. "B1") or 0-based row index.
|
|
959
|
-
# @param col_or_value [Integer, String, Symbol, nil] 0-based column index or column letter/Symbol when ref_or_row is a row index.
|
|
960
|
-
# @param value [Object] The new cell value.
|
|
961
|
-
# @param style [String, Symbol, Hash, nil] Optional new style name or inline style properties.
|
|
962
|
-
# @param style_index [Integer, nil] Optional new 0-based style index.
|
|
963
|
-
# @param formula [Elements::Formula, nil] Optional new formula.
|
|
964
|
-
# @param hyperlink [Hash, String, nil] Optional new hyperlink.
|
|
965
|
-
# @deprecated Use {Xlsxrb.read} + {Xlsxrb.write} for streaming transformations or {Xlsxrb.write} DSL for report generation. Will be removed in 0.2.0.
|
|
966
|
-
# @param comment [Hash, String, nil] Optional new comment.
|
|
967
|
-
# @return [Worksheet] A new Worksheet instance.
|
|
968
|
-
# @api public
|
|
969
|
-
#: (String | Symbol | Integer ref_or_row, ?Integer | String | Symbol | nil col_or_value, ?value: untyped, ?style: (String | Symbol | Hash[Symbol, untyped])?, ?style_index: (Integer | String | Symbol | Hash[Symbol, untyped])?, ?formula: Elements::Formula?, ?hyperlink: (Hash[Symbol, untyped] | String)?, ?comment: (Hash[Symbol, untyped] | String)?) -> Elements::Worksheet
|
|
970
|
-
def update_cell(ref_or_row, col_or_value = nil, value: nil, style: nil, style_index: nil, formula: nil, hyperlink: nil, comment: nil)
|
|
971
|
-
warn "[DEPRECATION] Elements::Worksheet#update_cell is deprecated and will be removed in 0.2.0; use Xlsxrb.read + Xlsxrb.write for streaming transformations or Xlsxrb.write DSL for report generation.", uplevel: 1
|
|
972
|
-
if style_index && !style_index.is_a?(Integer)
|
|
973
|
-
warn "[DEPRECATION] Elements::Worksheet#update_cell passing non-Integer to style_index: is deprecated; use style: instead.", uplevel: 1
|
|
974
|
-
style ||= style_index
|
|
975
|
-
style_index = nil
|
|
976
|
-
end
|
|
977
|
-
if col_or_value
|
|
978
|
-
c_idx = col_or_value.is_a?(Integer) ? col_or_value : Cell._column_index(col_or_value)
|
|
979
|
-
row_idx = ref_or_row.to_i
|
|
980
|
-
ref = "#{Cell._column_letter(c_idx)}#{row_idx + 1}"
|
|
981
|
-
col_idx = c_idx
|
|
982
|
-
else
|
|
983
|
-
ref = ref_or_row.to_s.upcase
|
|
984
|
-
parsed = Cell._parse_ref(ref)
|
|
985
|
-
raise ArgumentError, "invalid cell reference: #{ref}" unless parsed
|
|
986
|
-
|
|
987
|
-
row_idx, col_idx = parsed
|
|
988
|
-
end
|
|
989
|
-
existing_row = row_at(row_idx)
|
|
990
|
-
|
|
991
|
-
if existing_row
|
|
992
|
-
existing_cell = existing_row.cell_at(col_idx)
|
|
993
|
-
new_cell = if existing_cell
|
|
994
|
-
existing_cell.with(
|
|
995
|
-
value: value || existing_cell.value,
|
|
996
|
-
style: style || (style_index ? nil : existing_cell.style),
|
|
997
|
-
style_index: style_index || (style ? nil : existing_cell.style_index),
|
|
998
|
-
formula: formula || existing_cell.formula,
|
|
999
|
-
hyperlink: hyperlink || existing_cell.hyperlink,
|
|
1000
|
-
comment: comment || existing_cell.comment
|
|
1001
|
-
)
|
|
1002
|
-
else
|
|
1003
|
-
Cell.new(row_index: row_idx, column_index: col_idx, value: value, style: style, style_index: style_index, formula: formula, hyperlink: hyperlink, comment: comment)
|
|
1004
|
-
end
|
|
1005
|
-
|
|
1006
|
-
# Replace cell in the existing row
|
|
1007
|
-
new_cells = existing_row.cells.reject { |c| c.column_index == col_idx }
|
|
1008
|
-
new_cells << new_cell
|
|
1009
|
-
new_cells.sort_by!(&:column_index)
|
|
1010
|
-
|
|
1011
|
-
new_row = existing_row.with(cells: new_cells)
|
|
1012
|
-
new_rows = rows.map { |r| r.index == row_idx ? new_row : r }
|
|
1013
|
-
else
|
|
1014
|
-
# Row doesn't exist, create it
|
|
1015
|
-
new_cell = Cell.new(row_index: row_idx, column_index: col_idx, value: value, style: style, style_index: style_index, formula: formula, hyperlink: hyperlink, comment: comment)
|
|
1016
|
-
new_row = Row.new(index: row_idx, cells: [new_cell])
|
|
1017
|
-
new_rows = (rows + [new_row]).sort_by!(&:index)
|
|
1018
|
-
end
|
|
1019
|
-
new_hyperlinks = hyperlink ? hyperlinks.merge(ref.upcase => hyperlink) : hyperlinks
|
|
1020
|
-
new_comments = if comment
|
|
1021
|
-
entry = comment.is_a?(Hash) ? comment.merge(ref: ref.upcase) : { ref: ref.upcase, text: comment }
|
|
1022
|
-
@comments.reject { |c| (c.respond_to?(:ref) ? c.ref : (c[:ref] || c[:cell]))&.to_s&.upcase == ref.upcase } + [entry]
|
|
1023
|
-
else
|
|
1024
|
-
@comments
|
|
1025
|
-
end
|
|
1026
|
-
with(rows: new_rows, hyperlinks: new_hyperlinks, comments: new_comments)
|
|
818
|
+
self[ref_or_row, col]&.formatted_value
|
|
1027
819
|
end
|
|
1028
820
|
|
|
1029
821
|
# Returns a new Worksheet with attributes replaced (Data-like behavior).
|
|
@@ -1037,13 +829,7 @@ module Xlsxrb
|
|
|
1037
829
|
new_rows = changes.key?(:rows) ? changes[:rows] : rows
|
|
1038
830
|
new_cols = changes.key?(:columns) ? changes[:columns] : columns
|
|
1039
831
|
new_charts = changes.key?(:charts) ? changes[:charts] : charts
|
|
1040
|
-
new_cf =
|
|
1041
|
-
changes[:conditional_formatting]
|
|
1042
|
-
elsif changes.key?(:conditional_formats)
|
|
1043
|
-
changes[:conditional_formats]
|
|
1044
|
-
else
|
|
1045
|
-
conditional_formatting
|
|
1046
|
-
end
|
|
832
|
+
new_cf = changes.key?(:conditional_formats) ? changes[:conditional_formats] : conditional_formats
|
|
1047
833
|
new_dv = changes.key?(:data_validations) ? changes[:data_validations] : data_validations
|
|
1048
834
|
new_unmapped = changes.key?(:unmapped_data) ? changes[:unmapped_data] : unmapped_data
|
|
1049
835
|
if new_unmapped.is_a?(Hash) && new_unmapped[:facade].is_a?(Hash)
|
|
@@ -1063,7 +849,7 @@ module Xlsxrb
|
|
|
1063
849
|
new_hyperlinks = changes.key?(:hyperlinks) ? changes[:hyperlinks] : hyperlinks
|
|
1064
850
|
new_comments = changes.key?(:comments) ? changes[:comments] : comments
|
|
1065
851
|
new_styles = changes.key?(:styles) ? changes[:styles] : styles
|
|
1066
|
-
new_date1904 = changes.key?(:date1904) ? changes[:date1904] : date1904
|
|
852
|
+
new_date1904 = changes.key?(:date1904) ? changes[:date1904] : date1904?
|
|
1067
853
|
new_dim = if changes.key?(:dimension)
|
|
1068
854
|
changes[:dimension]
|
|
1069
855
|
else
|
|
@@ -1095,47 +881,14 @@ module Xlsxrb
|
|
|
1095
881
|
new_sheet_properties = changes.key?(:sheet_properties) ? changes[:sheet_properties] : sheet_properties
|
|
1096
882
|
new_sheet_format = changes.key?(:sheet_format) ? changes[:sheet_format] : sheet_format
|
|
1097
883
|
new_row_breaks = changes.key?(:row_breaks) ? changes[:row_breaks] : row_breaks
|
|
1098
|
-
new_col_breaks =
|
|
1099
|
-
changes[:column_breaks]
|
|
1100
|
-
elsif changes.key?(:col_breaks)
|
|
1101
|
-
changes[:col_breaks]
|
|
1102
|
-
else
|
|
1103
|
-
@column_breaks
|
|
1104
|
-
end
|
|
884
|
+
new_col_breaks = changes.key?(:column_breaks) ? changes[:column_breaks] : @column_breaks
|
|
1105
885
|
new_protected_ranges = changes.key?(:protected_ranges) ? changes[:protected_ranges] : protected_ranges
|
|
1106
886
|
new_cell_watches = changes.key?(:cell_watches) ? changes[:cell_watches] : cell_watches
|
|
1107
887
|
new_ignored_errors = changes.key?(:ignored_errors) ? changes[:ignored_errors] : ignored_errors
|
|
1108
|
-
new_phonetic_properties =
|
|
1109
|
-
changes[:phonetic_properties]
|
|
1110
|
-
elsif changes.key?(:phonetic_pr)
|
|
1111
|
-
warn "[Xlsxrb DEPRECATION] Worksheet#with(:phonetic_pr) is deprecated and will be removed in v0.2.0. Use :phonetic_properties instead.", uplevel: 1
|
|
1112
|
-
changes[:phonetic_pr]
|
|
1113
|
-
else
|
|
1114
|
-
phonetic_properties
|
|
1115
|
-
end
|
|
888
|
+
new_phonetic_properties = changes.key?(:phonetic_properties) ? changes[:phonetic_properties] : phonetic_properties
|
|
1116
889
|
new_selection = changes.key?(:selection) ? changes[:selection] : selection
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
elsif changes.key?(:sheet_calc_pr)
|
|
1120
|
-
warn "[Xlsxrb DEPRECATION] Worksheet#with(:sheet_calc_pr) is deprecated and will be removed in v0.2.0. Use :sheet_calc_properties instead.", uplevel: 1
|
|
1121
|
-
changes[:sheet_calc_pr]
|
|
1122
|
-
elsif changes.key?(:calc_pr)
|
|
1123
|
-
warn "[Xlsxrb DEPRECATION] Worksheet#with(:calc_pr) is deprecated and will be removed in v0.2.0. Use :sheet_calc_properties instead.", uplevel: 1
|
|
1124
|
-
changes[:calc_pr]
|
|
1125
|
-
else
|
|
1126
|
-
@sheet_calc_pr
|
|
1127
|
-
end
|
|
1128
|
-
new_background_image = if changes.key?(:background_image)
|
|
1129
|
-
changes[:background_image]
|
|
1130
|
-
elsif changes.key?(:background_picture)
|
|
1131
|
-
warn "[Xlsxrb DEPRECATION] Worksheet#with(:background_picture) is deprecated and will be removed in v0.2.0. Use :background_image instead.", uplevel: 1
|
|
1132
|
-
changes[:background_picture]
|
|
1133
|
-
elsif changes.key?(:picture)
|
|
1134
|
-
warn "[Xlsxrb DEPRECATION] Worksheet#with(:picture) is deprecated and will be removed in v0.2.0. Use :background_image instead.", uplevel: 1
|
|
1135
|
-
changes[:picture]
|
|
1136
|
-
else
|
|
1137
|
-
background_image
|
|
1138
|
-
end
|
|
890
|
+
new_sheet_calc_properties = changes.key?(:sheet_calc_properties) ? changes[:sheet_calc_properties] : @sheet_calc_pr
|
|
891
|
+
new_background_image = changes.key?(:background_image) ? changes[:background_image] : background_image
|
|
1139
892
|
new_threaded_comments = changes.key?(:threaded_comments) ? changes[:threaded_comments] : threaded_comments
|
|
1140
893
|
|
|
1141
894
|
self.class.new(
|
|
@@ -1185,7 +938,7 @@ module Xlsxrb
|
|
|
1185
938
|
ignored_errors: new_ignored_errors,
|
|
1186
939
|
phonetic_properties: new_phonetic_properties,
|
|
1187
940
|
selection: new_selection,
|
|
1188
|
-
sheet_calc_properties:
|
|
941
|
+
sheet_calc_properties: new_sheet_calc_properties,
|
|
1189
942
|
background_image: new_background_image,
|
|
1190
943
|
threaded_comments: new_threaded_comments
|
|
1191
944
|
)
|
|
@@ -1199,8 +952,7 @@ module Xlsxrb
|
|
|
1199
952
|
rows: rows,
|
|
1200
953
|
columns: columns,
|
|
1201
954
|
charts: charts,
|
|
1202
|
-
|
|
1203
|
-
conditional_formats: conditional_formatting,
|
|
955
|
+
conditional_formats: conditional_formats,
|
|
1204
956
|
data_validations: data_validations,
|
|
1205
957
|
unmapped_data: unmapped_data,
|
|
1206
958
|
errors: errors,
|
|
@@ -1238,20 +990,14 @@ module Xlsxrb
|
|
|
1238
990
|
sheet_format: sheet_format,
|
|
1239
991
|
row_breaks: row_breaks,
|
|
1240
992
|
column_breaks: column_breaks,
|
|
1241
|
-
col_breaks: col_breaks,
|
|
1242
993
|
protected_ranges: protected_ranges,
|
|
1243
994
|
cell_watches: cell_watches,
|
|
1244
995
|
ignored_errors: ignored_errors,
|
|
1245
996
|
phonetic_properties: phonetic_properties,
|
|
1246
|
-
phonetic_pr: phonetic_properties,
|
|
1247
997
|
selection: selection,
|
|
1248
998
|
sheet_calc_properties: sheet_calc_properties,
|
|
1249
|
-
sheet_calc_pr: @sheet_calc_pr,
|
|
1250
|
-
calc_pr: @sheet_calc_pr,
|
|
1251
999
|
code_name: code_name,
|
|
1252
|
-
background_image: background_image
|
|
1253
|
-
background_picture: background_image,
|
|
1254
|
-
picture: background_image
|
|
1000
|
+
background_image: background_image
|
|
1255
1001
|
}
|
|
1256
1002
|
end
|
|
1257
1003
|
|
|
@@ -1261,7 +1007,7 @@ module Xlsxrb
|
|
|
1261
1007
|
return false unless other.is_a?(Worksheet)
|
|
1262
1008
|
|
|
1263
1009
|
name == other.name && rows == other.rows && columns == other.columns && charts == other.charts &&
|
|
1264
|
-
|
|
1010
|
+
conditional_formats == other.conditional_formats && data_validations == other.data_validations &&
|
|
1265
1011
|
state == other.state && hyperlinks == other.hyperlinks && comments == other.comments &&
|
|
1266
1012
|
threaded_comments == other.threaded_comments &&
|
|
1267
1013
|
merged_cells == other.merged_cells && auto_filter == other.auto_filter &&
|
|
@@ -1281,31 +1027,14 @@ module Xlsxrb
|
|
|
1281
1027
|
#: () -> Integer
|
|
1282
1028
|
def hash
|
|
1283
1029
|
[
|
|
1284
|
-
self.class, name, rows, columns, charts,
|
|
1030
|
+
self.class, name, rows, columns, charts, conditional_formats, data_validations,
|
|
1285
1031
|
state, hyperlinks, comments, threaded_comments, merged_cells, auto_filter, tables, shapes, freeze_pane,
|
|
1286
1032
|
page_setup, page_margins, header_footer, print_options, sheet_protection, sheet_view,
|
|
1287
|
-
sheet_properties, sheet_format, row_breaks,
|
|
1033
|
+
sheet_properties, sheet_format, row_breaks, column_breaks, protected_ranges,
|
|
1288
1034
|
cell_watches, ignored_errors, phonetic_properties, selection, sheet_calc_properties, background_image
|
|
1289
1035
|
].hash
|
|
1290
1036
|
end
|
|
1291
1037
|
|
|
1292
|
-
# Returns self when load is called on an already in-memory Worksheet.
|
|
1293
|
-
#
|
|
1294
|
-
# @return [Elements::Worksheet]
|
|
1295
|
-
# @api public
|
|
1296
|
-
#: () -> Elements::Worksheet
|
|
1297
|
-
def load
|
|
1298
|
-
Deprecation.warn("Elements::Worksheet#load is deprecated; worksheet is already loaded in memory.")
|
|
1299
|
-
self
|
|
1300
|
-
end
|
|
1301
|
-
|
|
1302
|
-
# @deprecated Use {#load} instead. Will be removed in 0.2.0.
|
|
1303
|
-
#: () -> Elements::Worksheet
|
|
1304
|
-
def to_worksheet
|
|
1305
|
-
warn "[DEPRECATION] #to_worksheet is deprecated; use #load instead.", uplevel: 1
|
|
1306
|
-
load
|
|
1307
|
-
end
|
|
1308
|
-
|
|
1309
1038
|
FORBIDDEN_NAME_CHARS = %r{[\\/?*\[\]:]|[\x00-\x08\x0B\x0C\x0E-\x1F]}
|
|
1310
1039
|
private_constant :FORBIDDEN_NAME_CHARS
|
|
1311
1040
|
|
|
@@ -584,7 +584,10 @@ module Xlsxrb
|
|
|
584
584
|
lr = attributes["lockRevision"]
|
|
585
585
|
prot[:lock_revision] = %w[1 true].include?(lr) unless lr.nil?
|
|
586
586
|
wp = attributes["workbookPassword"]
|
|
587
|
-
|
|
587
|
+
if wp
|
|
588
|
+
prot[:password] = wp
|
|
589
|
+
prot[:workbook_password] = wp
|
|
590
|
+
end
|
|
588
591
|
an = attributes["workbookAlgorithmName"]
|
|
589
592
|
if an
|
|
590
593
|
prot[:algorithm_name] = an
|