Class: Axlsx::PatternFill
- Inherits:
-
Object
- Object
- Axlsx::PatternFill
- Defined in:
- lib/axlsx/stylesheet/pattern_fill.rb
Overview
Note:
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(xml) ⇒ String
Serializes the pattern fill.
Constructor Details
#initialize(options = {}) ⇒ PatternFill
Creates a new PatternFill Object
44 45 46 47 48 49 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 44 def initialize(={}) @patternType = :none .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#bgColor ⇒ Color
The color to use for the background of the fill when the type is not solid.
13 14 15 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 13 def bgColor @bgColor end |
#fgColor ⇒ Color
The color to use for the the background in solid fills.
9 10 11 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 9 def fgColor @fgColor end |
#patternType ⇒ Object
Note:
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
38 39 40 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 38 def patternType @patternType end |
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the pattern fill
60 61 62 63 64 |
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 60 def to_xml(xml) xml.patternFill(:patternType => self.patternType) { self.instance_values.reject { |k,v| k.to_sym == :patternType }.each { |k,v| xml.send(k, v.instance_values) } } end |