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