summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
diff options
context:
space:
mode:
authorNoel Peden <[email protected]>2013-04-04 10:29:54 -0700
committerNoel Peden <[email protected]>2013-04-04 10:29:54 -0700
commite56b36a74fadf2f1c1334ade8388c1e046dcad63 (patch)
treec585d77c878b6cd4cbf4eda08bad89bfbbac662b /lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
parent743a56261d5e6db12e816ea6069b29d4b5df01d7 (diff)
downloadcaxlsx-e56b36a74fadf2f1c1334ade8388c1e046dcad63.tar.gz
caxlsx-e56b36a74fadf2f1c1334ade8388c1e046dcad63.zip
Added support for specifying between/notBetween formula in an array.
Diffstat (limited to 'lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
index a0ce6a41..39b9612b 100644
--- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
+++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
@@ -25,7 +25,7 @@ module Axlsx
# @option options [Integer] stdDev The number of standard deviations above or below the average to match
# @option options [Boolean] stopIfTrue Stop evaluating rules after this rule matches
# @option options [Symbol] timePeriod The time period in a date occuring... rule
- # @option options [String] formula The formula to match against in i.e. an equal rule
+ # @option options [String] formula The formula to match against in i.e. an equal rule. Use a [minimum, maximum] array for cellIs between/notBetween conditionals.
def initialize(options={})
@color_scale = @data_bar = @icon_set = @formula = nil
parse_options options
@@ -180,7 +180,7 @@ module Axlsx
# @see timePeriod
def timePeriod=(v); Axlsx::validate_time_period_type(v); @timePeriod = v end
# @see formula
- def formula=(v); Axlsx::validate_string(v); @formula = v end
+ def formula=(v); [*v].each {|x| Axlsx::validate_string(x) }; @formula = v end
# @see color_scale
def color_scale=(v)
@@ -208,7 +208,7 @@ module Axlsx
str << '<cfRule '
serialized_attributes str
str << '>'
- str << '<formula>' << self.formula << '</formula>' if @formula
+ str << '<formula>' << [*self.formula].join('</formula><formula>') << '</formula>' if @formula
@color_scale.to_xml_string(str) if @color_scale && @type == :colorScale
@data_bar.to_xml_string(str) if @data_bar && @type == :dataBar
@icon_set.to_xml_string(str) if @icon_set && @type == :iconSet