Class: OoxmlParser::TablePart
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TablePart
- Defined in:
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/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.
-
#name ⇒ Object
Returns the value of attribute name.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#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
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
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.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 7 def autofilter @autofilter end |
#columns ⇒ Object
Returns the value of attribute columns.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 7 def columns @columns end |
#display_name ⇒ Object
Returns the value of attribute display_name.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 7 def display_name @display_name end |
#extension_list ⇒ ExtensionList
Returns list of extensions.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 9 def extension_list @extension_list end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 7 def name @name end |
#reference ⇒ Object
Returns the value of attribute reference.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 7 def reference @reference end |
#table_style_info ⇒ TableStyleInfo
Returns describe style of table.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 11 def table_style_info @table_style_info end |
Instance Method Details
#parse(node) ⇒ TablePart
Parse TablePart object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb', line 16 def parse(node) link_to_table_part_xml = OOXMLDocumentObject.get_link_from_rels(node.attribute('id').value) doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_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 'tableStyleInfo' @table_style_info = TableStyleInfo.new(parent: self).parse(node_child) end end self end |