class Axlsx::PatternFill

A PatternFill is the pattern and solid fill styling for a cell. @note The recommended way to manage styles is with Styles#add_style @see Style#add_style

Attributes

bgColor[R]

The color to use for the background of the fill when the type is not solid. @return [Color]

fgColor[R]

The color to use for the the background in solid fills. @return [Color]

patternType[R]

The pattern type to use @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

@see Office Open XML Part 1 18.18.55

Public Class Methods

new(options={}) click to toggle source

Creates a new PatternFill Object @option options [Symbol] patternType @option options [Color] fgColor @option options [Color] bgColor

# File lib/axlsx/stylesheet/pattern_fill.rb, line 13
def initialize(options={})
  @patternType = :none
  parse_options options
end

Public Instance Methods

bgColor=(v) click to toggle source

@see bgColor

# File lib/axlsx/stylesheet/pattern_fill.rb, line 54
def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end
fgColor=(v) click to toggle source

@see fgColor

# File lib/axlsx/stylesheet/pattern_fill.rb, line 52
def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor=v end
patternType=(v) click to toggle source

@see patternType

# File lib/axlsx/stylesheet/pattern_fill.rb, line 56
def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end
to_xml_string(str = '') click to toggle source

Serializes the object @param [String] str @return [String]

# 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