Sha256: 4d916b0e2fa610b3cef0627230af10668af6c16eb11e8392cfb728425ae24c35

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

# Foreground Color Data
module OoxmlParser
  class ForegroundColor < OOXMLDocumentObject
    attr_accessor :type, :color

    def initialize(type = nil, color = Color.new)
      @type = type
      @color = color
    end

    def nil?
      @type.nil? && @color.nil?
    end

    def self.parse(style_number)
      fill_color = ForegroundColor.new
      fill_style_node = XLSXWorkbook.styles_node.xpath('//xmlns:fill')[style_number.to_i].xpath('xmlns:patternFill')
      if fill_style_node && !fill_style_node.empty?
        fill_color.type = fill_style_node.attribute('patternType').value.to_sym if fill_style_node.attribute('patternType')
        fill_color.color = Color.parse_color_tag(fill_style_node.xpath('xmlns:fgColor').first) if fill_style_node.xpath('xmlns:fgColor')
      end
      fill_color
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb