class OoxmlParser::Fill

Parsing ‘fill` tag

Attributes

color2[R]

@return [Color] second color

file[R]

@return [FileReference] file of fill

id[R]

@return [String] id of file

pattern_fill[RW]

@return [PatternFill] pattern fill

value[R]

@return [Symbol] value

Public Instance Methods

parse(node) click to toggle source

Parse Fill data @param [Nokogiri::XML:Element] node with Fill data @return [Fill] value of Fill data

# File lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb, line 21
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'color2'
      @color2 = Color.new(parent: self).parse_hex_string(value.value.split.first.delete('#'))
    when 'id'
      @id = value.value.to_s
      @file = FileReference.new(parent: self).parse(node)
    when 'type'
      @type = value_to_symbol(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'patternFill'
      @pattern_fill = PatternFill.new(parent: self).parse(node_child)
    end
  end
  self
end
to_color() click to toggle source

Convert Fill to color @return [OoxmlColor] result

# File lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb, line 45
def to_color
  pattern_fill.foreground_color
end