Class: OoxmlParser::FilterColumn

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter/filter_column.rb

Overview

Class for ‘filterColumn` data The filterColumn collection identifies a particular column in the AutoFilter range and specifies filter information that has been applied to this column.

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ FilterColumn

Returns a new instance of FilterColumn.



15
16
17
18
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter/filter_column.rb', line 15

def initialize(parent: nil)
  @show_button = true
  super
end

Instance Attribute Details

#custom_filtersCustomFilters (readonly)

Returns list of filters.

Returns:



13
14
15
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter/filter_column.rb', line 13

def custom_filters
  @custom_filters
end

#show_buttonTrue, False

Returns Flag indicating whether the filter button is visible.

Returns:

  • (True, False)

    Flag indicating whether the filter button is visible.



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter/filter_column.rb', line 11

def show_button
  @show_button
end

Instance Method Details

#parse(node) ⇒ FilterColumn

Parse FilterColumn data

Parameters:

  • node (Nokogiri::XML:Element)

    with FilterColumn data

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter/filter_column.rb', line 23

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'showButton'
      @show_button = attribute_enabled?(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'customFilters'
      @custom_filters = CustomFilters.new(parent: self).parse(node_child)
    end
  end
  self
end