Class: Axlsx::PatternFill
- Inherits:
-
Object
- Object
- Axlsx::PatternFill
- Includes:
- OptionsParser
- Defined in:
- lib/axlsx/stylesheet/pattern_fill.rb
Overview
The recommended way to manage styles is with Styles#add_style
A PatternFill is the pattern and solid fill styling for a cell.
Instance Attribute Summary collapse
-
#bgColor ⇒ Color
The color to use for the background of the fill when the type is not solid.
-
#fgColor ⇒ Color
The color to use for the the background in solid fills.
-
#patternType ⇒ Object
The pattern type to use.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PatternFill
constructor
Creates a new PatternFill Object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ PatternFill
Creates a new PatternFill Object
13 14 15 16 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 13 def initialize(={}) @patternType = :none end |
Instance Attribute Details
#bgColor ⇒ Color
The color to use for the background of the fill when the type is not solid.
24 25 26 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 24 def bgColor @bgColor end |
#fgColor ⇒ Color
The color to use for the the background in solid fills.
20 21 22 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 20 def fgColor @fgColor end |
#patternType ⇒ Object
patternType must be one of :none :solid :mediumGray :darkGray :lightGray :darkHorizontal :darkVertical :darkDown :darkUp :darkGrid :darkTrellis :lightHorizontal :lightVertical :lightDown :lightUp :lightGrid :lightTrellis :gray125 :gray0625
The pattern type to use
49 50 51 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 49 def patternType @patternType end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 61 def to_xml_string(str = '') str << '<patternFill patternType="' << patternType.to_s << '">' if fgColor.is_a?(Color) fgColor.to_xml_string str, "fgColor" end if bgColor.is_a?(Color) bgColor.to_xml_string str, "bgColor" end str << '</patternFill>' end |