Method: Writeexcel::Format#set_bg_color
- Defined in:
- lib/writeexcel/format.rb
#set_bg_color(color = 0x41) ⇒ Object
The set_bg_color() method can be used to set the background colour of a pattern. Patterns are defined via the set_pattern() method. If a pattern hasn’t been defined then a solid fill pattern is used as the default.
Default state: Color is off
Default action: Solid fill.
Valid args: See set_color()
Here is an example of how to set up a solid fill in a cell:
format = workbook.add_format
format.set_pattern() # This is optional when using a solid fill
format.set_bg_color('green')
worksheet.write('A1', 'Ray', format)
For further examples see the ‘Patterns’ worksheet created by formats.rb.
1525 1526 1527 |
# File 'lib/writeexcel/format.rb', line 1525 def set_bg_color(color = 0x41) @bg_color = get_color(color) end |