diff options
Diffstat (limited to 'examples/conditional_formatting_greater_than_example.md')
| -rw-r--r-- | examples/conditional_formatting_greater_than_example.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/conditional_formatting_greater_than_example.md b/examples/conditional_formatting_greater_than_example.md new file mode 100644 index 00000000..a2ee8982 --- /dev/null +++ b/examples/conditional_formatting_greater_than_example.md @@ -0,0 +1,33 @@ +## Description + +Conditional format example: Greater Than. + +## Code + +```ruby +require 'axlsx' + +p = Axlsx::Package.new +wb = p.workbook + +s = wb.styles +high = s.add_style bg_color: 'FF428751', type: :dxf + +wb.add_worksheet(name: 'Conditional') do |sheet| + # Use 10 random number + sheet.add_row Array.new(10) { (rand * 10).floor } + + sheet.add_conditional_formatting('A1:J1', + type: :cellIs, + operator: :greaterThan, + formula: '7', + dxfId: high, + priority: 1) +end + +p.serialize 'conditional_formatting_greater_than_example.xlsx' +``` + +## Output + + |
