Class: OoxmlParser::TableColumn

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

Overview

Class for ‘tableColumn` tag data

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

#idInteger (readonly)

Returns id of table column.

Returns:

  • (Integer)

    id of table column



7
8
9
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns/table_column.rb', line 7

def id
  @id
end

#nameString (readonly)

Returns name.

Returns:

  • (String)

    name



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns/table_column.rb', line 9

def name
  @name
end

#totals_row_functionString (readonly)

Returns total row function.

Returns:

  • (String)

    total row function



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

def totals_row_function
  @totals_row_function
end

#totals_row_labelString (readonly)

Returns total row label.

Returns:

  • (String)

    total row label



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

def totals_row_label
  @totals_row_label
end

Instance Method Details

#parse(node) ⇒ TableColumn

Parse Table Column data

Parameters:

  • node (Nokogiri::XML:Element)

    with TableColumn data

Returns:



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

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'id'
      @id = value.value.to_i
    when 'name'
      @name = value.value.to_s
    when 'totalsRowLabel'
      @totals_row_label = value.value.to_s
    when 'totalsRowFunction'
      @totals_row_function = value.value.to_s
    end
  end
  self
end