Class: OoxmlParser::Table
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Table
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table.rb
Instance Attribute Summary collapse
-
#grid ⇒ Object
Returns the value of attribute grid.
-
#number ⇒ Object
Returns the value of attribute number.
-
#properties ⇒ Object
(also: #table_properties)
Returns the value of attribute properties.
-
#rows ⇒ Object
Returns the value of attribute rows.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(rows = [], parent: nil) ⇒ Table
constructor
A new instance of Table.
- #inspect ⇒ Object
-
#parse(node, number = 0, default_table_properties = TableProperties.new) ⇒ Table
Parse Table object.
- #to_s ⇒ Object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(rows = [], parent: nil) ⇒ Table
Returns a new instance of Table.
10 11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 10 def initialize(rows = [], parent: nil) @rows = rows @parent = parent end |
Instance Attribute Details
#grid ⇒ Object
Returns the value of attribute grid.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 8 def grid @grid end |
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 8 def number @number end |
#properties ⇒ Object Also known as: table_properties
Returns the value of attribute properties.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 8 def properties @properties end |
#rows ⇒ Object
Returns the value of attribute rows.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 8 def rows @rows end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 21 def inspect to_s end |
#parse(node, number = 0, default_table_properties = TableProperties.new) ⇒ Table
Parse Table object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 28 def parse(node, number = 0, default_table_properties = TableProperties.new) table_properties = default_table_properties.dup table_properties.jc = :left node.xpath('*').each do |node_child| case node_child.name when 'tblGrid' @grid = TableGrid.new(parent: self).parse(node_child) when 'tr' @rows << TableRow.new(parent: self).parse(node_child) when 'tblPr' @properties = TableProperties.new(parent: self).parse(node_child) end end @number = number self end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 17 def to_s "Rows: #{@rows.join(',')}" end |