blob: fc1a12cf6953e28ed92b788f4094b154691a7258 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
## Description
Conditional format example: Between. Use array for formula.
## 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: :between,
formula: ['3', '7'],
dxfId: high,
priority: 1)
end
p.serialize 'conditional_formatting_between_example.xlsx'
```
## Output

|