Class: OoxmlParser::Autofilter

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

Overview

Class for ‘autoFilter` data AutoFilter temporarily hides rows based on a filter criteria, which is applied column by column to a table of data in the worksheet. This collection expresses AutoFilter settings.

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#filter_columnFilterColumn

Returns data of filter column.

Returns:



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

def filter_column
  @filter_column
end

#refCoordinates

Returns Reference to the cell range to which the AutoFilter is applied.

Returns:

  • (Coordinates)

    Reference to the cell range to which the AutoFilter is applied.



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

def ref
  @ref
end

Instance Method Details

#parse(node) ⇒ Autofilter

Parse Autofilter data

Parameters:

  • node (Nokogiri::XML:Element)

    with Autofilter data

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/autofilter.rb', line 19

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'ref'
      @ref = Coordinates.parser_coordinates_range(value.value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'filterColumn'
      @filter_column = FilterColumn.new(parent: self).parse(node_child)
    end
  end
  self
end