Class: Writexlsx::Package::ConditionalFormat
Constant Summary
Constants included
from Constants
Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX
Utility::Common::PERL_TRUE_VALUES
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#r_id_attributes, #write_color, #write_xml_declaration, #xml_str
#convert_date_time
#check_dimensions, #check_dimensions_and_update_max_min_values, #store_col_max_min_values, #store_row_max_min_values
#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell
#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message
Constructor Details
#initialize(worksheet, range, param) ⇒ ConditionalFormat
Returns a new instance of ConditionalFormat.
47
48
49
50
51
52
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 47
def initialize(worksheet, range, param)
@worksheet = worksheet
@range = range
@param = param
@writer = @worksheet.writer
end
|
Instance Attribute Details
#range ⇒ Object
Returns the value of attribute range.
45
46
47
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 45
def range
@range
end
|
Class Method Details
.factory(worksheet, *args) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 13
def self.factory(worksheet, *args)
range, param =
Package::ConditionalFormat
.new(worksheet, nil, nil)
.range_param_for_conditional_formatting(*args)
case param[:type]
when 'cellIs'
CellIsFormat.new(worksheet, range, param)
when 'aboveAverage'
AboveAverageFormat.new(worksheet, range, param)
when 'top10'
Top10Format.new(worksheet, range, param)
when 'containsText', 'notContainsText', 'beginsWith', 'endsWith'
TextOrWithFormat.new(worksheet, range, param)
when 'timePeriod'
TimePeriodFormat.new(worksheet, range, param)
when 'containsBlanks', 'notContainsBlanks', 'containsErrors', 'notContainsErrors'
BlanksOrErrorsFormat.new(worksheet, range, param)
when 'colorScale'
ColorScaleFormat.new(worksheet, range, param)
when 'dataBar'
DataBarFormat.new(worksheet, range, param)
when 'expression'
ExpressionFormat.new(worksheet, range, param)
when 'iconSet'
IconSetFormat.new(worksheet, range, param)
else ConditionalFormat.new(worksheet, range, param)
end
end
|
Instance Method Details
#attributes ⇒ Object
81
82
83
84
85
86
87
88
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 81
def attributes
attr = []
attr << ['type', type]
attr << ['dxfId', format] if format
attr << ['priority', priority]
attr << ['stopIfTrue', 1] if stop_if_true
attr
end
|
#bar_axis_color ⇒ Object
190
191
192
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 190
def bar_axis_color
@param[:bar_axis_color]
end
|
#bar_axis_position ⇒ Object
186
187
188
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 186
def bar_axis_position
@param[:bar_axis_position]
end
|
#bar_border_color ⇒ Object
170
171
172
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 170
def bar_border_color
@param[:bar_border_color]
end
|
#bar_color ⇒ Object
166
167
168
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 166
def bar_color
@param[:bar_color]
end
|
#bar_negative_color ⇒ Object
174
175
176
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 174
def bar_negative_color
@param[:bar_negative_color]
end
|
#bar_negative_color_same ⇒ Object
178
179
180
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 178
def bar_negative_color_same
@param[:bar_negative_color_same]
end
|
#bar_no_border ⇒ Object
182
183
184
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 182
def bar_no_border
@param[:bar_no_border]
end
|
#bar_only ⇒ Object
214
215
216
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 214
def bar_only
@param[:bar_only]
end
|
#criteria ⇒ Object
106
107
108
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 106
def criteria
@param[:criteria]
end
|
#direction ⇒ Object
122
123
124
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 122
def direction
@param[:direction]
end
|
94
95
96
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 94
def format
@param[:format]
end
|
126
127
128
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 126
def formula
@param[:formula]
end
|
#icon_style ⇒ Object
194
195
196
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 194
def icon_style
@param[:icon_style]
end
|
#icons ⇒ Object
202
203
204
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 202
def icons
@param[:icons]
end
|
#icons_only ⇒ Object
206
207
208
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 206
def icons_only
@param[:icons_only]
end
|
#max_color ⇒ Object
162
163
164
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 162
def max_color
@param[:max_color]
end
|
#max_type ⇒ Object
154
155
156
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 154
def max_type
@param[:max_type]
end
|
#max_value ⇒ Object
158
159
160
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 158
def max_value
@param[:max_value]
end
|
#maximum ⇒ Object
110
111
112
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 110
def maximum
@param[:maximum]
end
|
#mid_color ⇒ Object
150
151
152
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 150
def mid_color
@param[:mid_color]
end
|
#mid_type ⇒ Object
142
143
144
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 142
def mid_type
@param[:mid_type]
end
|
#mid_value ⇒ Object
146
147
148
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 146
def mid_value
@param[:mid_value]
end
|
#min_color ⇒ Object
138
139
140
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 138
def min_color
@param[:min_color]
end
|
#min_type ⇒ Object
130
131
132
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 130
def min_type
@param[:min_type]
end
|
#min_value ⇒ Object
134
135
136
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 134
def min_value
@param[:min_value]
end
|
#minimum ⇒ Object
114
115
116
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 114
def minimum
@param[:minimum]
end
|
#priority ⇒ Object
98
99
100
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 98
def priority
@param[:priority]
end
|
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 218
def range_param_for_conditional_formatting(*args) range_start_cell_for_conditional_formatting(*args)
param_for_conditional_formatting(*args)
handling_of_text_criteria if @param[:type] == 'text'
handling_of_time_period_criteria if @param[:type] == 'timePeriod'
handling_of_blanks_error_types
[@range, @param]
end
|
#reverse_icons ⇒ Object
210
211
212
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 210
def reverse_icons
@param[:reverse_icons]
end
|
#stop_if_true ⇒ Object
102
103
104
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 102
def stop_if_true
@param[:stop_if_true]
end
|
#total_icons ⇒ Object
198
199
200
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 198
def total_icons
@param[:total_icons]
end
|
#type ⇒ Object
90
91
92
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 90
def type
@param[:type]
end
|
#value ⇒ Object
118
119
120
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 118
def value
@param[:value]
end
|
#write_cf_rule ⇒ Object
54
55
56
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 54
def write_cf_rule
@writer.empty_tag('cfRule', attributes)
end
|
58
59
60
61
62
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 58
def write_cf_rule_formula_tag(tag = formula)
@writer.tag_elements('cfRule', attributes) do
write_formula_tag(tag)
end
end
|
#write_cfvo(type, value, criteria = nil) ⇒ Object
Write the <cfvo> element.
72
73
74
75
76
77
78
79
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 72
def write_cfvo(type, value, criteria = nil)
attributes = [['type', type]]
attributes << ['val', value] if value
attributes << ['gte', 0] if ptrue?(criteria)
@writer.empty_tag('cfvo', attributes)
end
|
64
65
66
67
|
# File 'lib/write_xlsx/package/conditional_format.rb', line 64
def write_formula_tag(data) data = data.sub(/^=/, '') if data.respond_to?(:sub)
@writer.data_element('formula', data)
end
|