Sha256: e3cc560e578bfeb5e21267d415205e63ed77f19bb0b5fe76ad28ef531f6fb64f

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

module OoxmlParser
  # Parsing `patternFill` tag
  class PatternFill < OOXMLDocumentObject
    # @return [String] pattern type
    attr_accessor :pattern_type
    # @return [Color] foreground color
    attr_accessor :foreground_color
    # @return [Color] background color
    attr_accessor :background_color

    # Parse PatternFill data
    # @param [Nokogiri::XML:Element] node with PatternFill data
    # @return [PatternFill] value of PatternFill data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'patternType'
          @pattern_type = value.value.to_sym
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'fgColor'
          @foreground_color = Color.parse_color_tag(node_child)
        when 'bgColor'
          @background_color = Color.parse_color_tag(node_child)
        end
      end
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.2.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb