Class: OoxmlParser::TablePart
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TablePart
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb
Overview
Class for ‘tablePart` data
Instance Attribute Summary collapse
-
#autofilter ⇒ Object
Returns the value of attribute autofilter.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#extension_list ⇒ ExtensionList
List of extensions.
-
#id ⇒ String
readonly
Id of table part.
-
#name ⇒ Object
Returns the value of attribute name.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#table_columns ⇒ TableColumns
readonly
List of table columns.
-
#table_style_info ⇒ TableStyleInfo
Describe style of table.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ TablePart
Parse TablePart object.
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
#autofilter ⇒ Object
Returns the value of attribute autofilter.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 12 def autofilter @autofilter end |
#columns ⇒ Object
Returns the value of attribute columns.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 12 def columns @columns end |
#display_name ⇒ Object
Returns the value of attribute display_name.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 12 def display_name @display_name end |
#extension_list ⇒ ExtensionList
Returns list of extensions.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 14 def extension_list @extension_list end |
#id ⇒ String (readonly)
Returns id of table part.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 11 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 12 def name @name end |
#reference ⇒ Object
Returns the value of attribute reference.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 12 def reference @reference end |
#table_columns ⇒ TableColumns (readonly)
Returns list of table columns.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 16 def table_columns @table_columns end |
#table_style_info ⇒ TableStyleInfo
Returns describe style of table.
18 19 20 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 18 def table_style_info @table_style_info end |
Instance Method Details
#parse(node) ⇒ TablePart
Parse TablePart object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb', line 23 def parse(node) node.attributes.each do |key, value| case key when 'id' @id = value.value.to_s end end link_to_table_part_xml = root_object.get_link_from_rels(@id) doc = parse_xml(root_object.unpacked_folder + link_to_table_part_xml.gsub('..', 'xl')) table_node = doc.xpath('xmlns:table').first table_node.attributes.each do |key, value| case key when 'name' @name = value.value.to_s when 'displayName' @display_name = value.value.to_s when 'ref' @reference = Coordinates.parser_coordinates_range value.value.to_s end end table_node.xpath('*').each do |node_child| case node_child.name when 'autoFilter' @autofilter = Autofilter.new(parent: self).parse(node_child) when 'extLst' @extension_list = ExtensionList.new(parent: self).parse(node_child) when 'tableColumns' @table_columns = TableColumns.new(parent: self).parse(node_child) when 'tableStyleInfo' @table_style_info = TableStyleInfo.new(parent: self).parse(node_child) end end self end |