Sha256: b7ce5b4c1361f7a8d56b286a9e5807273483165605be06fa8dc39668c8380748

Contents?: true

Size: 1.62 KB

Versions: 28

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require_relative 'icon_set/conditional_formatting_icon'
module OoxmlParser
  # Class for `iconSet` data
  class IconSet < OOXMLDocumentObject
    # @return [String] Name of icon set
    attr_reader :set
    # @return [Symbol] Specifies whether icons are shown in reverse order
    attr_reader :reverse
    # @return [Symbol] Specifies whether value is shown in a cell
    attr_reader :show_value
    # @return [Symbol] Specifies whether icon set is custom
    attr_reader :custom
    # @return [Array<ConditionalFormatValueObject>] list of values
    attr_reader :values
    # @return [Array<ConditionalFormattingIcon>] list of icons for custom sets
    attr_reader :icons

    def initialize(parent: nil)
      @values = []
      @icons = []
      @show_value = true
      super
    end

    # Parse IconSet data
    # @param [Nokogiri::XML:Element] node with IconSet data
    # @return [IconSet] value of IconSet data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'iconSet'
          @set = value.value.to_s
        when 'reverse'
          @reverse = attribute_enabled?(value)
        when 'showValue'
          @show_value = attribute_enabled?(value)
        when 'custom'
          @custom = attribute_enabled?(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'cfvo'
          @values << ConditionalFormatValueObject.new(parent: self).parse(node_child)
        when 'cfIcon'
          @icons << ConditionalFormattingIcon.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.37.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.36.1 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.36.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.35.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.34.2 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.34.1 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.34.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.33.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.32.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.31.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.30.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.29.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.28.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.27.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.26.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.25.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.24.0 lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.23.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.22.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb