Class: OoxmlParser::TableCell
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableCell
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb
Overview
Class for parsing ‘tc` tags
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#grid_span ⇒ Object
Returns the value of attribute grid_span.
-
#horizontal_merge ⇒ Object
Returns the value of attribute horizontal_merge.
-
#properties ⇒ Object
(also: #cell_properties)
Returns the value of attribute properties.
-
#text_body ⇒ Object
Returns the value of attribute text_body.
-
#vertical_merge ⇒ Object
Returns the value of attribute vertical_merge.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ TableCell
constructor
A new instance of TableCell.
-
#parse(node) ⇒ TableCell
Parse TableCell object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ TableCell
Returns a new instance of TableCell.
10 11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 10 def initialize(parent: nil) @elements = [] super end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def elements @elements end |
#grid_span ⇒ Object
Returns the value of attribute grid_span.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def grid_span @grid_span end |
#horizontal_merge ⇒ Object
Returns the value of attribute horizontal_merge.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def horizontal_merge @horizontal_merge end |
#properties ⇒ Object Also known as: cell_properties
Returns the value of attribute properties.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def properties @properties end |
#text_body ⇒ Object
Returns the value of attribute text_body.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def text_body @text_body end |
#vertical_merge ⇒ Object
Returns the value of attribute vertical_merge.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 8 def vertical_merge @vertical_merge end |
Instance Method Details
#parse(node) ⇒ TableCell
Parse TableCell object
20 21 22 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 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 20 def parse(node) node.attributes.each do |key, value| case key when 'gridSpan' @grid_span = value.value.to_i when 'hMerge' @horizontal_merge = value.value.to_i when 'vMerge' @vertical_merge = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'txBody' @text_body = TextBody.new(parent: self).parse(node_child) when 'tcPr' @properties = CellProperties.new(parent: self).parse(node_child) when 'p' @elements << root_object.default_table_paragraph_style.dup.parse(node_child, 0, root_object.default_table_run_style, parent: self) when 'sdt' @elements << StructuredDocumentTag.new(parent: self).parse(node_child) when 'tbl' @elements << Table.new(parent: self).parse(node_child) end end self end |