diff options
| author | Noel Peden <[email protected]> | 2013-04-04 10:29:54 -0700 |
|---|---|---|
| committer | Noel Peden <[email protected]> | 2013-04-04 10:29:54 -0700 |
| commit | e56b36a74fadf2f1c1334ade8388c1e046dcad63 (patch) | |
| tree | c585d77c878b6cd4cbf4eda08bad89bfbbac662b /examples/example.rb | |
| parent | 743a56261d5e6db12e816ea6069b29d4b5df01d7 (diff) | |
| download | caxlsx-e56b36a74fadf2f1c1334ade8388c1e046dcad63.tar.gz caxlsx-e56b36a74fadf2f1c1334ade8388c1e046dcad63.zip | |
Added support for specifying between/notBetween formula in an array.
Diffstat (limited to 'examples/example.rb')
| -rwxr-xr-x | examples/example.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/example.rb b/examples/example.rb index 87814b97..31706c3d 100755 --- a/examples/example.rb +++ b/examples/example.rb @@ -647,8 +647,8 @@ if examples.include? :conditional_formatting money = wb.styles.add_style(:format_code => '0,000', :border => Axlsx::STYLE_THIN_BORDER) # define the style for conditional formatting - profitable = wb.styles.add_style( :fg_color=>"FF428751", - :type => :dxf) + profitable = wb.styles.add_style( :fg_color => "FF428751", :type => :dxf ) + unprofitable = wb.styles.add_style( :fg_color => "FF0000", :type => :dxf ) wb.add_worksheet(:name => "Conditional Cell Is") do |sheet| @@ -663,6 +663,8 @@ if examples.include? :conditional_formatting # Apply conditional formatting to range B3:B100 in the worksheet sheet.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 wb.add_worksheet(:name => "Conditional Color Scale") do |sheet| |
