summaryrefslogtreecommitdiffhomepage
path: root/examples/conditional_formatting/example_conditional_formatting.rb
diff options
context:
space:
mode:
authorRandy Morgan (@morgan_randy) <[email protected]>2013-04-04 15:45:20 -0700
committerRandy Morgan (@morgan_randy) <[email protected]>2013-04-04 15:45:20 -0700
commit23cc21d13f9e761d110d466428d89389d03aa61a (patch)
tree0d1bdf6ee3e263b0c170dd1bd3a3cf7b4ad95f70 /examples/conditional_formatting/example_conditional_formatting.rb
parent743a56261d5e6db12e816ea6069b29d4b5df01d7 (diff)
parentfe5b9f6569f312366ada1c963e65b255c071e1b1 (diff)
downloadcaxlsx-23cc21d13f9e761d110d466428d89389d03aa61a.tar.gz
caxlsx-23cc21d13f9e761d110d466428d89389d03aa61a.zip
Merge pull request #183 from straydogstudio/master
Added support for specifying between/notBetween formula in an array.
Diffstat (limited to 'examples/conditional_formatting/example_conditional_formatting.rb')
-rw-r--r--examples/conditional_formatting/example_conditional_formatting.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/conditional_formatting/example_conditional_formatting.rb b/examples/conditional_formatting/example_conditional_formatting.rb
index ab49d238..f5823ab4 100644
--- a/examples/conditional_formatting/example_conditional_formatting.rb
+++ b/examples/conditional_formatting/example_conditional_formatting.rb
@@ -11,8 +11,8 @@ percent = book.styles.add_style(:format_code => "0.00%", :border => Axlsx::STYLE
money = book.styles.add_style(:format_code => '0,000', :border => Axlsx::STYLE_THIN_BORDER)
# define the style for conditional formatting
-profitable = book.styles.add_style( :fg_color=>"FF428751",
- :type => :dxf)
+profitable = book.styles.add_style( :fg_color => "FF428751", :type => :dxf )
+unprofitable = wb.styles.add_style( :fg_color => "FF0000", :type => :dxf )
book.add_worksheet(:name => "Cell Is") do |ws|
@@ -27,6 +27,8 @@ book.add_worksheet(:name => "Cell Is") do |ws|
# Apply conditional formatting to range B3:B100 in the worksheet
ws.add_conditional_formatting("B3:B100", { :type => :cellIs, :operator => :greaterThan, :formula => "100000", :dxfId => profitable, :priority => 1 })
+# Apply conditional using the between operator; NOTE: supply an array to :formula for between/notBetween
+ sheet.add_conditional_formatting("C3:C100", { :type => :cellIs, :operator => :between, :formula => ["0.00%","100.00%"], :dxfId => unprofitable, :priority => 1 })
end
book.add_worksheet(:name => "Color Scale") do |ws|