xlsxrb 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +93 -1
  3. data/README.md +79 -19
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
  5. data/lib/xlsxrb/chart_builder.rb +595 -113
  6. data/lib/xlsxrb/dsl_helpers.rb +72 -20
  7. data/lib/xlsxrb/elements/cell.rb +243 -56
  8. data/lib/xlsxrb/elements/column.rb +94 -5
  9. data/lib/xlsxrb/elements/coordinate_access.rb +108 -10
  10. data/lib/xlsxrb/elements/image.rb +81 -15
  11. data/lib/xlsxrb/elements/metadata.rb +2733 -0
  12. data/lib/xlsxrb/elements/row.rb +130 -46
  13. data/lib/xlsxrb/elements/styles.rb +184 -76
  14. data/lib/xlsxrb/elements/types.rb +242 -7
  15. data/lib/xlsxrb/elements/workbook.rb +171 -82
  16. data/lib/xlsxrb/elements/worksheet.rb +598 -102
  17. data/lib/xlsxrb/elements.rb +1 -0
  18. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +12 -4
  19. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -2
  20. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +264 -17
  21. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
  22. data/lib/xlsxrb/ooxml/reader.rb +4 -0
  23. data/lib/xlsxrb/ooxml/styles_parser.rb +10 -3
  24. data/lib/xlsxrb/ooxml/workbook_writer.rb +90 -36
  25. data/lib/xlsxrb/ooxml/worksheet_parser.rb +2 -2
  26. data/lib/xlsxrb/ooxml/worksheet_writer.rb +64 -19
  27. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +5 -2
  28. data/lib/xlsxrb/ooxml/writer/features_xml.rb +26 -5
  29. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +19 -9
  30. data/lib/xlsxrb/ooxml/writer.rb +22 -6
  31. data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
  32. data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
  33. data/lib/xlsxrb/stream_row.rb +97 -18
  34. data/lib/xlsxrb/stream_sheet.rb +706 -190
  35. data/lib/xlsxrb/stream_writer.rb +1893 -374
  36. data/lib/xlsxrb/style_builder.rb +774 -111
  37. data/lib/xlsxrb/utils.rb +66 -106
  38. data/lib/xlsxrb/version.rb +1 -1
  39. data/lib/xlsxrb/workbook_builder.rb +380 -83
  40. data/lib/xlsxrb/worksheet_builder.rb +1210 -233
  41. data/lib/xlsxrb.rb +1266 -326
  42. data/sig/generated/xlsxrb/chart_builder.rbs +319 -90
  43. data/sig/generated/xlsxrb/dsl_helpers.rbs +20 -2
  44. data/sig/generated/xlsxrb/elements/cell.rbs +92 -20
  45. data/sig/generated/xlsxrb/elements/column.rbs +61 -2
  46. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +49 -7
  47. data/sig/generated/xlsxrb/elements/image.rbs +30 -8
  48. data/sig/generated/xlsxrb/elements/metadata.rbs +1587 -0
  49. data/sig/generated/xlsxrb/elements/row.rbs +61 -21
  50. data/sig/generated/xlsxrb/elements/styles.rbs +96 -58
  51. data/sig/generated/xlsxrb/elements/types.rbs +27 -0
  52. data/sig/generated/xlsxrb/elements/workbook.rbs +63 -52
  53. data/sig/generated/xlsxrb/elements/worksheet.rbs +192 -51
  54. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -0
  55. data/sig/generated/xlsxrb/ooxml/reader.rbs +3 -0
  56. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +1 -1
  57. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +1 -1
  58. data/sig/generated/xlsxrb/ooxml/writer.rbs +3 -0
  59. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
  60. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
  61. data/sig/generated/xlsxrb/stream_row.rbs +48 -14
  62. data/sig/generated/xlsxrb/stream_sheet.rbs +324 -115
  63. data/sig/generated/xlsxrb/stream_writer.rbs +1068 -255
  64. data/sig/generated/xlsxrb/style_builder.rbs +389 -79
  65. data/sig/generated/xlsxrb/utils.rbs +34 -18
  66. data/sig/generated/xlsxrb/workbook_builder.rbs +234 -34
  67. data/sig/generated/xlsxrb/worksheet_builder.rbs +628 -126
  68. data/sig/generated/xlsxrb.rbs +257 -49
  69. metadata +3 -1
@@ -0,0 +1,2733 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module Xlsxrb
6
+ module Elements
7
+ # Shared mixin for metadata Data value objects providing Hash compatibility.
8
+ #
9
+ # @api public
10
+ module MetadataRecord
11
+ # Accesses an attribute by Symbol or String key, supporting key aliases.
12
+ #
13
+ # @deprecated Hash-like access via {#[]} is deprecated and will be removed in 0.2.0; use method calls instead.
14
+ # @param key [Symbol, String]
15
+ # @return [Object, nil]
16
+ # @api public
17
+ #: (Symbol | String key) -> untyped
18
+ def [](key)
19
+ warn "[DEPRECATION] Hash access on #{self.class} (`#[]`) is deprecated and will be removed in 0.2.0; use method calls instead.", uplevel: 1
20
+ _lookup_key(key)
21
+ end
22
+
23
+ # Returns whether all attributes are nil or empty.
24
+ #
25
+ # @return [Boolean]
26
+ # @api public
27
+ #: () -> bool
28
+ def empty?
29
+ to_h.values.all? { |v| v.nil? || (v.respond_to?(:empty?) && v.empty?) }
30
+ end
31
+
32
+ # Converts the value object to a Hash of non-nil attributes.
33
+ #
34
+ # @return [Hash{Symbol => Object}]
35
+ # @api public
36
+ #: () -> Hash[Symbol, untyped]
37
+ def to_h
38
+ res = super.compact.transform_values do |val|
39
+ if val.is_a?(Array)
40
+ val.map { |v| v.respond_to?(:to_h) && !v.is_a?(String) ? v.to_h : v }
41
+ elsif val.respond_to?(:to_h) && !val.is_a?(String) && !val.is_a?(Hash)
42
+ val.to_h
43
+ else
44
+ val
45
+ end
46
+ end
47
+ if members.include?(:options) && res[:options].is_a?(Hash)
48
+ opts = res.delete(:options)
49
+ opts.each { |ok, ov| res[ok] ||= ov }
50
+ end
51
+ res
52
+ end
53
+
54
+ # Checks whether a key is present with a non-nil value.
55
+ #
56
+ # @deprecated {#key?} is deprecated and will be removed in 0.2.0; check attribute presence directly.
57
+ # @param key [Symbol, String]
58
+ # @return [Boolean]
59
+ # @api public
60
+ #: (Symbol | String key) -> bool
61
+ def key?(key)
62
+ warn "[DEPRECATION] `#{self.class}#key?` is deprecated and will be removed in 0.2.0; check attribute presence directly.", uplevel: 1
63
+ _has_key?(key)
64
+ end
65
+ alias has_key? key?
66
+
67
+ # Digs into nested metadata by key path.
68
+ #
69
+ # @deprecated {#dig} is deprecated and will be removed in 0.2.0; use method chaining instead.
70
+ # @param head [Symbol, String]
71
+ # @param rest [Array<Symbol, String>]
72
+ # @return [Object, nil]
73
+ # @api public
74
+ #: (Symbol | String head, *(Symbol | String) rest) -> untyped
75
+ def dig(head, *rest)
76
+ warn "[DEPRECATION] `#{self.class}#dig` is deprecated and will be removed in 0.2.0; use method chaining instead.", uplevel: 1
77
+ val = _lookup_key(head)
78
+ return nil if val.nil?
79
+ return val if rest.empty?
80
+
81
+ val.respond_to?(:dig) ? val.dig(*rest) : nil
82
+ end
83
+
84
+ # Fetches a key with an optional default.
85
+ #
86
+ # @deprecated {#fetch} is deprecated and will be removed in 0.2.0; use method calls instead.
87
+ # @param key [Symbol, String]
88
+ # @param args [Array<Object>]
89
+ # @return [Object, nil]
90
+ # @api public
91
+ #: (Symbol | String key, *untyped args) ?{ (Symbol | String) -> untyped } -> untyped
92
+ def fetch(key, *args)
93
+ warn "[DEPRECATION] `#{self.class}#fetch` is deprecated and will be removed in 0.2.0; use method calls instead.", uplevel: 1
94
+ val = _lookup_key(key)
95
+ if !val.nil? || (_has_key?(key) && members.include?(key.to_sym))
96
+ val
97
+ elsif block_given?
98
+ yield(key)
99
+ elsif !args.empty?
100
+ args.first
101
+ else
102
+ raise KeyError, "key not found: #{key.inspect}"
103
+ end
104
+ end
105
+
106
+ # Merges non-nil attributes with another Hash or MetadataRecord.
107
+ #
108
+ # @deprecated {#merge} is deprecated and will be removed in 0.2.0; use {#with} or {#to_h} instead.
109
+ # @param other [Hash, MetadataRecord]
110
+ # @return [Hash{Symbol => Object}]
111
+ # @api public
112
+ #: (untyped other) -> Hash[Symbol, untyped]
113
+ def merge(other)
114
+ warn "[DEPRECATION] `#{self.class}#merge` is deprecated and will be removed in 0.2.0; use `#with` or `#to_h.merge` instead.", uplevel: 1
115
+ h = to_h
116
+ other_h = other.respond_to?(:to_h) ? other.to_h : other
117
+ h.merge(other_h)
118
+ end
119
+
120
+ alias to_hash to_h
121
+
122
+ # Checks equality against another instance, a Hash, or a scalar.
123
+ #
124
+ # @param other [Object]
125
+ # @return [Boolean]
126
+ # @api public
127
+ #: (untyped other) -> bool
128
+ def ==(other)
129
+ if other.is_a?(Hash)
130
+ warn "[DEPRECATION] Comparing `#{self.class}` with a Hash is deprecated and will be removed in 0.2.0; compare attributes directly or use `#to_h`.", uplevel: 1
131
+ to_h == other.transform_keys(&:to_sym).compact
132
+ else
133
+ super
134
+ end
135
+ end
136
+
137
+ private
138
+
139
+ def _lookup_key(key)
140
+ k = _normalize_key(key)
141
+ return public_send(k) if members.include?(k)
142
+
143
+ if members.include?(:options)
144
+ opts = options
145
+ return opts[k] || opts[key] if opts.is_a?(Hash)
146
+ end
147
+ nil
148
+ end
149
+
150
+ def _has_key?(key)
151
+ k = _normalize_key(key)
152
+ return true if members.include?(k) && !public_send(k).nil?
153
+
154
+ if members.include?(:options)
155
+ opts = options
156
+ return true if opts.is_a?(Hash) && (opts.key?(k) || opts.key?(key))
157
+ end
158
+ false
159
+ end
160
+
161
+ def _normalize_key(key)
162
+ k = key.is_a?(Symbol) ? key : key.to_s.to_sym
163
+ k = :size if k == :sz
164
+ k = :number_format if k == :num_fmt
165
+ k = :page_setup_properties if k == :page_setup_pr
166
+ k = :pattern_type if k == :pattern
167
+ k = :column if k == :col
168
+ k = :columns if k == :cols
169
+ k = :ref if k == :cell
170
+ k = :sheet_calc_properties if %i[sheet_calc_pr calc_pr].include?(k)
171
+ k = :sqref if %i[location_ref location].include?(k)
172
+ k = :formula if %i[formulas data_ref f].include?(k)
173
+ k = :dxf_id if k == :format_id
174
+ k = :default_column_width if k == :default_col_width
175
+ k = :outline_level_column if k == :outline_level_col
176
+ k = :base_column_width if k == :base_col_width
177
+ k = :from_column if k == :from_col
178
+ k = :to_column if k == :to_col
179
+ k = :column_id if k == :col_id
180
+ k = :active_sheet if k == :active_tab
181
+ k = :first_sheet if k == :first_tab
182
+ k = :background_image if %i[background_picture picture].include?(k)
183
+ k = :local_sheet_name if k == :sheet
184
+ k = :local_sheet_id if k == :sheet_id
185
+ k = :value if k == :range
186
+ k = :app_name if k == :application
187
+ k
188
+ end
189
+ end
190
+
191
+ # Core document properties (docProps/core.xml).
192
+ # @api public
193
+ CoreProperties = Data.define(
194
+ :title, :subject, :creator, :keywords, :description, :last_modified_by,
195
+ :revision, :created, :modified, :category, :content_status
196
+ ) do
197
+ include MetadataRecord
198
+
199
+ #: (?title: String?, ?subject: String?, ?creator: String?, ?keywords: String?, ?description: String?, ?last_modified_by: String?, ?revision: String?, ?created: untyped, ?modified: untyped, ?category: String?, ?content_status: String?, **untyped) -> void
200
+ def initialize(title: nil, subject: nil, creator: nil, keywords: nil, description: nil, last_modified_by: nil, revision: nil, created: nil, modified: nil, category: nil, content_status: nil, **_extra)
201
+ super(
202
+ title: title, subject: subject, creator: creator, keywords: keywords, description: description,
203
+ last_modified_by: last_modified_by, revision: revision, created: created, modified: modified,
204
+ category: category, content_status: content_status
205
+ )
206
+ end
207
+ end
208
+
209
+ # Application document properties (docProps/app.xml).
210
+ # @api public
211
+ AppProperties = Data.define(
212
+ :app_name, :app_version, :doc_security, :scale_crop, :heading_pairs,
213
+ :titles_of_parts, :manager, :company, :links_up_to_date, :shared_doc,
214
+ :hyperlink_base, :hyperlinks_changed
215
+ ) do
216
+ include MetadataRecord
217
+
218
+ #: (?app_name: String?, ?app_version: String?, ?doc_security: Integer?, ?scale_crop: bool?, ?heading_pairs: Array[untyped]?, ?titles_of_parts: Array[untyped]?, ?manager: String?, ?company: String?, ?links_up_to_date: bool?, ?shared_doc: bool?, ?hyperlink_base: String?, ?hyperlinks_changed: bool?, **untyped) -> void
219
+ def initialize(app_name: nil, app_version: nil, doc_security: nil, scale_crop: nil, heading_pairs: nil, titles_of_parts: nil, manager: nil, company: nil, links_up_to_date: nil, shared_doc: nil, hyperlink_base: nil, hyperlinks_changed: nil, **extra)
220
+ app_name ||= extra[:application]
221
+ super(
222
+ app_name: app_name, app_version: app_version, doc_security: doc_security, scale_crop: scale_crop,
223
+ heading_pairs: heading_pairs, titles_of_parts: titles_of_parts, manager: manager, company: company,
224
+ links_up_to_date: links_up_to_date, shared_doc: shared_doc, hyperlink_base: hyperlink_base,
225
+ hyperlinks_changed: hyperlinks_changed
226
+ )
227
+ end
228
+
229
+ # Returns whether scale and crop are enabled.
230
+ # @return [Boolean]
231
+ # @api public
232
+ #: () -> bool
233
+ def scale_crop?
234
+ scale_crop ? true : false
235
+ end
236
+
237
+ # Returns whether links are up to date.
238
+ # @return [Boolean]
239
+ # @api public
240
+ #: () -> bool
241
+ def links_up_to_date?
242
+ links_up_to_date ? true : false
243
+ end
244
+
245
+ # Returns whether the document is shared.
246
+ # @return [Boolean]
247
+ # @api public
248
+ #: () -> bool
249
+ def shared_doc?
250
+ shared_doc ? true : false
251
+ end
252
+
253
+ # Returns whether hyperlinks have changed.
254
+ # @return [Boolean]
255
+ # @api public
256
+ #: () -> bool
257
+ def hyperlinks_changed?
258
+ hyperlinks_changed ? true : false
259
+ end
260
+ end
261
+
262
+ # Workbook-level properties (<workbookPr> and <workbookView>).
263
+ # @api public
264
+ WorkbookProperties = Data.define(
265
+ :date1904, :code_name, :active_sheet, :first_sheet, :first_tab,
266
+ :show_sheet_tabs, :tab_ratio, :full_calc_on_load, :filter_privacy,
267
+ :default_theme_version, :refresh_all
268
+ ) do
269
+ include MetadataRecord
270
+
271
+ #: (?date1904: bool?, ?code_name: String?, ?active_sheet: Integer?, ?active_tab: Integer?, ?first_sheet: Integer?, ?first_tab: Integer?, ?show_sheet_tabs: bool?, ?tab_ratio: Integer?, ?full_calc_on_load: bool?, ?filter_privacy: bool?, ?default_theme_version: String?, ?refresh_all: bool?, **untyped) -> void
272
+ def initialize(date1904: nil, code_name: nil, active_sheet: nil, active_tab: nil, first_sheet: nil, first_tab: nil, show_sheet_tabs: nil, tab_ratio: nil, full_calc_on_load: nil, filter_privacy: nil, default_theme_version: nil, refresh_all: nil, **extra)
273
+ if (!active_tab.nil? || extra.key?(:active_tab)) && active_sheet.nil?
274
+ warn "[Xlsxrb DEPRECATION] WorkbookProperties.new(active_tab:) is deprecated and will be removed in v0.2.0. Use active_sheet: instead.", uplevel: 1
275
+ active_sheet = active_tab || extra[:active_tab]
276
+ end
277
+ ft = first_tab || first_sheet
278
+ super(
279
+ date1904: date1904, code_name: code_name, active_sheet: active_sheet, first_sheet: ft, first_tab: ft,
280
+ show_sheet_tabs: show_sheet_tabs, tab_ratio: tab_ratio, full_calc_on_load: full_calc_on_load,
281
+ filter_privacy: filter_privacy, default_theme_version: default_theme_version, refresh_all: refresh_all
282
+ )
283
+ end
284
+
285
+ undef_method :first_tab
286
+
287
+ # @deprecated Use {#first_sheet} instead.
288
+ # @return [Integer, nil]
289
+ # @api public
290
+ #: () -> Integer?
291
+ def first_tab
292
+ warn "[Xlsxrb DEPRECATION] WorkbookProperties#first_tab is deprecated; use #first_sheet instead.", uplevel: 1
293
+ first_sheet
294
+ end
295
+
296
+ # @deprecated Use {#active_sheet} instead.
297
+ # @return [Integer, nil]
298
+ # @api public
299
+ #: () -> Integer?
300
+ def active_tab
301
+ warn "[Xlsxrb DEPRECATION] WorkbookProperties#active_tab is deprecated and will be removed in v0.2.0. Use #active_sheet instead.", uplevel: 1
302
+ active_sheet
303
+ end
304
+
305
+ # Returns whether the 1904 date system is used.
306
+ # @return [Boolean]
307
+ # @api public
308
+ #: () -> bool
309
+ def date1904?
310
+ date1904 ? true : false
311
+ end
312
+
313
+ # Returns whether sheet tabs are shown in the workbook window.
314
+ # @return [Boolean]
315
+ # @api public
316
+ #: () -> bool
317
+ def show_sheet_tabs?
318
+ show_sheet_tabs != false
319
+ end
320
+
321
+ # Returns whether full calculation is performed when loading the workbook.
322
+ # @return [Boolean]
323
+ # @api public
324
+ #: () -> bool
325
+ def full_calc_on_load?
326
+ full_calc_on_load ? true : false
327
+ end
328
+
329
+ # Returns whether external data connections are refreshed when opening.
330
+ # @return [Boolean]
331
+ # @api public
332
+ #: () -> bool
333
+ def refresh_all?
334
+ refresh_all ? true : false
335
+ end
336
+
337
+ # Returns whether filter privacy is enabled.
338
+ # @return [Boolean]
339
+ # @api public
340
+ #: () -> bool
341
+ def filter_privacy?
342
+ filter_privacy ? true : false
343
+ end
344
+ end
345
+
346
+ # Workbook protection settings (<workbookProtection>).
347
+ # @api public
348
+ WorkbookProtection = Data.define(
349
+ :workbook_password, :lock_structure, :lock_windows, :revisions_password,
350
+ :lock_revision, :algorithm_name, :hash_value, :salt_value, :spin_count
351
+ ) do
352
+ include MetadataRecord
353
+
354
+ #: (?workbook_password: String?, ?lock_structure: bool?, ?lock_windows: bool?, ?revisions_password: String?, ?lock_revision: bool?, ?algorithm_name: String?, ?hash_value: String?, ?salt_value: String?, ?spin_count: Integer?, **untyped) -> void
355
+ def initialize(workbook_password: nil, lock_structure: nil, lock_windows: nil, revisions_password: nil, lock_revision: nil, algorithm_name: nil, hash_value: nil, salt_value: nil, spin_count: nil, **_extra)
356
+ super(
357
+ workbook_password: workbook_password, lock_structure: lock_structure, lock_windows: lock_windows,
358
+ revisions_password: revisions_password, lock_revision: lock_revision, algorithm_name: algorithm_name,
359
+ hash_value: hash_value, salt_value: salt_value, spin_count: spin_count
360
+ )
361
+ end
362
+
363
+ # Returns whether the workbook structure is locked.
364
+ # @return [Boolean]
365
+ # @api public
366
+ #: () -> bool
367
+ def lock_structure?
368
+ lock_structure ? true : false
369
+ end
370
+
371
+ # Returns whether workbook windows are locked.
372
+ # @return [Boolean]
373
+ # @api public
374
+ #: () -> bool
375
+ def lock_windows?
376
+ lock_windows ? true : false
377
+ end
378
+
379
+ # Returns whether workbook revisions are locked.
380
+ # @return [Boolean]
381
+ # @api public
382
+ #: () -> bool
383
+ def lock_revision?
384
+ lock_revision ? true : false
385
+ end
386
+ end
387
+
388
+ # Worksheet page setup properties (<pageSetup>).
389
+ # @api public
390
+ PageSetup = Data.define(
391
+ :paper_size, :orientation, :scale, :fit_to_width, :fit_to_height,
392
+ :first_page_number, :use_first_page_number, :black_and_white, :draft,
393
+ :cell_comments, :use_printer_defaults, :copies, :horizontal_centered,
394
+ :vertical_centered, :id
395
+ ) do
396
+ include MetadataRecord
397
+
398
+ #: (?paper_size: (Integer | String)?, ?orientation: (Symbol | String)?, ?scale: Integer?, ?fit_to_width: Integer?, ?fit_to_height: Integer?, ?first_page_number: Integer?, ?use_first_page_number: bool?, ?black_and_white: bool?, ?draft: bool?, ?cell_comments: String?, ?use_printer_defaults: bool?, ?copies: Integer?, ?horizontal_centered: bool?, ?vertical_centered: bool?, ?id: String?, **untyped) -> void
399
+ def initialize(paper_size: nil, orientation: nil, scale: nil, fit_to_width: nil, fit_to_height: nil, first_page_number: nil, use_first_page_number: nil, black_and_white: nil, draft: nil, cell_comments: nil, use_printer_defaults: nil, copies: nil, horizontal_centered: nil, vertical_centered: nil, id: nil, **_extra)
400
+ super(
401
+ paper_size: paper_size, orientation: orientation, scale: scale, fit_to_width: fit_to_width,
402
+ fit_to_height: fit_to_height, first_page_number: first_page_number, use_first_page_number: use_first_page_number,
403
+ black_and_white: black_and_white, draft: draft, cell_comments: cell_comments,
404
+ use_printer_defaults: use_printer_defaults, copies: copies, horizontal_centered: horizontal_centered,
405
+ vertical_centered: vertical_centered, id: id
406
+ )
407
+ end
408
+
409
+ # Returns whether black and white print mode is enabled.
410
+ # @return [Boolean]
411
+ # @api public
412
+ #: () -> bool
413
+ def black_and_white?
414
+ black_and_white ? true : false
415
+ end
416
+
417
+ # Returns whether draft print mode is enabled.
418
+ # @return [Boolean]
419
+ # @api public
420
+ #: () -> bool
421
+ def draft?
422
+ draft ? true : false
423
+ end
424
+
425
+ # Returns whether first page number is used.
426
+ # @return [Boolean]
427
+ # @api public
428
+ #: () -> bool
429
+ def use_first_page_number?
430
+ use_first_page_number ? true : false
431
+ end
432
+
433
+ # Returns whether printer defaults are used.
434
+ # @return [Boolean]
435
+ # @api public
436
+ #: () -> bool
437
+ def use_printer_defaults?
438
+ use_printer_defaults ? true : false
439
+ end
440
+
441
+ # Returns whether page is horizontally centered.
442
+ # @return [Boolean]
443
+ # @api public
444
+ #: () -> bool
445
+ def horizontal_centered?
446
+ horizontal_centered ? true : false
447
+ end
448
+
449
+ # Returns whether page is vertically centered.
450
+ # @return [Boolean]
451
+ # @api public
452
+ #: () -> bool
453
+ def vertical_centered?
454
+ vertical_centered ? true : false
455
+ end
456
+ end
457
+
458
+ # Worksheet page margins (<pageMargins>).
459
+ # @api public
460
+ PageMargins = Data.define(:left, :right, :top, :bottom, :header, :footer) do
461
+ include MetadataRecord
462
+
463
+ #: (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?, **untyped) -> void
464
+ def initialize(left: nil, right: nil, top: nil, bottom: nil, header: nil, footer: nil, **_extra)
465
+ super(left: left, right: right, top: top, bottom: bottom, header: header, footer: footer)
466
+ end
467
+ end
468
+
469
+ # Worksheet header and footer (<headerFooter>).
470
+ # @api public
471
+ HeaderFooter = Data.define(
472
+ :odd_header, :odd_footer, :even_header, :even_footer,
473
+ :first_header, :first_footer, :different_odd_even, :different_first,
474
+ :scale_with_doc, :align_with_margins
475
+ ) do
476
+ include MetadataRecord
477
+
478
+ #: (?odd_header: String?, ?odd_footer: String?, ?even_header: String?, ?even_footer: String?, ?first_header: String?, ?first_footer: String?, ?different_odd_even: bool?, ?different_first: bool?, ?scale_with_doc: bool?, ?align_with_margins: bool?, **untyped) -> void
479
+ def initialize(odd_header: nil, odd_footer: nil, even_header: nil, even_footer: nil, first_header: nil, first_footer: nil, different_odd_even: nil, different_first: nil, scale_with_doc: nil, align_with_margins: nil, **_extra)
480
+ super(
481
+ odd_header: odd_header, odd_footer: odd_footer, even_header: even_header,
482
+ even_footer: even_footer, first_header: first_header, first_footer: first_footer,
483
+ different_odd_even: different_odd_even, different_first: different_first,
484
+ scale_with_doc: scale_with_doc, align_with_margins: align_with_margins
485
+ )
486
+ end
487
+
488
+ # Returns whether different first page header/footer is enabled.
489
+ # @return [Boolean]
490
+ # @api public
491
+ #: () -> bool
492
+ def different_first?
493
+ different_first ? true : false
494
+ end
495
+
496
+ # Returns whether different odd and even page header/footer is enabled.
497
+ # @return [Boolean]
498
+ # @api public
499
+ #: () -> bool
500
+ def different_odd_even?
501
+ different_odd_even ? true : false
502
+ end
503
+
504
+ # Returns whether header and footer scale with document.
505
+ # @return [Boolean]
506
+ # @api public
507
+ #: () -> bool
508
+ def scale_with_doc?
509
+ scale_with_doc ? true : false
510
+ end
511
+
512
+ # Returns whether header and footer align with page margins.
513
+ # @return [Boolean]
514
+ # @api public
515
+ #: () -> bool
516
+ def align_with_margins?
517
+ align_with_margins ? true : false
518
+ end
519
+ end
520
+
521
+ # Worksheet print options (<printOptions>).
522
+ # @api public
523
+ PrintOptions = Data.define(:grid_lines, :grid_lines_set, :headings, :horizontal_centered, :vertical_centered) do
524
+ include MetadataRecord
525
+
526
+ #: (?grid_lines: bool?, ?grid_lines_set: bool?, ?headings: bool?, ?horizontal_centered: bool?, ?vertical_centered: bool?, **untyped) -> void
527
+ def initialize(grid_lines: nil, grid_lines_set: nil, headings: nil, horizontal_centered: nil, vertical_centered: nil, **_extra)
528
+ super(
529
+ grid_lines: grid_lines, grid_lines_set: grid_lines_set, headings: headings,
530
+ horizontal_centered: horizontal_centered, vertical_centered: vertical_centered
531
+ )
532
+ end
533
+
534
+ # Returns whether grid lines are printed.
535
+ # @return [Boolean]
536
+ # @api public
537
+ #: () -> bool
538
+ def grid_lines?
539
+ grid_lines ? true : false
540
+ end
541
+
542
+ # Returns whether the grid lines setting was explicitly set.
543
+ # @return [Boolean]
544
+ # @api public
545
+ #: () -> bool
546
+ def grid_lines_set?
547
+ grid_lines_set ? true : false
548
+ end
549
+
550
+ # Returns whether row and column headings are printed.
551
+ # @return [Boolean]
552
+ # @api public
553
+ #: () -> bool
554
+ def headings?
555
+ headings ? true : false
556
+ end
557
+
558
+ # Returns whether printing is centered horizontally.
559
+ # @return [Boolean]
560
+ # @api public
561
+ #: () -> bool
562
+ def horizontal_centered?
563
+ horizontal_centered ? true : false
564
+ end
565
+
566
+ # Returns whether printing is centered vertically.
567
+ # @return [Boolean]
568
+ # @api public
569
+ #: () -> bool
570
+ def vertical_centered?
571
+ vertical_centered ? true : false
572
+ end
573
+ end
574
+
575
+ # Worksheet repeating print titles.
576
+ # @api public
577
+ PrintTitles = Data.define(:rows, :columns, :cols) do
578
+ include MetadataRecord
579
+
580
+ #: (?rows: String?, ?columns: String?, ?cols: String?, **untyped) -> void
581
+ def initialize(rows: nil, columns: nil, cols: nil, **_extra)
582
+ c = columns || cols
583
+ super(rows: rows, columns: c, cols: c)
584
+ end
585
+
586
+ undef_method :cols
587
+
588
+ # @deprecated Use {#columns} instead.
589
+ # @return [String, nil]
590
+ # @api public
591
+ #: () -> String?
592
+ def cols
593
+ warn "[Xlsxrb DEPRECATION] PrintTitles#cols is deprecated; use #columns instead.", uplevel: 1
594
+ columns
595
+ end
596
+ end
597
+
598
+ # Worksheet freeze pane settings (<pane>).
599
+ # @api public
600
+ FreezePane = Data.define(:row, :column, :col, :top_row, :left_column, :active_pane, :state) do
601
+ include MetadataRecord
602
+
603
+ #: (?row: Integer?, ?column: (Integer | String | Symbol)?, ?col: (Integer | String | Symbol)?, ?top_row: Integer?, ?left_column: (Integer | String | Symbol)?, ?active_pane: String?, ?state: Symbol?, **untyped) -> void
604
+ def initialize(row: nil, column: nil, col: nil, top_row: nil, left_column: nil, active_pane: nil, state: :frozen, **_extra)
605
+ c = column || col
606
+ super(row: row, column: c, col: c, top_row: top_row, left_column: left_column, active_pane: active_pane, state: state || :frozen)
607
+ end
608
+
609
+ undef_method :col
610
+
611
+ # @deprecated Use {#column} instead.
612
+ # @return [Integer, String, Symbol, nil]
613
+ # @api public
614
+ #: () -> (Integer | String | Symbol)?
615
+ def col
616
+ warn "[Xlsxrb DEPRECATION] FreezePane#col is deprecated; use #column instead.", uplevel: 1
617
+ column
618
+ end
619
+ end
620
+
621
+ # Worksheet split pane settings (<pane>).
622
+ # @api public
623
+ SplitPane = Data.define(:x_split, :y_split, :top_row, :left_column, :active_pane, :state) do
624
+ include MetadataRecord
625
+
626
+ #: (?x_split: (Integer | Float)?, ?y_split: (Integer | Float)?, ?top_row: Integer?, ?left_column: Integer?, ?active_pane: String?, ?state: String?, **untyped) -> void
627
+ def initialize(x_split: nil, y_split: nil, top_row: nil, left_column: nil, active_pane: nil, state: nil, **_extra)
628
+ super(x_split: x_split, y_split: y_split, top_row: top_row, left_column: left_column, active_pane: active_pane, state: state)
629
+ end
630
+ end
631
+
632
+ # Worksheet selection / active cell (<selection>).
633
+ # @api public
634
+ Selection = Data.define(:pane, :active_cell, :active_cell_id, :sqref) do
635
+ include MetadataRecord
636
+
637
+ #: (?pane: String?, ?active_cell: String?, ?active_cell_id: Integer?, ?sqref: String?, **untyped) -> void
638
+ def initialize(pane: nil, active_cell: nil, active_cell_id: nil, sqref: nil, **_extra)
639
+ super(pane: pane, active_cell: active_cell, active_cell_id: active_cell_id, sqref: sqref)
640
+ end
641
+ end
642
+
643
+ # Worksheet protection options (<sheetProtection>).
644
+ # @api public
645
+ SheetProtection = Data.define(
646
+ :password, :sheet, :objects, :scenarios, :format_cells, :format_columns,
647
+ :format_rows, :insert_columns, :insert_rows, :insert_hyperlinks, :delete_columns,
648
+ :delete_rows, :select_locked_cells, :select_unlocked_cells, :sort, :auto_filter,
649
+ :pivot_tables, :algorithm_name, :hash_value, :salt_value, :spin_count
650
+ ) do
651
+ include MetadataRecord
652
+
653
+ #: (?password: String?, ?sheet: bool?, ?objects: bool?, ?scenarios: bool?, ?format_cells: bool?, ?format_columns: bool?, ?format_rows: bool?, ?insert_columns: bool?, ?insert_rows: bool?, ?insert_hyperlinks: bool?, ?delete_columns: bool?, ?delete_rows: bool?, ?select_locked_cells: bool?, ?select_unlocked_cells: bool?, ?sort: bool?, ?auto_filter: bool?, ?pivot_tables: bool?, ?algorithm_name: String?, ?hash_value: String?, ?salt_value: String?, ?spin_count: Integer?, **untyped) -> void
654
+ def initialize(password: nil, sheet: nil, objects: nil, scenarios: nil, format_cells: nil, format_columns: nil, format_rows: nil, insert_columns: nil, insert_rows: nil, insert_hyperlinks: nil, delete_columns: nil, delete_rows: nil, select_locked_cells: nil, select_unlocked_cells: nil, sort: nil, auto_filter: nil, pivot_tables: nil, algorithm_name: nil, hash_value: nil, salt_value: nil, spin_count: nil, **_extra)
655
+ super(
656
+ password: password, sheet: sheet, objects: objects, scenarios: scenarios,
657
+ format_cells: format_cells, format_columns: format_columns, format_rows: format_rows,
658
+ insert_columns: insert_columns, insert_rows: insert_rows, insert_hyperlinks: insert_hyperlinks,
659
+ delete_columns: delete_columns, delete_rows: delete_rows, select_locked_cells: select_locked_cells,
660
+ select_unlocked_cells: select_unlocked_cells, sort: sort, auto_filter: auto_filter,
661
+ pivot_tables: pivot_tables, algorithm_name: algorithm_name, hash_value: hash_value,
662
+ salt_value: salt_value, spin_count: spin_count
663
+ )
664
+ end
665
+
666
+ # Returns whether worksheet protection is enabled.
667
+ # @return [Boolean]
668
+ # @api public
669
+ #: () -> bool
670
+ def sheet?
671
+ sheet ? true : false
672
+ end
673
+
674
+ # Returns whether objects are protected.
675
+ # @return [Boolean]
676
+ # @api public
677
+ #: () -> bool
678
+ def objects?
679
+ objects ? true : false
680
+ end
681
+
682
+ # Returns whether scenarios are protected.
683
+ # @return [Boolean]
684
+ # @api public
685
+ #: () -> bool
686
+ def scenarios?
687
+ scenarios ? true : false
688
+ end
689
+
690
+ # Returns whether formatting cells is locked/protected.
691
+ # @return [Boolean]
692
+ # @api public
693
+ #: () -> bool
694
+ def format_cells?
695
+ format_cells ? true : false
696
+ end
697
+
698
+ # Returns whether formatting columns is locked/protected.
699
+ # @return [Boolean]
700
+ # @api public
701
+ #: () -> bool
702
+ def format_columns?
703
+ format_columns ? true : false
704
+ end
705
+
706
+ # Returns whether formatting rows is locked/protected.
707
+ # @return [Boolean]
708
+ # @api public
709
+ #: () -> bool
710
+ def format_rows?
711
+ format_rows ? true : false
712
+ end
713
+
714
+ # Returns whether inserting columns is locked/protected.
715
+ # @return [Boolean]
716
+ # @api public
717
+ #: () -> bool
718
+ def insert_columns?
719
+ insert_columns ? true : false
720
+ end
721
+
722
+ # Returns whether inserting rows is locked/protected.
723
+ # @return [Boolean]
724
+ # @api public
725
+ #: () -> bool
726
+ def insert_rows?
727
+ insert_rows ? true : false
728
+ end
729
+
730
+ # Returns whether inserting hyperlinks is locked/protected.
731
+ # @return [Boolean]
732
+ # @api public
733
+ #: () -> bool
734
+ def insert_hyperlinks?
735
+ insert_hyperlinks ? true : false
736
+ end
737
+
738
+ # Returns whether deleting columns is locked/protected.
739
+ # @return [Boolean]
740
+ # @api public
741
+ #: () -> bool
742
+ def delete_columns?
743
+ delete_columns ? true : false
744
+ end
745
+
746
+ # Returns whether deleting rows is locked/protected.
747
+ # @return [Boolean]
748
+ # @api public
749
+ #: () -> bool
750
+ def delete_rows?
751
+ delete_rows ? true : false
752
+ end
753
+
754
+ # Returns whether selecting locked cells is allowed/protected.
755
+ # @return [Boolean]
756
+ # @api public
757
+ #: () -> bool
758
+ def select_locked_cells?
759
+ select_locked_cells ? true : false
760
+ end
761
+
762
+ # Returns whether selecting unlocked cells is allowed/protected.
763
+ # @return [Boolean]
764
+ # @api public
765
+ #: () -> bool
766
+ def select_unlocked_cells?
767
+ select_unlocked_cells ? true : false
768
+ end
769
+
770
+ # Returns whether sorting is locked/protected.
771
+ # @return [Boolean]
772
+ # @api public
773
+ #: () -> bool
774
+ def sort?
775
+ sort ? true : false
776
+ end
777
+
778
+ # Returns whether auto filtering is locked/protected.
779
+ # @return [Boolean]
780
+ # @api public
781
+ #: () -> bool
782
+ def auto_filter?
783
+ auto_filter ? true : false
784
+ end
785
+
786
+ # Returns whether pivot tables are locked/protected.
787
+ # @return [Boolean]
788
+ # @api public
789
+ #: () -> bool
790
+ def pivot_tables?
791
+ pivot_tables ? true : false
792
+ end
793
+ end
794
+
795
+ # Worksheet properties (<sheetPr>).
796
+ # @api public
797
+ SheetProperties = Data.define(
798
+ :tab_color, :filter_mode, :enable_format_conditions_calculation, :outline_pr, :page_setup_properties,
799
+ :code_name, :fit_to_page, :full_calc_on_load, :tab_color_theme, :tab_color_tint, :tab_color_indexed,
800
+ :tab_color_auto, :outline_properties, :auto_page_breaks, :sync_horizontal, :sync_vertical, :sync_ref,
801
+ :transition_evaluation, :transition_entry, :published,
802
+ :apply_styles, :summary_below, :summary_right, :show_outline_symbols
803
+ ) do
804
+ include MetadataRecord
805
+
806
+ #: (?tab_color: String?, ?filter_mode: bool?, ?enable_format_conditions_calculation: bool?, ?outline_pr: Hash[Symbol, untyped]?, ?page_setup_properties: Hash[Symbol, untyped]?, ?code_name: String?, ?fit_to_page: bool?, ?full_calc_on_load: bool?, ?tab_color_theme: Integer?, ?tab_color_tint: Float?, ?tab_color_indexed: Integer?, ?tab_color_auto: bool?, ?outline_properties: Hash[Symbol, untyped]?, ?auto_page_breaks: bool?, ?sync_horizontal: bool?, ?sync_vertical: bool?, ?sync_ref: String?, ?transition_evaluation: bool?, ?transition_entry: bool?, ?published: bool?, ?apply_styles: bool?, ?summary_below: bool?, ?summary_right: bool?, ?show_outline_symbols: bool?, **untyped) -> void
807
+ def initialize(tab_color: nil, filter_mode: nil, enable_format_conditions_calculation: nil, outline_pr: nil, page_setup_properties: nil, page_setup_pr: nil, code_name: nil, fit_to_page: nil, full_calc_on_load: nil, tab_color_theme: nil, tab_color_tint: nil, tab_color_indexed: nil, tab_color_auto: nil, outline_properties: nil, auto_page_breaks: nil, sync_horizontal: nil, sync_vertical: nil, sync_ref: nil, transition_evaluation: nil, transition_entry: nil, published: nil, apply_styles: nil, summary_below: nil, summary_right: nil, show_outline_symbols: nil, **extra)
808
+ psp = page_setup_properties
809
+ if (page_setup_pr || extra.key?(:page_setup_pr) || extra.key?("page_setup_pr")) && psp.nil?
810
+ Xlsxrb::Deprecation.warn("SheetProperties keyword :page_setup_pr is deprecated; use :page_setup_properties instead.", uplevel: 1)
811
+ psp = page_setup_pr || extra[:page_setup_pr] || extra["page_setup_pr"]
812
+ end
813
+ out_pr = outline_properties || outline_pr || {}
814
+ app_st = apply_styles.nil? ? (out_pr[:apply_styles] || extra[:apply_styles]) : apply_styles
815
+ sum_b = summary_below.nil? ? (out_pr[:summary_below] || extra[:summary_below]) : summary_below
816
+ sum_r = summary_right.nil? ? (out_pr[:summary_right] || extra[:summary_right]) : summary_right
817
+ show_sym = show_outline_symbols.nil? ? (out_pr[:show_outline_symbols] || out_pr[:show_symbols] || extra[:show_outline_symbols] || extra[:show_symbols]) : show_outline_symbols
818
+ super(
819
+ tab_color: tab_color, filter_mode: filter_mode,
820
+ enable_format_conditions_calculation: enable_format_conditions_calculation,
821
+ outline_pr: outline_pr, page_setup_properties: psp,
822
+ code_name: code_name, fit_to_page: fit_to_page, full_calc_on_load: full_calc_on_load,
823
+ tab_color_theme: tab_color_theme, tab_color_tint: tab_color_tint, tab_color_indexed: tab_color_indexed,
824
+ tab_color_auto: tab_color_auto, outline_properties: outline_properties, auto_page_breaks: auto_page_breaks,
825
+ sync_horizontal: sync_horizontal, sync_vertical: sync_vertical, sync_ref: sync_ref,
826
+ transition_evaluation: transition_evaluation, transition_entry: transition_entry, published: published,
827
+ apply_styles: app_st, summary_below: sum_b, summary_right: sum_r, show_outline_symbols: show_sym
828
+ )
829
+ end
830
+
831
+ # @deprecated Use {#page_setup_properties} instead. Will be removed in 0.2.0.
832
+ def page_setup_pr
833
+ Xlsxrb::Deprecation.warn("SheetProperties#page_setup_pr is deprecated; use SheetProperties#page_setup_properties instead.", uplevel: 1)
834
+ page_setup_properties
835
+ end
836
+
837
+ undef_method :outline_pr
838
+
839
+ # @deprecated Use {#outline_properties} instead.
840
+ # @return [Hash{Symbol => untyped}, nil]
841
+ # @api public
842
+ #: () -> Hash[Symbol, untyped]?
843
+ def outline_pr
844
+ warn "[Xlsxrb DEPRECATION] SheetProperties#outline_pr is deprecated; use #outline_properties instead.", uplevel: 1
845
+ outline_properties
846
+ end
847
+
848
+ # Returns whether filter mode is enabled.
849
+ # @return [Boolean]
850
+ # @api public
851
+ #: () -> bool
852
+ def filter_mode?
853
+ filter_mode ? true : false
854
+ end
855
+
856
+ # Returns whether format conditions calculation is enabled.
857
+ # @return [Boolean]
858
+ # @api public
859
+ #: () -> bool
860
+ def enable_format_conditions_calculation?
861
+ enable_format_conditions_calculation ? true : false
862
+ end
863
+
864
+ # Returns whether full calc on load is enabled.
865
+ # @return [Boolean]
866
+ # @api public
867
+ #: () -> bool
868
+ def full_calc_on_load?
869
+ full_calc_on_load ? true : false
870
+ end
871
+
872
+ # Returns whether tab color is set to automatic.
873
+ # @return [Boolean]
874
+ # @api public
875
+ #: () -> bool
876
+ def tab_color_auto?
877
+ tab_color_auto ? true : false
878
+ end
879
+
880
+ # Returns whether automatic page breaks are enabled.
881
+ # @return [Boolean]
882
+ # @api public
883
+ #: () -> bool
884
+ def auto_page_breaks?
885
+ auto_page_breaks ? true : false
886
+ end
887
+
888
+ # Returns whether horizontal scrolling is synced.
889
+ # @return [Boolean]
890
+ # @api public
891
+ #: () -> bool
892
+ def sync_horizontal?
893
+ sync_horizontal ? true : false
894
+ end
895
+
896
+ # Returns whether vertical scrolling is synced.
897
+ # @return [Boolean]
898
+ # @api public
899
+ #: () -> bool
900
+ def sync_vertical?
901
+ sync_vertical ? true : false
902
+ end
903
+
904
+ # Returns whether transition evaluation is enabled.
905
+ # @return [Boolean]
906
+ # @api public
907
+ #: () -> bool
908
+ def transition_evaluation?
909
+ transition_evaluation ? true : false
910
+ end
911
+
912
+ # Returns whether transition entry is enabled.
913
+ # @return [Boolean]
914
+ # @api public
915
+ #: () -> bool
916
+ def transition_entry?
917
+ transition_entry ? true : false
918
+ end
919
+
920
+ # Returns whether sheet is published.
921
+ # @return [Boolean]
922
+ # @api public
923
+ #: () -> bool
924
+ def published?
925
+ published ? true : false
926
+ end
927
+
928
+ # Returns whether fit to page is enabled.
929
+ # @return [Boolean]
930
+ # @api public
931
+ #: () -> bool
932
+ def fit_to_page?
933
+ fit_to_page ? true : false
934
+ end
935
+
936
+ # Returns whether outline styles are applied.
937
+ # @return [Boolean]
938
+ # @api public
939
+ #: () -> bool
940
+ def apply_styles?
941
+ apply_styles ? true : false
942
+ end
943
+
944
+ # Returns whether summary rows appear below detail rows.
945
+ # @return [Boolean]
946
+ # @api public
947
+ #: () -> bool
948
+ def summary_below?
949
+ summary_below ? true : false
950
+ end
951
+
952
+ # Returns whether summary columns appear to the right of detail columns.
953
+ # @return [Boolean]
954
+ # @api public
955
+ #: () -> bool
956
+ def summary_right?
957
+ summary_right ? true : false
958
+ end
959
+
960
+ # Returns whether outline symbols are shown.
961
+ # @return [Boolean]
962
+ # @api public
963
+ #: () -> bool
964
+ def show_outline_symbols?
965
+ show_outline_symbols ? true : false
966
+ end
967
+ end
968
+
969
+ # Worksheet format properties (<sheetFormatPr>).
970
+ # @api public
971
+ SheetFormat = Data.define(
972
+ :default_row_height, :default_column_width, :custom_height, :zero_height,
973
+ :thick_top, :thick_bottom, :outline_level_row, :outline_level_column, :base_column_width
974
+ ) do
975
+ include MetadataRecord
976
+
977
+ #: (?default_row_height: (Float | Integer)?, ?default_column_width: (Float | Integer)?, ?custom_height: bool?, ?zero_height: bool?, ?thick_top: bool?, ?thick_bottom: bool?, ?outline_level_row: Integer?, ?outline_level_column: Integer?, ?base_column_width: (Float | Integer)?, **untyped) -> void
978
+ def initialize(default_row_height: nil, default_column_width: nil, custom_height: nil, zero_height: nil, thick_top: nil, thick_bottom: nil, outline_level_row: nil, outline_level_column: nil, base_column_width: nil, **extra)
979
+ default_column_width ||= extra[:default_col_width]
980
+ outline_level_column ||= extra[:outline_level_col]
981
+ base_column_width ||= extra[:base_col_width]
982
+ super(
983
+ default_row_height: default_row_height, default_column_width: default_column_width,
984
+ custom_height: custom_height, zero_height: zero_height, thick_top: thick_top,
985
+ thick_bottom: thick_bottom, outline_level_row: outline_level_row,
986
+ outline_level_column: outline_level_column, base_column_width: base_column_width
987
+ )
988
+ end
989
+
990
+ # @deprecated Use {#default_column_width} instead.
991
+ # @return [Float, Integer, nil]
992
+ # @api public
993
+ #: () -> (Float | Integer)?
994
+ def default_col_width
995
+ warn "[Xlsxrb DEPRECATION] SheetFormat#default_col_width is deprecated; use #default_column_width instead.", uplevel: 1
996
+ default_column_width
997
+ end
998
+
999
+ # @deprecated Use {#outline_level_column} instead.
1000
+ # @return [Integer, nil]
1001
+ # @api public
1002
+ #: () -> Integer?
1003
+ def outline_level_col
1004
+ warn "[Xlsxrb DEPRECATION] SheetFormat#outline_level_col is deprecated; use #outline_level_column instead.", uplevel: 1
1005
+ outline_level_column
1006
+ end
1007
+
1008
+ # @deprecated Use {#base_column_width} instead.
1009
+ # @return [Float, Integer, nil]
1010
+ # @api public
1011
+ #: () -> (Float | Integer)?
1012
+ def base_col_width
1013
+ warn "[Xlsxrb DEPRECATION] SheetFormat#base_col_width is deprecated; use #base_column_width instead.", uplevel: 1
1014
+ base_column_width
1015
+ end
1016
+
1017
+ # Returns whether custom row height is set.
1018
+ # @return [Boolean]
1019
+ # @api public
1020
+ #: () -> bool
1021
+ def custom_height?
1022
+ custom_height ? true : false
1023
+ end
1024
+
1025
+ # Returns whether zero row height is enabled.
1026
+ # @return [Boolean]
1027
+ # @api public
1028
+ #: () -> bool
1029
+ def zero_height?
1030
+ zero_height ? true : false
1031
+ end
1032
+
1033
+ # Returns whether thick top border is enabled.
1034
+ # @return [Boolean]
1035
+ # @api public
1036
+ #: () -> bool
1037
+ def thick_top?
1038
+ thick_top ? true : false
1039
+ end
1040
+
1041
+ # Returns whether thick bottom border is enabled.
1042
+ # @return [Boolean]
1043
+ # @api public
1044
+ #: () -> bool
1045
+ def thick_bottom?
1046
+ thick_bottom ? true : false
1047
+ end
1048
+ end
1049
+
1050
+ # Worksheet view configuration (<sheetView>).
1051
+ # @api public
1052
+ SheetView = Data.define(
1053
+ :workbook_view_id, :show_grid_lines, :show_row_col_headers, :show_ruler,
1054
+ :show_zeros, :right_to_left, :tab_selected, :zoom_scale, :zoom_scale_normal,
1055
+ :zoom_scale_page_layout_view, :zoom_scale_sheet_layout_view, :view,
1056
+ :window_protection, :show_formulas, :show_outline_symbols, :default_grid_color, :show_white_space,
1057
+ :top_left_cell, :color_id
1058
+ ) do
1059
+ include MetadataRecord
1060
+
1061
+ #: (?workbook_view_id: Integer?, ?show_grid_lines: bool?, ?show_row_col_headers: bool?, ?show_ruler: bool?, ?show_zeros: bool?, ?right_to_left: bool?, ?tab_selected: bool?, ?zoom_scale: Integer?, ?zoom_scale_normal: Integer?, ?zoom_scale_page_layout_view: Integer?, ?zoom_scale_sheet_layout_view: Integer?, ?view: String?, ?window_protection: bool?, ?show_formulas: bool?, ?show_outline_symbols: bool?, ?default_grid_color: bool?, ?show_white_space: bool?, ?top_left_cell: String?, ?color_id: Integer?, **untyped) -> void
1062
+ def initialize(
1063
+ workbook_view_id: nil, show_grid_lines: nil, show_row_col_headers: nil, show_ruler: nil,
1064
+ show_zeros: nil, right_to_left: nil, tab_selected: nil, zoom_scale: nil, zoom_scale_normal: nil,
1065
+ zoom_scale_page_layout_view: nil, zoom_scale_sheet_layout_view: nil, view: nil,
1066
+ window_protection: nil, show_formulas: nil, show_outline_symbols: nil, default_grid_color: nil, show_white_space: nil,
1067
+ top_left_cell: nil, color_id: nil, **_extra
1068
+ )
1069
+ super(
1070
+ workbook_view_id: workbook_view_id, show_grid_lines: show_grid_lines,
1071
+ show_row_col_headers: show_row_col_headers, show_ruler: show_ruler,
1072
+ show_zeros: show_zeros, right_to_left: right_to_left, tab_selected: tab_selected,
1073
+ zoom_scale: zoom_scale, zoom_scale_normal: zoom_scale_normal,
1074
+ zoom_scale_page_layout_view: zoom_scale_page_layout_view,
1075
+ zoom_scale_sheet_layout_view: zoom_scale_sheet_layout_view, view: view,
1076
+ window_protection: window_protection, show_formulas: show_formulas,
1077
+ show_outline_symbols: show_outline_symbols, default_grid_color: default_grid_color,
1078
+ show_white_space: show_white_space, top_left_cell: top_left_cell, color_id: color_id
1079
+ )
1080
+ end
1081
+
1082
+ # Returns whether window protection is enabled.
1083
+ # @return [Boolean]
1084
+ # @api public
1085
+ #: () -> bool
1086
+ def window_protection?
1087
+ window_protection ? true : false
1088
+ end
1089
+
1090
+ # Returns whether formulas are displayed instead of calculated values.
1091
+ # @return [Boolean]
1092
+ # @api public
1093
+ #: () -> bool
1094
+ def show_formulas?
1095
+ show_formulas ? true : false
1096
+ end
1097
+
1098
+ # Returns whether grid lines are shown in the view.
1099
+ # @return [Boolean]
1100
+ # @api public
1101
+ #: () -> bool
1102
+ def show_grid_lines?
1103
+ show_grid_lines ? true : false
1104
+ end
1105
+
1106
+ # Returns whether row and column headers are shown.
1107
+ # @return [Boolean]
1108
+ # @api public
1109
+ #: () -> bool
1110
+ def show_row_col_headers?
1111
+ show_row_col_headers ? true : false
1112
+ end
1113
+
1114
+ # Returns whether zero values are displayed.
1115
+ # @return [Boolean]
1116
+ # @api public
1117
+ #: () -> bool
1118
+ def show_zeros?
1119
+ show_zeros ? true : false
1120
+ end
1121
+
1122
+ # Returns whether right-to-left layout is enabled.
1123
+ # @return [Boolean]
1124
+ # @api public
1125
+ #: () -> bool
1126
+ def right_to_left?
1127
+ right_to_left ? true : false
1128
+ end
1129
+
1130
+ # Returns whether this sheet tab is selected.
1131
+ # @return [Boolean]
1132
+ # @api public
1133
+ #: () -> bool
1134
+ def tab_selected?
1135
+ tab_selected ? true : false
1136
+ end
1137
+
1138
+ # Returns whether the ruler is shown in page layout view.
1139
+ # @return [Boolean]
1140
+ # @api public
1141
+ #: () -> bool
1142
+ def show_ruler?
1143
+ show_ruler ? true : false
1144
+ end
1145
+
1146
+ # Returns whether outline symbols are shown.
1147
+ # @return [Boolean]
1148
+ # @api public
1149
+ #: () -> bool
1150
+ def show_outline_symbols?
1151
+ show_outline_symbols ? true : false
1152
+ end
1153
+
1154
+ # Returns whether the default grid line color is used.
1155
+ # @return [Boolean]
1156
+ # @api public
1157
+ #: () -> bool
1158
+ def default_grid_color?
1159
+ default_grid_color ? true : false
1160
+ end
1161
+
1162
+ # Returns whether white space is displayed in page layout view.
1163
+ # @return [Boolean]
1164
+ # @api public
1165
+ #: () -> bool
1166
+ def show_white_space?
1167
+ show_white_space ? true : false
1168
+ end
1169
+ end
1170
+
1171
+ # Phonetic text properties (<phoneticPr>).
1172
+ # @api public
1173
+ PhoneticProperties = Data.define(:font_id, :type, :alignment) do
1174
+ include MetadataRecord
1175
+
1176
+ #: (?font_id: Integer?, ?type: String?, ?alignment: String?, **untyped) -> void
1177
+ def initialize(font_id: nil, type: nil, alignment: nil, **_extra)
1178
+ super(font_id: font_id, type: type, alignment: alignment)
1179
+ end
1180
+ end
1181
+
1182
+ # Worksheet calculation properties (<sheetCalcPr>).
1183
+ # @api public
1184
+ SheetCalcProperties = Data.define(:full_calc_on_load) do
1185
+ include MetadataRecord
1186
+
1187
+ #: (?full_calc_on_load: bool?, **untyped) -> void
1188
+ def initialize(full_calc_on_load: nil, **_extra)
1189
+ super(full_calc_on_load: full_calc_on_load)
1190
+ end
1191
+
1192
+ # Returns whether full calculation is performed on load.
1193
+ # @return [Boolean]
1194
+ # @api public
1195
+ #: () -> bool
1196
+ def full_calc_on_load?
1197
+ full_calc_on_load ? true : false
1198
+ end
1199
+ end
1200
+
1201
+ # Sort state configuration (<sortState>).
1202
+ # @api public
1203
+ SortState = Data.define(:ref, :case_sensitive, :sort_method, :conditions) do
1204
+ include MetadataRecord
1205
+
1206
+ #: (?ref: String?, ?case_sensitive: bool?, ?sort_method: String?, ?conditions: Array[Hash[Symbol, untyped]]?, **untyped) -> void
1207
+ def initialize(ref: nil, case_sensitive: nil, sort_method: nil, conditions: nil, **_extra)
1208
+ super(ref: ref, case_sensitive: case_sensitive, sort_method: sort_method, conditions: conditions)
1209
+ end
1210
+
1211
+ # Returns whether sorting is case sensitive.
1212
+ # @return [Boolean]
1213
+ # @api public
1214
+ #: () -> bool
1215
+ def case_sensitive?
1216
+ case_sensitive ? true : false
1217
+ end
1218
+ end
1219
+
1220
+ # Worksheet background image (<picture>).
1221
+ # @api public
1222
+ BackgroundImage = Data.define(:r_id, :rel_id, :path, :extension, :data, :ext, :filename, :content_type) do
1223
+ include MetadataRecord
1224
+
1225
+ #: (?r_id: String?, ?rel_id: String?, ?path: String?, ?extension: String?, ?data: String?, ?ext: String?, ?filename: String?, ?content_type: String?, **untyped) -> void
1226
+ def initialize(r_id: nil, rel_id: nil, path: nil, extension: nil, data: nil, ext: nil, filename: nil, content_type: nil, **extra)
1227
+ rid = r_id || rel_id
1228
+ e = extension || ext || extra[:ext]
1229
+ d = data || extra[:file_data]
1230
+ p = path || filename
1231
+ super(r_id: rid, rel_id: rid, path: p, extension: e, data: d, ext: e, filename: p, content_type: content_type)
1232
+ end
1233
+
1234
+ undef_method :rel_id
1235
+ undef_method :ext
1236
+ undef_method :filename
1237
+
1238
+ # @deprecated Use {#r_id} instead.
1239
+ # @return [String, nil]
1240
+ # @api public
1241
+ #: () -> String?
1242
+ def rel_id
1243
+ warn "[Xlsxrb DEPRECATION] BackgroundImage#rel_id is deprecated; use #r_id instead.", uplevel: 1
1244
+ r_id
1245
+ end
1246
+
1247
+ # @deprecated Use {#extension} instead.
1248
+ # @return [String, nil]
1249
+ # @api public
1250
+ #: () -> String?
1251
+ def ext
1252
+ warn "[Xlsxrb DEPRECATION] BackgroundImage#ext is deprecated; use #extension instead.", uplevel: 1
1253
+ extension
1254
+ end
1255
+
1256
+ # @deprecated Use {#path} instead.
1257
+ # @return [String, nil]
1258
+ # @api public
1259
+ #: () -> String?
1260
+ def filename
1261
+ warn "[Xlsxrb DEPRECATION] BackgroundImage#filename is deprecated; use #path instead.", uplevel: 1
1262
+ path
1263
+ end
1264
+ end
1265
+
1266
+ # Table styles configuration in stylesheet (<tableStyles>).
1267
+ # @api public
1268
+ TableStyles = Data.define(:default_table_style, :default_pivot_style, :styles) do
1269
+ include MetadataRecord
1270
+
1271
+ #: (?default_table_style: String?, ?default_pivot_style: String?, ?styles: Array[Hash[Symbol, untyped]]?, **untyped) -> void
1272
+ def initialize(default_table_style: nil, default_pivot_style: nil, styles: nil, **_extra)
1273
+ super(default_table_style: default_table_style, default_pivot_style: default_pivot_style, styles: styles)
1274
+ end
1275
+ end
1276
+
1277
+ # Colors palette configuration in stylesheet (<colors>).
1278
+ # @api public
1279
+ Colors = Data.define(:indexed, :mru) do
1280
+ include MetadataRecord
1281
+
1282
+ #: (?indexed: Array[String]?, ?mru: Array[Hash[Symbol, untyped]]?, **untyped) -> void
1283
+ def initialize(indexed: nil, mru: nil, **_extra)
1284
+ super(indexed: indexed, mru: mru)
1285
+ end
1286
+ end
1287
+
1288
+ # User-defined custom document property (<property>).
1289
+ # @api public
1290
+ CustomProperty = Data.define(:name, :value, :type) do
1291
+ include MetadataRecord
1292
+
1293
+ #: (?name: String?, ?value: untyped, ?type: Symbol?, **untyped) -> void
1294
+ def initialize(name: nil, value: nil, type: nil, **_extra)
1295
+ super(name: name, value: value, type: type)
1296
+ end
1297
+
1298
+ # @return [String]
1299
+ # @api public
1300
+ #: () -> String
1301
+ def to_s
1302
+ value.to_s
1303
+ end
1304
+
1305
+ # Matches against scalar values or hashes.
1306
+ #: (untyped other) -> bool
1307
+ def ==(other)
1308
+ if other.is_a?(CustomProperty)
1309
+ super
1310
+ elsif other.is_a?(Hash)
1311
+ warn "[Xlsxrb DEPRECATION] Comparing CustomProperty with Hash is deprecated; compare with CustomProperty instead.", uplevel: 1
1312
+ to_h == other.transform_keys(&:to_sym).compact
1313
+ else
1314
+ value == other
1315
+ end
1316
+ end
1317
+ end
1318
+
1319
+ # AutoFilter column configuration (<filterColumn>).
1320
+ # @api public
1321
+ FilterColumn = Data.define(:column_id, :filters, :custom_filters, :dynamic_filter, :top10, :color_filter, :icon_filter, :hidden, :show_button) do
1322
+ include MetadataRecord
1323
+
1324
+ #: (?column_id: Integer?, ?col_id: Integer?, ?filters: Array[untyped]?, ?custom_filters: Array[untyped]?, ?dynamic_filter: Hash[Symbol, untyped]?, ?top10: Hash[Symbol, untyped]?, ?color_filter: Hash[Symbol, untyped]?, ?icon_filter: Hash[Symbol, untyped]?, ?hidden: bool?, ?show_button: bool?, ?hidden_button: bool?, **untyped) -> void
1325
+ def initialize(column_id: nil, col_id: nil, filters: nil, custom_filters: nil, dynamic_filter: nil, top10: nil, color_filter: nil, icon_filter: nil, hidden: false, show_button: true, hidden_button: nil, **extra)
1326
+ if (!col_id.nil? || extra.key?(:col_id)) && column_id.nil?
1327
+ warn "[Xlsxrb DEPRECATION] FilterColumn.new(col_id:) is deprecated and will be removed in v0.2.0. Use column_id: instead.", uplevel: 1
1328
+ column_id = col_id || extra[:col_id]
1329
+ end
1330
+ h = hidden || hidden_button || false
1331
+ super(column_id: column_id, filters: filters, custom_filters: custom_filters, dynamic_filter: dynamic_filter, top10: top10, color_filter: color_filter, icon_filter: icon_filter, hidden: h, show_button: show_button)
1332
+ end
1333
+
1334
+ # @deprecated Use {#column_id} instead.
1335
+ # @return [Integer, nil]
1336
+ # @api public
1337
+ #: () -> Integer?
1338
+ def col_id
1339
+ warn "[Xlsxrb DEPRECATION] FilterColumn#col_id is deprecated and will be removed in v0.2.0. Use #column_id instead.", uplevel: 1
1340
+ column_id
1341
+ end
1342
+
1343
+ # Returns whether the filter column is hidden.
1344
+ # @return [Boolean]
1345
+ # @api public
1346
+ #: () -> bool
1347
+ def hidden?
1348
+ hidden ? true : false
1349
+ end
1350
+
1351
+ # Returns whether the filter dropdown button is shown.
1352
+ # @return [Boolean]
1353
+ # @api public
1354
+ #: () -> bool
1355
+ def show_button?
1356
+ show_button ? true : false
1357
+ end
1358
+ end
1359
+
1360
+ # Workbook defined name (<definedName>).
1361
+ # @api public
1362
+ DefinedName = Data.define(:name, :value, :local_sheet_id, :local_sheet_name, :hidden, :comment) do
1363
+ include MetadataRecord
1364
+
1365
+ #: (?name: String?, ?value: String?, ?local_sheet_id: Integer?, ?local_sheet_name: String?, ?hidden: bool?, ?comment: String?, **untyped) -> void
1366
+ def initialize(name: nil, value: nil, local_sheet_id: nil, local_sheet_name: nil, hidden: nil, comment: nil, **extra)
1367
+ local_sheet_name ||= extra[:sheet]
1368
+ value ||= extra[:formula]
1369
+ if (value.nil? || (value.respond_to?(:empty?) && value.empty?)) && extra[:range]
1370
+ value = local_sheet_name ? "'#{local_sheet_name}'!#{extra[:range]}" : extra[:range].to_s
1371
+ end
1372
+ super(name: name, value: value || "", local_sheet_id: local_sheet_id, local_sheet_name: local_sheet_name, hidden: hidden, comment: comment)
1373
+ end
1374
+
1375
+ # Returns whether the defined name is hidden.
1376
+ # @return [Boolean]
1377
+ # @api public
1378
+ #: () -> bool
1379
+ def hidden?
1380
+ hidden ? true : false
1381
+ end
1382
+
1383
+ # @return [String]
1384
+ # @api public
1385
+ #: () -> String
1386
+ def to_s
1387
+ value.to_s
1388
+ end
1389
+ end
1390
+
1391
+ # Explicit page row or column break (<brk>).
1392
+ # @api public
1393
+ PageBreak = Data.define(:id, :max, :min, :man, :pt) do
1394
+ include MetadataRecord
1395
+
1396
+ #: (?id: Integer?, ?max: Integer?, ?min: Integer?, ?man: (Integer | bool)?, ?pt: bool?, ?manual: bool?, **untyped) -> void
1397
+ # rubocop:disable Naming/MethodParameterName
1398
+ def initialize(id: nil, max: nil, min: nil, man: nil, pt: nil, manual: nil, **_extra)
1399
+ m = if manual.nil?
1400
+ man
1401
+ else
1402
+ manual ? 1 : 0
1403
+ end
1404
+ super(id: id, max: max, min: min, man: m, pt: pt)
1405
+ end
1406
+ # rubocop:enable Naming/MethodParameterName
1407
+
1408
+ # Returns whether the page break is a manual break.
1409
+ # @return [Boolean]
1410
+ # @api public
1411
+ #: () -> bool
1412
+ def manual?
1413
+ [1, true].include?(man)
1414
+ end
1415
+ end
1416
+
1417
+ # Cell comment or note (<comment>).
1418
+ # @api public
1419
+ Comment = Data.define(:ref, :text, :author, :r_id, :shape_id, :author_id, :visible) do
1420
+ include MetadataRecord
1421
+
1422
+ #: (?ref: String?, ?cell: String?, ?text: String?, ?author: String?, ?r_id: String?, ?shape_id: Integer?, ?author_id: Integer?, ?visible: bool?, **untyped) -> void
1423
+ def initialize(ref: nil, cell: nil, text: nil, author: nil, r_id: nil, shape_id: nil, author_id: nil, visible: false, **_extra)
1424
+ r = ref || cell
1425
+ super(ref: r, text: text, author: author, r_id: r_id, shape_id: shape_id, author_id: author_id, visible: visible)
1426
+ end
1427
+
1428
+ # @deprecated Use {#ref} instead.
1429
+ # @return [String, nil]
1430
+ # @api public
1431
+ #: () -> String?
1432
+ def cell
1433
+ warn "[Xlsxrb DEPRECATION] Comment#cell is deprecated; use #ref instead.", uplevel: 1
1434
+ ref
1435
+ end
1436
+
1437
+ # Returns whether the comment is visible by default.
1438
+ # @return [Boolean]
1439
+ # @api public
1440
+ #: () -> bool
1441
+ def visible?
1442
+ visible ? true : false
1443
+ end
1444
+
1445
+ # Returns whether the comment has no text.
1446
+ #
1447
+ # @return [Boolean]
1448
+ # @api public
1449
+ #: () -> bool
1450
+ def empty?
1451
+ text.nil? || text.empty?
1452
+ end
1453
+
1454
+ # @return [String]
1455
+ # @api public
1456
+ #: () -> String
1457
+ def to_s
1458
+ text.to_s
1459
+ end
1460
+ end
1461
+
1462
+ # Threaded comment (<threadedComment>).
1463
+ # @api public
1464
+ ThreadedComment = Data.define(:id, :ref, :text, :author, :author_id, :created_at, :parent_id, :resolved) do
1465
+ include MetadataRecord
1466
+
1467
+ #: (?id: String?, ?ref: String?, ?cell: String?, ?text: String?, ?author: String?, ?author_id: String?, ?person_id: String?, ?created_at: untyped, ?timestamp: untyped, ?dt: untyped, ?parent_id: String?, ?resolved: bool?, ?done: bool?, **untyped) -> void
1468
+ # rubocop:disable Naming/MethodParameterName
1469
+ def initialize(
1470
+ id: nil, ref: nil, cell: nil, text: nil, author: nil,
1471
+ author_id: nil, person_id: nil, created_at: nil, timestamp: nil, dt: nil,
1472
+ parent_id: nil, resolved: nil, done: nil, **_extra
1473
+ )
1474
+ r = ref || cell
1475
+ res = resolved.nil? ? done : resolved
1476
+ aid = author_id || person_id
1477
+ cat = created_at || timestamp || dt
1478
+ super(id: id, ref: r, text: text, author: author, author_id: aid, created_at: cat, parent_id: parent_id, resolved: res)
1479
+ end
1480
+ # rubocop:enable Naming/MethodParameterName
1481
+
1482
+ # @deprecated Use {#ref} instead.
1483
+ # @return [String, nil]
1484
+ # @api public
1485
+ #: () -> String?
1486
+ def cell
1487
+ warn "[Xlsxrb DEPRECATION] ThreadedComment#cell is deprecated; use #ref instead.", uplevel: 1
1488
+ ref
1489
+ end
1490
+
1491
+ # @deprecated Use {#resolved} instead.
1492
+ # @return [Boolean, nil]
1493
+ # @api public
1494
+ #: () -> bool?
1495
+ def done
1496
+ warn "[Xlsxrb DEPRECATION] ThreadedComment#done is deprecated; use #resolved instead.", uplevel: 1
1497
+ resolved
1498
+ end
1499
+
1500
+ # Returns whether the threaded comment is resolved.
1501
+ # @return [Boolean]
1502
+ # @api public
1503
+ #: () -> bool
1504
+ def resolved?
1505
+ resolved ? true : false
1506
+ end
1507
+
1508
+ # @deprecated Use {#resolved?} instead.
1509
+ # @return [Boolean]
1510
+ # @api public
1511
+ #: () -> bool
1512
+ def done?
1513
+ warn "[Xlsxrb DEPRECATION] ThreadedComment#done? is deprecated; use #resolved? instead.", uplevel: 1
1514
+ resolved?
1515
+ end
1516
+
1517
+ # @return [String]
1518
+ # @api public
1519
+ #: () -> String
1520
+ def to_s
1521
+ text.to_s
1522
+ end
1523
+ end
1524
+
1525
+ # Data validation rule (<dataValidation>).
1526
+ # @api public
1527
+ DataValidation = Data.define(
1528
+ :sqref, :type, :error_style, :operator, :allow_blank, :show_input_message,
1529
+ :show_error_message, :prompt_title, :prompt, :error_title, :error,
1530
+ :formula1, :formula2, :ime_mode, :show_drop_down
1531
+ ) do
1532
+ include MetadataRecord
1533
+
1534
+ #: (?sqref: String?, ?type: String?, ?error_style: String?, ?operator: String?, ?allow_blank: bool?, ?show_input_message: bool?, ?show_error_message: bool?, ?prompt_title: String?, ?prompt: String?, ?error_title: String?, ?error: String?, ?formula1: String?, ?formula2: String?, ?ime_mode: String?, ?show_drop_down: bool?, **untyped) -> void
1535
+ def initialize(sqref: nil, type: nil, error_style: nil, operator: nil, allow_blank: nil, show_input_message: nil, show_error_message: nil, prompt_title: nil, prompt: nil, error_title: nil, error: nil, formula1: nil, formula2: nil, ime_mode: nil, show_drop_down: nil, **extra)
1536
+ sdd = show_drop_down.nil? ? extra[:show_dropdown] : show_drop_down
1537
+ super(
1538
+ sqref: sqref, type: type, error_style: error_style, operator: operator,
1539
+ allow_blank: allow_blank, show_input_message: show_input_message,
1540
+ show_error_message: show_error_message, prompt_title: prompt_title, prompt: prompt,
1541
+ error_title: error_title, error: error, formula1: formula1, formula2: formula2,
1542
+ ime_mode: ime_mode, show_drop_down: sdd
1543
+ )
1544
+ end
1545
+
1546
+ # @deprecated Use {#show_drop_down} instead.
1547
+ # @return [Boolean, nil]
1548
+ # @api public
1549
+ #: () -> bool?
1550
+ def show_dropdown
1551
+ warn "[Xlsxrb DEPRECATION] DataValidation#show_dropdown is deprecated; use #show_drop_down instead.", uplevel: 1
1552
+ show_drop_down
1553
+ end
1554
+
1555
+ # Returns whether blank cells are allowed in validation.
1556
+ # @return [Boolean]
1557
+ # @api public
1558
+ #: () -> bool
1559
+ def allow_blank?
1560
+ allow_blank ? true : false
1561
+ end
1562
+
1563
+ # Returns whether the input message prompt is shown.
1564
+ # @return [Boolean]
1565
+ # @api public
1566
+ #: () -> bool
1567
+ def show_input_message?
1568
+ show_input_message ? true : false
1569
+ end
1570
+
1571
+ # Returns whether the error alert message is shown.
1572
+ # @return [Boolean]
1573
+ # @api public
1574
+ #: () -> bool
1575
+ def show_error_message?
1576
+ show_error_message ? true : false
1577
+ end
1578
+
1579
+ # Returns whether the in-cell dropdown is shown.
1580
+ # @return [Boolean]
1581
+ # @api public
1582
+ #: () -> bool
1583
+ def show_drop_down?
1584
+ show_drop_down ? true : false
1585
+ end
1586
+
1587
+ # @deprecated Use {#show_drop_down?} instead.
1588
+ # @return [Boolean]
1589
+ # @api public
1590
+ #: () -> bool
1591
+ def show_dropdown?
1592
+ warn "[Xlsxrb DEPRECATION] DataValidation#show_dropdown? is deprecated; use #show_drop_down? instead.", uplevel: 1
1593
+ show_drop_down?
1594
+ end
1595
+ end
1596
+
1597
+ # Conditional formatting rule (<cfRule>).
1598
+ # @api public
1599
+ ConditionalFormatRule = Data.define(
1600
+ :type, :dxf_id, :priority, :operator, :formula, :text, :time_period,
1601
+ :rank, :std_dev, :above_average, :equal_average, :bottom, :percent,
1602
+ :stop_if_true, :color_scale, :data_bar, :icon_set, :options
1603
+ ) do
1604
+ include MetadataRecord
1605
+
1606
+ #: (?type: (Symbol | String)?, ?dxf_id: Integer?, ?priority: Integer?, ?operator: (Symbol | String)?, ?formula: untyped, ?text: String?, ?time_period: (Symbol | String)?, ?rank: Integer?, ?std_dev: Integer?, ?above_average: bool?, ?equal_average: bool?, ?bottom: bool?, ?percent: bool?, ?stop_if_true: bool?, ?color_scale: Hash[Symbol, untyped]?, ?data_bar: Hash[Symbol, untyped]?, ?icon_set: Hash[Symbol, untyped]?, ?options: Hash[Symbol, untyped]?, **untyped) -> void
1607
+ def initialize(type: nil, dxf_id: nil, priority: nil, operator: nil, formula: nil, text: nil, time_period: nil, rank: nil, std_dev: nil, above_average: nil, equal_average: nil, bottom: nil, percent: nil, stop_if_true: nil, color_scale: nil, data_bar: nil, icon_set: nil, options: nil, **extra)
1608
+ dxf_id ||= extra.delete(:format_id)
1609
+ f = formula || extra.delete(:formulas)
1610
+ opts = (options || {}).merge(extra)
1611
+ super(
1612
+ type: type, dxf_id: dxf_id, priority: priority, operator: operator, formula: f,
1613
+ text: text, time_period: time_period, rank: rank, std_dev: std_dev,
1614
+ above_average: above_average, equal_average: equal_average, bottom: bottom,
1615
+ percent: percent, stop_if_true: stop_if_true, color_scale: color_scale,
1616
+ data_bar: data_bar, icon_set: icon_set, options: opts.empty? ? nil : opts
1617
+ )
1618
+ end
1619
+
1620
+ # @deprecated Use {#formula} instead.
1621
+ # @return [Object]
1622
+ # @api public
1623
+ #: () -> untyped
1624
+ def formulas
1625
+ warn "[Xlsxrb DEPRECATION] ConditionalFormatRule#formulas is deprecated; use #formula instead.", uplevel: 1
1626
+ formula
1627
+ end
1628
+
1629
+ # Returns whether rule matches above average values.
1630
+ # @return [Boolean]
1631
+ # @api public
1632
+ #: () -> bool
1633
+ def above_average?
1634
+ above_average ? true : false
1635
+ end
1636
+
1637
+ # Returns whether rule matches equal average values.
1638
+ # @return [Boolean]
1639
+ # @api public
1640
+ #: () -> bool
1641
+ def equal_average?
1642
+ equal_average ? true : false
1643
+ end
1644
+
1645
+ # Returns whether rule matches bottom values.
1646
+ # @return [Boolean]
1647
+ # @api public
1648
+ #: () -> bool
1649
+ def bottom?
1650
+ bottom ? true : false
1651
+ end
1652
+
1653
+ # Returns whether rank is evaluated as a percentage.
1654
+ # @return [Boolean]
1655
+ # @api public
1656
+ #: () -> bool
1657
+ def percent?
1658
+ percent ? true : false
1659
+ end
1660
+
1661
+ # Returns whether formatting evaluation stops if rule is true.
1662
+ # @return [Boolean]
1663
+ # @api public
1664
+ #: () -> bool
1665
+ def stop_if_true?
1666
+ stop_if_true ? true : false
1667
+ end
1668
+ end
1669
+
1670
+ # Conditional format definition (<conditionalFormatting> and <cfRule>).
1671
+ # @api public
1672
+ ConditionalFormat = Data.define(
1673
+ :sqref, :type, :dxf_id, :priority, :operator, :formula, :text, :time_period,
1674
+ :rank, :std_dev, :above_average, :equal_average, :bottom, :percent,
1675
+ :stop_if_true, :color_scale, :data_bar, :icon_set, :pivot, :rules,
1676
+ :options
1677
+ ) do
1678
+ include MetadataRecord
1679
+
1680
+ #: (?sqref: String?, ?type: (Symbol | String)?, ?dxf_id: Integer?, ?priority: Integer?, ?operator: (Symbol | String)?, ?formula: untyped, ?text: String?, ?time_period: (Symbol | String)?, ?rank: Integer?, ?std_dev: Integer?, ?above_average: bool?, ?equal_average: bool?, ?bottom: bool?, ?percent: bool?, ?stop_if_true: bool?, ?color_scale: Hash[Symbol, untyped]?, ?data_bar: Hash[Symbol, untyped]?, ?icon_set: Hash[Symbol, untyped]?, ?pivot: bool?, ?rules: Array[untyped]?, ?options: Hash[Symbol, untyped]?, **untyped) -> void
1681
+ def initialize(sqref: nil, type: nil, dxf_id: nil, priority: nil, operator: nil, formula: nil, text: nil, time_period: nil, rank: nil, std_dev: nil, above_average: nil, equal_average: nil, bottom: nil, percent: nil, stop_if_true: nil, color_scale: nil, data_bar: nil, icon_set: nil, pivot: nil, rules: nil, options: nil, **extra)
1682
+ dxf_id ||= extra.delete(:format_id)
1683
+ f = formula || extra.delete(:formulas)
1684
+ wrapped_rules = if rules && !rules.empty?
1685
+ rules.map { |r| r.is_a?(ConditionalFormatRule) ? r : ConditionalFormatRule.new(**r) }
1686
+ end
1687
+ opts = (options || {}).merge(extra)
1688
+ super(
1689
+ sqref: sqref, type: type, dxf_id: dxf_id, priority: priority, operator: operator, formula: f,
1690
+ text: text, time_period: time_period, rank: rank, std_dev: std_dev,
1691
+ above_average: above_average, equal_average: equal_average, bottom: bottom,
1692
+ percent: percent, stop_if_true: stop_if_true, color_scale: color_scale,
1693
+ data_bar: data_bar, icon_set: icon_set, pivot: pivot, rules: wrapped_rules,
1694
+ options: opts.empty? ? nil : opts
1695
+ )
1696
+ end
1697
+
1698
+ # @deprecated Use {#formula} instead.
1699
+ # @return [Object]
1700
+ # @api public
1701
+ #: () -> untyped
1702
+ def formulas
1703
+ warn "[Xlsxrb DEPRECATION] ConditionalFormat#formulas is deprecated; use #formula instead.", uplevel: 1
1704
+ formula
1705
+ end
1706
+
1707
+ # Returns whether rule matches above average values.
1708
+ # @return [Boolean]
1709
+ # @api public
1710
+ #: () -> bool
1711
+ def above_average?
1712
+ above_average ? true : false
1713
+ end
1714
+
1715
+ # Returns whether rule matches equal average values.
1716
+ # @return [Boolean]
1717
+ # @api public
1718
+ #: () -> bool
1719
+ def equal_average?
1720
+ equal_average ? true : false
1721
+ end
1722
+
1723
+ # Returns whether rule matches bottom values.
1724
+ # @return [Boolean]
1725
+ # @api public
1726
+ #: () -> bool
1727
+ def bottom?
1728
+ bottom ? true : false
1729
+ end
1730
+
1731
+ # Returns whether rank is evaluated as a percentage.
1732
+ # @return [Boolean]
1733
+ # @api public
1734
+ #: () -> bool
1735
+ def percent?
1736
+ percent ? true : false
1737
+ end
1738
+
1739
+ # Returns whether formatting evaluation stops if rule is true.
1740
+ # @return [Boolean]
1741
+ # @api public
1742
+ #: () -> bool
1743
+ def stop_if_true?
1744
+ stop_if_true ? true : false
1745
+ end
1746
+
1747
+ # Returns whether conditional format applies to pivot table.
1748
+ # @return [Boolean]
1749
+ # @api public
1750
+ #: () -> bool
1751
+ def pivot?
1752
+ pivot ? true : false
1753
+ end
1754
+ end
1755
+
1756
+ # Column definition in an OpenXML table (<tableColumn>).
1757
+ # @api public
1758
+ TableColumn = Data.define(:id, :name, :totals_row_function, :totals_row_label, :totals_row_formula, :data_dxf_id, :calculated_column_formula) do
1759
+ include MetadataRecord
1760
+
1761
+ #: (?id: Integer?, ?name: String?, ?totals_row_function: String?, ?totals_row_label: String?, ?totals_row_formula: String?, ?data_dxf_id: Integer?, ?calculated_column_formula: String?, ?data_formula: String?, **untyped) -> void
1762
+ def initialize(id: nil, name: nil, totals_row_function: nil, totals_row_label: nil, totals_row_formula: nil, data_dxf_id: nil, calculated_column_formula: nil, data_formula: nil, **_extra)
1763
+ super(
1764
+ id: id, name: name, totals_row_function: totals_row_function,
1765
+ totals_row_label: totals_row_label, totals_row_formula: totals_row_formula,
1766
+ data_dxf_id: data_dxf_id,
1767
+ calculated_column_formula: calculated_column_formula || data_formula
1768
+ )
1769
+ end
1770
+
1771
+ # @deprecated Use {#calculated_column_formula} instead.
1772
+ # @return [String, nil]
1773
+ # @api public
1774
+ #: () -> String?
1775
+ def data_formula
1776
+ warn "[Xlsxrb DEPRECATION] TableColumn#data_formula is deprecated; use #calculated_column_formula instead.", uplevel: 1
1777
+ calculated_column_formula
1778
+ end
1779
+ end
1780
+
1781
+ # Table style information (<tableStyleInfo>).
1782
+ # @api public
1783
+ TableStyleInfo = Data.define(:name, :show_first_column, :show_last_column, :show_row_stripes, :show_column_stripes) do
1784
+ include MetadataRecord
1785
+
1786
+ #: (?name: String?, ?show_first_column: bool?, ?show_last_column: bool?, ?show_row_stripes: bool?, ?show_column_stripes: bool?, **untyped) -> void
1787
+ def initialize(name: nil, show_first_column: nil, show_last_column: nil, show_row_stripes: nil, show_column_stripes: nil, **_extra)
1788
+ super(
1789
+ name: name, show_first_column: show_first_column, show_last_column: show_last_column,
1790
+ show_row_stripes: show_row_stripes, show_column_stripes: show_column_stripes
1791
+ )
1792
+ end
1793
+
1794
+ # Returns whether first column is formatted distinctly.
1795
+ # @return [Boolean]
1796
+ # @api public
1797
+ #: () -> bool
1798
+ def show_first_column?
1799
+ show_first_column ? true : false
1800
+ end
1801
+
1802
+ # Returns whether last column is formatted distinctly.
1803
+ # @return [Boolean]
1804
+ # @api public
1805
+ #: () -> bool
1806
+ def show_last_column?
1807
+ show_last_column ? true : false
1808
+ end
1809
+
1810
+ # Returns whether row stripes are shown.
1811
+ # @return [Boolean]
1812
+ # @api public
1813
+ #: () -> bool
1814
+ def show_row_stripes?
1815
+ show_row_stripes ? true : false
1816
+ end
1817
+
1818
+ # Returns whether column stripes are shown.
1819
+ # @return [Boolean]
1820
+ # @api public
1821
+ #: () -> bool
1822
+ def show_column_stripes?
1823
+ show_column_stripes ? true : false
1824
+ end
1825
+ end
1826
+
1827
+ # OpenXML Table (<table id=... ref=...>).
1828
+ # @api public
1829
+ Table = Data.define(:id, :name, :display_name, :ref, :totals_row_count, :header_row_count, :columns, :style_info, :auto_filter) do
1830
+ include MetadataRecord
1831
+
1832
+ #: (?id: Integer?, ?name: String?, ?display_name: String?, ?ref: String?, ?totals_row_count: Integer?, ?header_row_count: Integer?, ?columns: Array[Elements::TableColumn | Hash[Symbol, untyped]]?, ?style_info: (Elements::TableStyleInfo | Hash[Symbol, untyped])?, ?auto_filter: Hash[Symbol, untyped]?, ?totals_row_shown: bool?, ?header_row_shown: bool?, **untyped) -> void
1833
+ def initialize(id: nil, name: nil, display_name: nil, ref: nil, totals_row_count: nil, header_row_count: nil, columns: nil, style_info: nil, auto_filter: nil, totals_row_shown: nil, header_row_shown: nil, **extra)
1834
+ trc = totals_row_count
1835
+ if trc.nil?
1836
+ trs = totals_row_shown.nil? ? extra[:totals_row_shown] : totals_row_shown
1837
+ trc = trs ? 1 : 0 unless trs.nil?
1838
+ end
1839
+ hrc = header_row_count
1840
+ if hrc.nil?
1841
+ hrs = header_row_shown.nil? ? extra[:header_row_shown] : header_row_shown
1842
+ hrc = hrs ? 1 : 0 unless hrs.nil?
1843
+ end
1844
+ wrapped_cols = (columns || []).map { |c| c.is_a?(TableColumn) ? c : TableColumn.new(**c) }
1845
+ wrapped_si = style_info.is_a?(Hash) ? TableStyleInfo.new(**style_info) : style_info
1846
+ super(
1847
+ id: id, name: name, display_name: display_name, ref: ref,
1848
+ totals_row_count: trc, header_row_count: hrc,
1849
+ columns: wrapped_cols, style_info: wrapped_si, auto_filter: auto_filter
1850
+ )
1851
+ end
1852
+
1853
+ #: (Symbol | String key) -> untyped
1854
+ def [](key)
1855
+ warn "[DEPRECATION] Hash access on Elements::Table (`#[]`) is deprecated and will be removed in 0.2.0; use method calls instead.", uplevel: 1
1856
+ k = key.is_a?(Symbol) ? key : key.to_s.to_sym
1857
+ case k
1858
+ when :style
1859
+ style_info&.name
1860
+ when :show_row_stripes
1861
+ style_info&.show_row_stripes
1862
+ when :show_first_column
1863
+ style_info&.show_first_column
1864
+ when :show_last_column
1865
+ style_info&.show_last_column
1866
+ when :show_column_stripes
1867
+ style_info&.show_column_stripes
1868
+ else
1869
+ super
1870
+ end
1871
+ end
1872
+
1873
+ # Returns whether the table totals row is shown.
1874
+ # @return [Boolean]
1875
+ # @api public
1876
+ #: () -> bool
1877
+ def totals_row_shown?
1878
+ (totals_row_count || 0).positive?
1879
+ end
1880
+
1881
+ # Returns whether the table header row is shown.
1882
+ # @return [Boolean]
1883
+ # @api public
1884
+ #: () -> bool
1885
+ def header_row_shown?
1886
+ header_row_count.nil? || header_row_count.positive?
1887
+ end
1888
+
1889
+ # Returns the table style name.
1890
+ # @return [String, nil]
1891
+ # @api public
1892
+ #: () -> String?
1893
+ def style_name
1894
+ style_info&.name
1895
+ end
1896
+
1897
+ # Returns whether first column is formatted distinctly.
1898
+ # @return [Boolean]
1899
+ # @api public
1900
+ #: () -> bool
1901
+ def show_first_column?
1902
+ style_info ? style_info.show_first_column? : false
1903
+ end
1904
+
1905
+ # Returns whether last column is formatted distinctly.
1906
+ # @return [Boolean]
1907
+ # @api public
1908
+ #: () -> bool
1909
+ def show_last_column?
1910
+ style_info ? style_info.show_last_column? : false
1911
+ end
1912
+
1913
+ # Returns whether row stripes are shown.
1914
+ # @return [Boolean]
1915
+ # @api public
1916
+ #: () -> bool
1917
+ def show_row_stripes?
1918
+ style_info ? style_info.show_row_stripes? : false
1919
+ end
1920
+ alias_method :show_row_stripes, :show_row_stripes?
1921
+
1922
+ # Returns whether column stripes are shown.
1923
+ # @return [Boolean]
1924
+ # @api public
1925
+ #: () -> bool
1926
+ def show_column_stripes?
1927
+ style_info ? style_info.show_column_stripes? : false
1928
+ end
1929
+ end
1930
+
1931
+ # Single sparkline definition (<x14:sparkline>).
1932
+ # @api public
1933
+ Sparkline = Data.define(:sqref, :formula) do
1934
+ include MetadataRecord
1935
+
1936
+ #: (?sqref: String?, ?formula: String?, **untyped) -> void
1937
+ def initialize(sqref: nil, formula: nil, **extra)
1938
+ sqref ||= extra[:location_ref] || extra[:location]
1939
+ formula ||= extra[:data_ref] || extra[:f] || extra[:data]
1940
+ super(sqref: sqref, formula: formula)
1941
+ end
1942
+ end
1943
+
1944
+ # Sparkline group (<x14:sparklineGroup>).
1945
+ # @api public
1946
+ SparklineGroup = Data.define(
1947
+ :type, :color_series, :color_negative, :color_axis, :color_markers,
1948
+ :color_first, :color_last, :color_high, :color_low, :sparklines,
1949
+ :display_empty_cells_as, :markers, :high, :low, :first, :last, :negative,
1950
+ :manual_max, :manual_min, :line_weight
1951
+ ) do
1952
+ include MetadataRecord
1953
+
1954
+ #: (?type: String?, ?color_series: String?, ?color_negative: String?, ?color_axis: String?, ?color_markers: String?, ?color_first: String?, ?color_last: String?, ?color_high: String?, ?color_low: String?, ?sparklines: Array[Elements::Sparkline | Hash[Symbol, untyped]]?, ?display_empty_cells_as: String?, ?markers: bool?, ?high: bool?, ?low: bool?, ?first: bool?, ?last: bool?, ?negative: bool?, ?manual_max: (Integer | Float)?, ?manual_min: (Integer | Float)?, ?line_weight: (Integer | Float)?, **untyped) -> void
1955
+ def initialize(type: nil, color_series: nil, color_negative: nil, color_axis: nil, color_markers: nil, color_first: nil, color_last: nil, color_high: nil, color_low: nil, sparklines: nil, display_empty_cells_as: nil, markers: nil, high: nil, low: nil, first: nil, last: nil, negative: nil, manual_max: nil, manual_min: nil, line_weight: nil, **extra)
1956
+ wrapped_sps = (sparklines || []).map { |s| s.is_a?(Sparkline) ? s : Sparkline.new(**s) }
1957
+ disp = display_empty_cells_as || extra[:display_empty]
1958
+ m_max = manual_max || extra[:max]
1959
+ m_min = manual_min || extra[:min]
1960
+ lw = line_weight || extra[:line_weight]
1961
+ super(
1962
+ type: type, color_series: color_series, color_negative: color_negative,
1963
+ color_axis: color_axis, color_markers: color_markers, color_first: color_first,
1964
+ color_last: color_last, color_high: color_high, color_low: color_low,
1965
+ sparklines: wrapped_sps, display_empty_cells_as: disp,
1966
+ markers: markers, high: high, low: low, first: first, last: last, negative: negative,
1967
+ manual_max: m_max, manual_min: m_min, line_weight: lw
1968
+ )
1969
+ end
1970
+
1971
+ # @deprecated Use {#display_empty_cells_as} instead.
1972
+ # @return [String, nil]
1973
+ # @api public
1974
+ #: () -> String?
1975
+ def display_empty
1976
+ warn "[Xlsxrb DEPRECATION] SparklineGroup#display_empty is deprecated; use #display_empty_cells_as instead.", uplevel: 1
1977
+ display_empty_cells_as
1978
+ end
1979
+
1980
+ # @deprecated Use {#manual_max} instead.
1981
+ # @return [Integer, Float, nil]
1982
+ # @api public
1983
+ #: () -> (Integer | Float)?
1984
+ def max
1985
+ warn "[Xlsxrb DEPRECATION] SparklineGroup#max is deprecated; use #manual_max instead.", uplevel: 1
1986
+ manual_max
1987
+ end
1988
+
1989
+ # @deprecated Use {#manual_min} instead.
1990
+ # @return [Integer, Float, nil]
1991
+ # @api public
1992
+ #: () -> (Integer | Float)?
1993
+ def min
1994
+ warn "[Xlsxrb DEPRECATION] SparklineGroup#min is deprecated; use #manual_min instead.", uplevel: 1
1995
+ manual_min
1996
+ end
1997
+
1998
+ # Returns whether data markers are displayed.
1999
+ # @return [Boolean]
2000
+ # @api public
2001
+ #: () -> bool
2002
+ def markers?
2003
+ markers ? true : false
2004
+ end
2005
+
2006
+ # Returns whether high point markers are highlighted.
2007
+ # @return [Boolean]
2008
+ # @api public
2009
+ #: () -> bool
2010
+ def high?
2011
+ high ? true : false
2012
+ end
2013
+
2014
+ # Returns whether low point markers are highlighted.
2015
+ # @return [Boolean]
2016
+ # @api public
2017
+ #: () -> bool
2018
+ def low?
2019
+ low ? true : false
2020
+ end
2021
+
2022
+ # Returns whether first point markers are highlighted.
2023
+ # @return [Boolean]
2024
+ # @api public
2025
+ #: () -> bool
2026
+ def first?
2027
+ first ? true : false
2028
+ end
2029
+
2030
+ # Returns whether last point markers are highlighted.
2031
+ # @return [Boolean]
2032
+ # @api public
2033
+ #: () -> bool
2034
+ def last?
2035
+ last ? true : false
2036
+ end
2037
+
2038
+ # Returns whether negative point markers are highlighted.
2039
+ # @return [Boolean]
2040
+ # @api public
2041
+ #: () -> bool
2042
+ def negative?
2043
+ negative ? true : false
2044
+ end
2045
+ end
2046
+
2047
+ # Protected range configuration (<protectedRange>).
2048
+ # @api public
2049
+ ProtectedRange = Data.define(:name, :sqref, :security_descriptor, :password, :algorithm_name, :hash_value, :salt_value, :spin_count) do
2050
+ include MetadataRecord
2051
+
2052
+ #: (?name: String?, ?sqref: String?, ?security_descriptor: String?, ?password: String?, ?algorithm_name: String?, ?hash_value: String?, ?salt_value: String?, ?spin_count: Integer?, **untyped) -> void
2053
+ def initialize(name: nil, sqref: nil, security_descriptor: nil, password: nil, algorithm_name: nil, hash_value: nil, salt_value: nil, spin_count: nil, **_extra)
2054
+ super(
2055
+ name: name, sqref: sqref, security_descriptor: security_descriptor, password: password,
2056
+ algorithm_name: algorithm_name, hash_value: hash_value, salt_value: salt_value, spin_count: spin_count
2057
+ )
2058
+ end
2059
+ end
2060
+
2061
+ # Ignored error rule (<ignoredError>).
2062
+ # @api public
2063
+ IgnoredError = Data.define(
2064
+ :sqref, :eval_error, :two_digit_text_year, :number_stored_as_text,
2065
+ :formula, :formula_range, :unlocked_formula, :empty_cell_reference,
2066
+ :list_data_validation, :calculated_column
2067
+ ) do
2068
+ include MetadataRecord
2069
+
2070
+ #: (?sqref: String?, ?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?, **untyped) -> void
2071
+ def initialize(sqref: nil, eval_error: nil, two_digit_text_year: nil, number_stored_as_text: nil, formula: nil, formula_range: nil, unlocked_formula: nil, empty_cell_reference: nil, list_data_validation: nil, calculated_column: nil, **_extra)
2072
+ super(
2073
+ sqref: sqref, eval_error: eval_error, two_digit_text_year: two_digit_text_year,
2074
+ number_stored_as_text: number_stored_as_text, formula: formula, formula_range: formula_range,
2075
+ unlocked_formula: unlocked_formula, empty_cell_reference: empty_cell_reference,
2076
+ list_data_validation: list_data_validation, calculated_column: calculated_column
2077
+ )
2078
+ end
2079
+
2080
+ # Returns whether evaluation error check is ignored.
2081
+ # @return [Boolean]
2082
+ # @api public
2083
+ #: () -> bool
2084
+ def eval_error?
2085
+ eval_error ? true : false
2086
+ end
2087
+
2088
+ # Returns whether two-digit text year check is ignored.
2089
+ # @return [Boolean]
2090
+ # @api public
2091
+ #: () -> bool
2092
+ def two_digit_text_year?
2093
+ two_digit_text_year ? true : false
2094
+ end
2095
+
2096
+ # Returns whether number stored as text check is ignored.
2097
+ # @return [Boolean]
2098
+ # @api public
2099
+ #: () -> bool
2100
+ def number_stored_as_text?
2101
+ number_stored_as_text ? true : false
2102
+ end
2103
+
2104
+ # Returns whether formula syntax check is ignored.
2105
+ # @return [Boolean]
2106
+ # @api public
2107
+ #: () -> bool
2108
+ def formula?
2109
+ formula ? true : false
2110
+ end
2111
+
2112
+ # Returns whether formula range check is ignored.
2113
+ # @return [Boolean]
2114
+ # @api public
2115
+ #: () -> bool
2116
+ def formula_range?
2117
+ formula_range ? true : false
2118
+ end
2119
+
2120
+ # Returns whether unlocked formula check is ignored.
2121
+ # @return [Boolean]
2122
+ # @api public
2123
+ #: () -> bool
2124
+ def unlocked_formula?
2125
+ unlocked_formula ? true : false
2126
+ end
2127
+
2128
+ # Returns whether empty cell reference check is ignored.
2129
+ # @return [Boolean]
2130
+ # @api public
2131
+ #: () -> bool
2132
+ def empty_cell_reference?
2133
+ empty_cell_reference ? true : false
2134
+ end
2135
+
2136
+ # Returns whether list data validation error check is ignored.
2137
+ # @return [Boolean]
2138
+ # @api public
2139
+ #: () -> bool
2140
+ def list_data_validation?
2141
+ list_data_validation ? true : false
2142
+ end
2143
+
2144
+ # Returns whether calculated column error check is ignored.
2145
+ # @return [Boolean]
2146
+ # @api public
2147
+ #: () -> bool
2148
+ def calculated_column?
2149
+ calculated_column ? true : false
2150
+ end
2151
+ end
2152
+
2153
+ # Drawing chart entry (<c:chart>).
2154
+ # @api public
2155
+ Chart = Data.define(
2156
+ :r_id, :name, :title, :type, :anchor, :from, :to, :series, :legend,
2157
+ :category_axis, :value_axis, :secondary_value_axis, :grouping,
2158
+ :gap_width, :overlap, :target, :from_column, :from_row, :to_column,
2159
+ :to_row, :data_labels, :options
2160
+ ) do
2161
+ include MetadataRecord
2162
+
2163
+ #: (?r_id: String?, ?name: String?, ?title: String?, ?type: String?, ?anchor: String?, ?from: untyped, ?to: untyped, ?series: Array[untyped]?, ?legend: untyped, ?category_axis: untyped, ?value_axis: untyped, ?secondary_value_axis: untyped, ?grouping: untyped, ?gap_width: untyped, ?overlap: untyped, ?target: untyped, ?from_column: untyped, ?from_row: untyped, ?to_column: untyped, ?to_row: untyped, ?data_labels: untyped?, ?cat_axis_title: String?, ?val_axis_title: String?, ?options: Hash[Symbol, untyped]?, **untyped) -> void
2164
+ def initialize(r_id: nil, name: nil, title: nil, type: nil, anchor: nil, from: nil, to: nil, series: nil, legend: nil, category_axis: nil, value_axis: nil, secondary_value_axis: nil, grouping: nil, gap_width: nil, overlap: nil, target: nil, from_column: nil, from_row: nil, to_column: nil, to_row: nil, data_labels: nil, cat_axis_title: nil, val_axis_title: nil, options: nil, **extra)
2165
+ from_column ||= extra.delete(:from_col)
2166
+ to_column ||= extra.delete(:to_col)
2167
+ r_id ||= extra.delete(:rid)
2168
+ type ||= extra.delete(:chart_type)
2169
+ cat_title = cat_axis_title || extra.delete(:cat_axis_title)
2170
+ val_title = val_axis_title || extra.delete(:val_axis_title)
2171
+ category_axis ||= { title: cat_title } if cat_title
2172
+ value_axis ||= { title: val_title } if val_title
2173
+ opts = (options || {}).merge(extra)
2174
+ super(
2175
+ r_id: r_id, name: name, title: title, type: type, anchor: anchor, from: from, to: to,
2176
+ series: series, legend: legend, category_axis: category_axis, value_axis: value_axis,
2177
+ secondary_value_axis: secondary_value_axis, grouping: grouping, gap_width: gap_width,
2178
+ overlap: overlap, target: target, from_column: from_column, from_row: from_row,
2179
+ to_column: to_column, to_row: to_row, data_labels: data_labels,
2180
+ options: opts.empty? ? nil : opts
2181
+ )
2182
+ end
2183
+
2184
+ # @deprecated Use {#category_axis}[:title] instead.
2185
+ # @return [String, nil]
2186
+ # @api public
2187
+ #: () -> String?
2188
+ def cat_axis_title
2189
+ warn "[Xlsxrb DEPRECATION] Chart#cat_axis_title is deprecated and will be removed in v0.2.0. Use #category_axis[:title] instead.", uplevel: 1
2190
+ category_axis&.[](:title) || options&.[](:cat_axis_title)
2191
+ end
2192
+
2193
+ # @deprecated Use {#value_axis}[:title] instead.
2194
+ # @return [String, nil]
2195
+ # @api public
2196
+ #: () -> String?
2197
+ def val_axis_title
2198
+ warn "[Xlsxrb DEPRECATION] Chart#val_axis_title is deprecated and will be removed in v0.2.0. Use #value_axis[:title] instead.", uplevel: 1
2199
+ value_axis&.[](:title) || options&.[](:val_axis_title)
2200
+ end
2201
+
2202
+ # @deprecated Use {#r_id} instead.
2203
+ # @return [String, nil]
2204
+ # @api public
2205
+ #: () -> String?
2206
+ def rid
2207
+ warn "[Xlsxrb DEPRECATION] Chart#rid is deprecated; use #r_id instead.", uplevel: 1
2208
+ r_id
2209
+ end
2210
+
2211
+ # @deprecated Use {#type} instead.
2212
+ # @return [String, nil]
2213
+ # @api public
2214
+ #: () -> String?
2215
+ def chart_type
2216
+ warn "[Xlsxrb DEPRECATION] Chart#chart_type is deprecated; use #type instead.", uplevel: 1
2217
+ type
2218
+ end
2219
+
2220
+ # @deprecated Use {#from_column} instead.
2221
+ # @return [Object]
2222
+ # @api public
2223
+ #: () -> untyped
2224
+ def from_col
2225
+ warn "[Xlsxrb DEPRECATION] Chart#from_col is deprecated; use #from_column instead.", uplevel: 1
2226
+ from_column
2227
+ end
2228
+
2229
+ # @deprecated Use {#to_column} instead.
2230
+ # @return [Object]
2231
+ # @api public
2232
+ #: () -> untyped
2233
+ def to_col
2234
+ warn "[Xlsxrb DEPRECATION] Chart#to_col is deprecated; use #to_column instead.", uplevel: 1
2235
+ to_column
2236
+ end
2237
+ end
2238
+
2239
+ # Drawing shape entry (<xdr:sp>).
2240
+ # @api public
2241
+ Shape = Data.define(:id, :name, :type, :anchor, :from, :to, :text, :preset, :width, :height, :left, :top, :options) do
2242
+ include MetadataRecord
2243
+
2244
+ #: (?id: Integer?, ?name: String?, ?type: String?, ?anchor: String?, ?from: untyped, ?to: untyped, ?text: String?, ?preset: String?, ?width: (Float | Integer)?, ?height: (Float | Integer)?, ?left: (Float | Integer)?, ?top: (Float | Integer)?, ?options: Hash[Symbol, untyped]?, **untyped) -> void
2245
+ def initialize(id: nil, name: nil, type: nil, anchor: nil, from: nil, to: nil, text: nil, preset: nil, width: nil, height: nil, left: nil, top: nil, options: nil, **extra)
2246
+ opts = (options || {}).merge(extra)
2247
+ super(
2248
+ id: id, name: name, type: type, anchor: anchor, from: from, to: to,
2249
+ text: text, preset: preset, width: width, height: height, left: left, top: top,
2250
+ options: opts.empty? ? nil : opts
2251
+ )
2252
+ end
2253
+ end
2254
+
2255
+ # Pivot table entry (<pivotTableDefinition>).
2256
+ # @api public
2257
+ PivotTable = Data.define(
2258
+ :name, :ref, :location, :source_ref, :row_fields, :column_fields,
2259
+ :data_fields, :page_fields, :data_caption, :page_wrap,
2260
+ :column_grand_totals, :row_grand_totals, :show_row_headers,
2261
+ :show_column_headers, :show_row_stripes, :show_column_stripes,
2262
+ :cache, :options
2263
+ ) do
2264
+ include MetadataRecord
2265
+
2266
+ #: (?name: String?, ?ref: String?, ?location: String?, ?source_ref: String?, ?row_fields: Array[untyped]?, ?column_fields: Array[untyped]?, ?col_fields: Array[untyped]?, ?data_fields: Array[untyped]?, ?page_fields: Array[untyped]?, ?data_caption: String?, ?page_wrap: Integer?, ?column_grand_totals: bool?, ?row_grand_totals: bool?, ?show_row_headers: bool?, ?show_column_headers: bool?, ?show_row_stripes: bool?, ?show_column_stripes: bool?, ?cache: Hash[Symbol, untyped]?, ?options: Hash[Symbol, untyped]?, **untyped) -> void
2267
+ def initialize(
2268
+ name: nil, ref: nil, location: nil, source_ref: nil,
2269
+ row_fields: nil, column_fields: nil, col_fields: nil, data_fields: nil, page_fields: nil,
2270
+ data_caption: nil, page_wrap: nil, column_grand_totals: nil, row_grand_totals: nil,
2271
+ show_row_headers: nil, show_column_headers: nil, show_row_stripes: nil, show_column_stripes: nil,
2272
+ cache: nil, options: nil, **extra
2273
+ )
2274
+ r = ref || location
2275
+ cols = column_fields || col_fields || []
2276
+ merged_opts = (options || {}).merge(extra).freeze
2277
+ super(
2278
+ name: name, ref: r, location: r, source_ref: source_ref,
2279
+ row_fields: row_fields, column_fields: cols, data_fields: data_fields, page_fields: page_fields,
2280
+ data_caption: data_caption, page_wrap: page_wrap,
2281
+ column_grand_totals: column_grand_totals, row_grand_totals: row_grand_totals,
2282
+ show_row_headers: show_row_headers, show_column_headers: show_column_headers,
2283
+ show_row_stripes: show_row_stripes, show_column_stripes: show_column_stripes,
2284
+ cache: cache, options: merged_opts.empty? ? nil : merged_opts
2285
+ )
2286
+ end
2287
+
2288
+ undef_method :location
2289
+
2290
+ # @deprecated Use {#ref} instead.
2291
+ # @return [String, nil]
2292
+ # @api public
2293
+ #: () -> String?
2294
+ def location
2295
+ warn "[Xlsxrb DEPRECATION] PivotTable#location is deprecated; use #ref instead.", uplevel: 1
2296
+ ref
2297
+ end
2298
+
2299
+ # Returns whether column grand totals are displayed.
2300
+ # @return [Boolean]
2301
+ # @api public
2302
+ #: () -> bool
2303
+ def column_grand_totals?
2304
+ column_grand_totals ? true : false
2305
+ end
2306
+
2307
+ # Returns whether row grand totals are displayed.
2308
+ # @return [Boolean]
2309
+ # @api public
2310
+ #: () -> bool
2311
+ def row_grand_totals?
2312
+ row_grand_totals ? true : false
2313
+ end
2314
+
2315
+ # Returns whether row headers formatting is shown.
2316
+ # @return [Boolean]
2317
+ # @api public
2318
+ #: () -> bool
2319
+ def show_row_headers?
2320
+ show_row_headers ? true : false
2321
+ end
2322
+
2323
+ # Returns whether column headers formatting is shown.
2324
+ # @return [Boolean]
2325
+ # @api public
2326
+ #: () -> bool
2327
+ def show_column_headers?
2328
+ show_column_headers ? true : false
2329
+ end
2330
+
2331
+ # Returns whether row stripe banding is shown.
2332
+ # @return [Boolean]
2333
+ # @api public
2334
+ #: () -> bool
2335
+ def show_row_stripes?
2336
+ show_row_stripes ? true : false
2337
+ end
2338
+
2339
+ # Returns whether column stripe banding is shown.
2340
+ # @return [Boolean]
2341
+ # @api public
2342
+ #: () -> bool
2343
+ def show_column_stripes?
2344
+ show_column_stripes ? true : false
2345
+ end
2346
+ end
2347
+
2348
+ # Header or footer embedded image.
2349
+ # @api public
2350
+ HeaderFooterImage = Data.define(:position, :r_id, :path, :extension, :data, :content_type) do
2351
+ include MetadataRecord
2352
+
2353
+ #: (?position: String?, ?r_id: String?, ?path: String?, ?extension: String?, ?data: String?, ?content_type: String?, **untyped) -> void
2354
+ def initialize(position: nil, r_id: nil, path: nil, extension: nil, data: nil, content_type: nil, **extra)
2355
+ rid = r_id || extra[:rid]
2356
+ ext = extension || extra[:ext]
2357
+ p = path || extra[:filename]
2358
+ ct = content_type || extra[:content_type]
2359
+ super(position: position, r_id: rid, path: p, extension: ext, data: data, content_type: ct)
2360
+ end
2361
+
2362
+ # @deprecated Use {#extension} instead.
2363
+ # @return [String, nil]
2364
+ # @api public
2365
+ #: () -> String?
2366
+ def ext
2367
+ warn "[Xlsxrb DEPRECATION] HeaderFooterImage#ext is deprecated; use #extension instead.", uplevel: 1
2368
+ extension
2369
+ end
2370
+
2371
+ # @deprecated Use {#path} instead.
2372
+ # @return [String, nil]
2373
+ # @api public
2374
+ #: () -> String?
2375
+ def filename
2376
+ warn "[Xlsxrb DEPRECATION] HeaderFooterImage#filename is deprecated; use #path instead.", uplevel: 1
2377
+ path
2378
+ end
2379
+
2380
+ # @deprecated Use {#r_id} instead.
2381
+ # @return [String, nil]
2382
+ # @api public
2383
+ #: () -> String?
2384
+ def rid
2385
+ warn "[Xlsxrb DEPRECATION] HeaderFooterImage#rid is deprecated; use #r_id instead.", uplevel: 1
2386
+ r_id
2387
+ end
2388
+ end
2389
+
2390
+ # Font style definition in stylesheet (<font>).
2391
+ # @api public
2392
+ # rubocop:disable Lint/DataDefineOverride
2393
+ Font = Data.define(:name, :size, :bold, :italic, :underline, :strike, :color, :family, :scheme, :outline, :shadow, :condense, :extend) do
2394
+ # rubocop:enable Lint/DataDefineOverride
2395
+ include MetadataRecord
2396
+
2397
+ #: (?name: String?, ?size: (Integer | Float)?, ?bold: bool?, ?italic: bool?, ?underline: (String | bool)?, ?strike: bool?, ?color: Hash[Symbol, untyped]?, ?family: Integer?, ?scheme: String?, ?outline: bool?, ?shadow: bool?, ?condense: bool?, ?extend: bool?, **untyped) -> void
2398
+ def initialize(name: nil, size: nil, bold: nil, italic: nil, underline: nil, strike: nil, color: nil, family: nil, scheme: nil, outline: nil, shadow: nil, condense: nil, extend: nil, **extra)
2399
+ sz = size || extra[:sz]
2400
+ super(name: name, size: sz, bold: bold, italic: italic, underline: underline, strike: strike, color: color, family: family, scheme: scheme, outline: outline, shadow: shadow, condense: condense, extend: extend)
2401
+ end
2402
+
2403
+ # @deprecated Use {#size} instead.
2404
+ # @return [Integer, Float, nil]
2405
+ # @api public
2406
+ #: () -> (Integer | Float)?
2407
+ def sz
2408
+ warn "[Xlsxrb DEPRECATION] Font#sz is deprecated; use #size instead.", uplevel: 1
2409
+ size
2410
+ end
2411
+
2412
+ # Returns whether the font is bold.
2413
+ # @return [Boolean]
2414
+ # @api public
2415
+ #: () -> bool
2416
+ def bold?
2417
+ bold ? true : false
2418
+ end
2419
+
2420
+ # Returns whether the font is italic.
2421
+ # @return [Boolean]
2422
+ # @api public
2423
+ #: () -> bool
2424
+ def italic?
2425
+ italic ? true : false
2426
+ end
2427
+
2428
+ # Returns whether the font has strikethrough.
2429
+ # @return [Boolean]
2430
+ # @api public
2431
+ #: () -> bool
2432
+ def strike?
2433
+ strike ? true : false
2434
+ end
2435
+
2436
+ # Returns whether the font has outline effect.
2437
+ # @return [Boolean]
2438
+ # @api public
2439
+ #: () -> bool
2440
+ def outline?
2441
+ outline ? true : false
2442
+ end
2443
+
2444
+ # Returns whether the font has shadow effect.
2445
+ # @return [Boolean]
2446
+ # @api public
2447
+ #: () -> bool
2448
+ def shadow?
2449
+ shadow ? true : false
2450
+ end
2451
+
2452
+ # Returns whether the font is condensed.
2453
+ # @return [Boolean]
2454
+ # @api public
2455
+ #: () -> bool
2456
+ def condense?
2457
+ condense ? true : false
2458
+ end
2459
+
2460
+ # Returns whether the font is extended.
2461
+ # @return [Boolean]
2462
+ # @api public
2463
+ #: () -> bool
2464
+ def extend?
2465
+ extend ? true : false
2466
+ end
2467
+ end
2468
+
2469
+ # Fill style definition in stylesheet (<fill>).
2470
+ # @api public
2471
+ Fill = Data.define(:pattern_type, :fg_color, :bg_color) do
2472
+ include MetadataRecord
2473
+
2474
+ #: (?pattern_type: String?, ?fg_color: Hash[Symbol, untyped]?, ?bg_color: Hash[Symbol, untyped]?, **untyped) -> void
2475
+ def initialize(pattern_type: nil, fg_color: nil, bg_color: nil, **extra)
2476
+ pt = pattern_type || extra[:pattern]
2477
+ super(pattern_type: pt, fg_color: fg_color, bg_color: bg_color)
2478
+ end
2479
+
2480
+ # @deprecated Use {#pattern_type} instead.
2481
+ # @return [String, nil]
2482
+ # @api public
2483
+ #: () -> String?
2484
+ def pattern
2485
+ warn "[Xlsxrb DEPRECATION] Fill#pattern is deprecated; use #pattern_type instead.", uplevel: 1
2486
+ pattern_type
2487
+ end
2488
+ end
2489
+
2490
+ # Border style definition in stylesheet (<border>).
2491
+ # @api public
2492
+ Border = Data.define(:left, :right, :top, :bottom, :diagonal, :diagonal_up, :diagonal_down) do
2493
+ include MetadataRecord
2494
+
2495
+ #: (?left: Hash[Symbol, untyped]?, ?right: Hash[Symbol, untyped]?, ?top: Hash[Symbol, untyped]?, ?bottom: Hash[Symbol, untyped]?, ?diagonal: Hash[Symbol, untyped]?, ?diagonal_up: bool?, ?diagonal_down: bool?, **untyped) -> void
2496
+ def initialize(left: nil, right: nil, top: nil, bottom: nil, diagonal: nil, diagonal_up: nil, diagonal_down: nil, **_extra)
2497
+ super(left: left, right: right, top: top, bottom: bottom, diagonal: diagonal, diagonal_up: diagonal_up, diagonal_down: diagonal_down)
2498
+ end
2499
+
2500
+ # Returns whether diagonal up border is enabled.
2501
+ # @return [Boolean]
2502
+ # @api public
2503
+ #: () -> bool
2504
+ def diagonal_up?
2505
+ diagonal_up ? true : false
2506
+ end
2507
+
2508
+ # Returns whether diagonal down border is enabled.
2509
+ # @return [Boolean]
2510
+ # @api public
2511
+ #: () -> bool
2512
+ def diagonal_down?
2513
+ diagonal_down ? true : false
2514
+ end
2515
+ end
2516
+
2517
+ # Alignment style definition in stylesheet (<alignment>).
2518
+ # @api public
2519
+ Alignment = Data.define(
2520
+ :horizontal, :vertical, :wrap_text, :text_rotation, :indent,
2521
+ :relative_indent, :shrink_to_fit, :reading_order, :justify_last_line
2522
+ ) do
2523
+ include MetadataRecord
2524
+
2525
+ #: (?horizontal: (String | Symbol)?, ?vertical: (String | Symbol)?, ?wrap_text: bool?, ?text_rotation: Numeric?, ?indent: Integer?, ?relative_indent: Integer?, ?shrink_to_fit: bool?, ?reading_order: Integer?, ?justify_last_line: bool?, **untyped) -> void
2526
+ def initialize(horizontal: nil, vertical: nil, wrap_text: nil, text_rotation: nil, indent: nil, relative_indent: nil, shrink_to_fit: nil, reading_order: nil, justify_last_line: nil, **_extra)
2527
+ super(horizontal: horizontal, vertical: vertical, wrap_text: wrap_text, text_rotation: text_rotation, indent: indent, relative_indent: relative_indent, shrink_to_fit: shrink_to_fit, reading_order: reading_order, justify_last_line: justify_last_line)
2528
+ end
2529
+
2530
+ # Returns whether text wrapping is enabled.
2531
+ # @return [Boolean]
2532
+ # @api public
2533
+ #: () -> bool
2534
+ def wrap_text?
2535
+ wrap_text ? true : false
2536
+ end
2537
+
2538
+ # Returns whether shrink to fit is enabled.
2539
+ # @return [Boolean]
2540
+ # @api public
2541
+ #: () -> bool
2542
+ def shrink_to_fit?
2543
+ shrink_to_fit ? true : false
2544
+ end
2545
+
2546
+ # Returns whether justify last line is enabled.
2547
+ # @return [Boolean]
2548
+ # @api public
2549
+ #: () -> bool
2550
+ def justify_last_line?
2551
+ justify_last_line ? true : false
2552
+ end
2553
+ end
2554
+
2555
+ # Protection style definition in stylesheet (<protection>).
2556
+ # @api public
2557
+ Protection = Data.define(:locked, :hidden) do
2558
+ include MetadataRecord
2559
+
2560
+ #: (?locked: bool?, ?hidden: bool?, **untyped) -> void
2561
+ def initialize(locked: nil, hidden: nil, **_extra)
2562
+ super(locked: locked, hidden: hidden)
2563
+ end
2564
+
2565
+ # Returns whether the cell is locked.
2566
+ # @return [Boolean]
2567
+ # @api public
2568
+ #: () -> bool
2569
+ def locked?
2570
+ locked ? true : false
2571
+ end
2572
+
2573
+ # Returns whether the cell formula is hidden.
2574
+ # @return [Boolean]
2575
+ # @api public
2576
+ #: () -> bool
2577
+ def hidden?
2578
+ hidden ? true : false
2579
+ end
2580
+ end
2581
+
2582
+ # Cell format record in stylesheet (<xf> in <cellXfs> or <cellStyleXfs>).
2583
+ # @api public
2584
+ CellXf = Data.define(
2585
+ :num_fmt_id, :font_id, :fill_id, :border_id, :xf_id,
2586
+ :apply_number_format, :apply_font, :apply_fill, :apply_border,
2587
+ :apply_alignment, :apply_protection, :alignment, :protection,
2588
+ :quote_prefix, :pivot_button
2589
+ ) do
2590
+ include MetadataRecord
2591
+
2592
+ #: (?num_fmt_id: Integer?, ?font_id: Integer?, ?fill_id: Integer?, ?border_id: Integer?, ?xf_id: Integer?, ?apply_number_format: bool?, ?apply_font: bool?, ?apply_fill: bool?, ?apply_border: bool?, ?apply_alignment: bool?, ?apply_protection: bool?, ?alignment: (Elements::Alignment | Hash[Symbol, untyped])?, ?protection: (Elements::Protection | Hash[Symbol, untyped])?, ?quote_prefix: bool?, ?pivot_button: bool?, **untyped) -> void
2593
+ def initialize(
2594
+ num_fmt_id: nil, font_id: nil, fill_id: nil, border_id: nil, xf_id: nil,
2595
+ apply_number_format: nil, apply_font: nil, apply_fill: nil, apply_border: nil,
2596
+ apply_alignment: nil, apply_protection: nil, alignment: nil, protection: nil,
2597
+ quote_prefix: nil, pivot_button: nil, **_extra
2598
+ )
2599
+ align_obj = alignment.is_a?(Hash) ? Alignment.new(**alignment) : alignment
2600
+ prot_obj = protection.is_a?(Hash) ? Protection.new(**protection) : protection
2601
+ super(
2602
+ num_fmt_id: num_fmt_id, font_id: font_id, fill_id: fill_id, border_id: border_id,
2603
+ xf_id: xf_id, apply_number_format: apply_number_format, apply_font: apply_font,
2604
+ apply_fill: apply_fill, apply_border: apply_border, apply_alignment: apply_alignment,
2605
+ apply_protection: apply_protection, alignment: align_obj, protection: prot_obj,
2606
+ quote_prefix: quote_prefix, pivot_button: pivot_button
2607
+ )
2608
+ end
2609
+
2610
+ # @deprecated Use {#num_fmt_id} instead.
2611
+ # @return [Integer, nil]
2612
+ # @api public
2613
+ #: () -> Integer?
2614
+ def number_format_id
2615
+ warn "[Xlsxrb DEPRECATION] CellXf#number_format_id is deprecated; use #num_fmt_id instead.", uplevel: 1
2616
+ num_fmt_id
2617
+ end
2618
+
2619
+ # Returns whether quote prefix is enabled.
2620
+ # @return [Boolean]
2621
+ # @api public
2622
+ #: () -> bool
2623
+ def quote_prefix?
2624
+ quote_prefix ? true : false
2625
+ end
2626
+
2627
+ # Returns whether pivot button is enabled.
2628
+ # @return [Boolean]
2629
+ # @api public
2630
+ #: () -> bool
2631
+ def pivot_button?
2632
+ pivot_button ? true : false
2633
+ end
2634
+
2635
+ # Returns whether number format is applied.
2636
+ # @return [Boolean]
2637
+ # @api public
2638
+ #: () -> bool
2639
+ def apply_number_format?
2640
+ apply_number_format ? true : false
2641
+ end
2642
+
2643
+ # Returns whether font is applied.
2644
+ # @return [Boolean]
2645
+ # @api public
2646
+ #: () -> bool
2647
+ def apply_font?
2648
+ apply_font ? true : false
2649
+ end
2650
+
2651
+ # Returns whether fill is applied.
2652
+ # @return [Boolean]
2653
+ # @api public
2654
+ #: () -> bool
2655
+ def apply_fill?
2656
+ apply_fill ? true : false
2657
+ end
2658
+
2659
+ # Returns whether border is applied.
2660
+ # @return [Boolean]
2661
+ # @api public
2662
+ #: () -> bool
2663
+ def apply_border?
2664
+ apply_border ? true : false
2665
+ end
2666
+
2667
+ # Returns whether alignment is applied.
2668
+ # @return [Boolean]
2669
+ # @api public
2670
+ #: () -> bool
2671
+ def apply_alignment?
2672
+ apply_alignment ? true : false
2673
+ end
2674
+
2675
+ # Returns whether protection is applied.
2676
+ # @return [Boolean]
2677
+ # @api public
2678
+ #: () -> bool
2679
+ def apply_protection?
2680
+ apply_protection ? true : false
2681
+ end
2682
+ end
2683
+
2684
+ # Differential format in stylesheet (<dxf> in <dxfs>).
2685
+ # @api public
2686
+ Dxf = Data.define(:font, :fill, :border, :number_format, :alignment, :protection) do
2687
+ include MetadataRecord
2688
+
2689
+ #: (?font: (Elements::Font | Hash[Symbol, untyped])?, ?fill: (Elements::Fill | Hash[Symbol, untyped])?, ?border: (Elements::Border | Hash[Symbol, untyped])?, ?number_format: Hash[Symbol, untyped]?, ?alignment: (Elements::Alignment | Hash[Symbol, untyped])?, ?protection: (Elements::Protection | Hash[Symbol, untyped])?, **untyped) -> void
2690
+ def initialize(font: nil, fill: nil, border: nil, number_format: nil, alignment: nil, protection: nil, **extra)
2691
+ nf = number_format
2692
+ if (extra.key?(:num_fmt) || extra.key?("num_fmt")) && nf.nil?
2693
+ Xlsxrb::Deprecation.warn("Dxf keyword :num_fmt is deprecated; use :number_format instead.", uplevel: 1)
2694
+ nf = extra[:num_fmt] || extra["num_fmt"]
2695
+ end
2696
+ f = font.is_a?(Hash) ? Font.new(**font) : font
2697
+ fi = fill.is_a?(Hash) ? Fill.new(**fill) : fill
2698
+ b = border.is_a?(Hash) ? Border.new(**border) : border
2699
+ align = alignment.is_a?(Hash) ? Alignment.new(**alignment) : alignment
2700
+ prot = protection.is_a?(Hash) ? Protection.new(**protection) : protection
2701
+ super(font: f, fill: fi, border: b, number_format: nf, alignment: align, protection: prot)
2702
+ end
2703
+
2704
+ # @deprecated Use {#number_format} instead. Will be removed in 0.2.0.
2705
+ def num_fmt
2706
+ Xlsxrb::Deprecation.warn("Dxf#num_fmt is deprecated; use Dxf#number_format instead.", uplevel: 1)
2707
+ number_format
2708
+ end
2709
+ end
2710
+
2711
+ # Named cell style in stylesheet (<cellStyle> in <cellStyles>).
2712
+ # @api public
2713
+ CellStyle = Data.define(:name, :xf_id, :builtin_id) do
2714
+ include MetadataRecord
2715
+
2716
+ #: (?name: String?, ?xf_id: Integer?, ?builtin_id: Integer?, **untyped) -> void
2717
+ def initialize(name: nil, xf_id: nil, builtin_id: nil, **_extra)
2718
+ super(name: name, xf_id: xf_id, builtin_id: builtin_id)
2719
+ end
2720
+ end
2721
+
2722
+ # Color definition in stylesheet (<color>).
2723
+ # @api public
2724
+ Color = Data.define(:rgb, :indexed, :theme, :tint) do
2725
+ include MetadataRecord
2726
+
2727
+ #: (?rgb: String?, ?indexed: Integer?, ?theme: Integer?, ?tint: Float?, **untyped) -> void
2728
+ def initialize(rgb: nil, indexed: nil, theme: nil, tint: nil, **_extra)
2729
+ super(rgb: rgb, indexed: indexed, theme: theme, tint: tint)
2730
+ end
2731
+ end
2732
+ end
2733
+ end