Class: OoxmlParser::DataField
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DataField
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb
Overview
Class for parsing <dataField> tag
Instance Attribute Summary collapse
-
#base_field ⇒ Integer
Index of the base field for the ShowDataAs calculation.
-
#base_item ⇒ Integer
Index of the base item for the ShowDataAs calculation.
-
#extension_list ⇒ ExtensionList
List of extensions.
-
#field ⇒ Integer
Index of the field in the pivotCacheRecords.
-
#name ⇒ String
readonly
Name of the data field.
-
#number_format_id ⇒ Integer
Index of the number format applied to data field.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DataField
Parse ‘<dataField>` tag # @param [Nokogiri::XML:Element] node with DataField data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#base_field ⇒ Integer
Returns index of the base field for the ShowDataAs calculation.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 7 def base_field @base_field end |
#base_item ⇒ Integer
Returns index of the base item for the ShowDataAs calculation.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 9 def base_item @base_item end |
#extension_list ⇒ ExtensionList
Returns list of extensions.
17 18 19 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 17 def extension_list @extension_list end |
#field ⇒ Integer
Returns index of the field in the pivotCacheRecords.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 11 def field @field end |
#name ⇒ String (readonly)
Returns name of the data field.
13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 13 def name @name end |
#number_format_id ⇒ Integer
Returns index of the number format applied to data field.
15 16 17 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 15 def number_format_id @number_format_id end |
Instance Method Details
#parse(node) ⇒ DataField
Parse ‘<dataField>` tag # @param [Nokogiri::XML:Element] node with DataField data
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb', line 22 def parse(node) node.attributes.each do |key, value| case key when 'baseField' @base_field = value.value.to_i when 'baseItem' @base_item = value.value.to_i when 'fld' @field = value.value.to_i when 'name' @name = value.value.to_s when 'numFmtId' @number_format_id = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'extLst' @extension_list = ExtensionList.new(parent: self).parse(node_child) end end self end |