Class: OoxmlParser::TableCell
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableCell
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text_body = nil) ⇒ TableCell
constructor
A new instance of TableCell.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize(text_body = nil) ⇒ TableCell
Returns a new instance of TableCell.
7 8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 7 def initialize(text_body = nil) @text_body = text_body @elements = [] end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def elements @elements end |
#grid_span ⇒ Object
Returns the value of attribute grid_span.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def grid_span @grid_span end |
#horizontal_merge ⇒ Object
Returns the value of attribute horizontal_merge.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def horizontal_merge @horizontal_merge end |
#properties ⇒ Object Also known as: cell_properties
Returns the value of attribute properties.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def properties @properties end |
#text_body ⇒ Object
Returns the value of attribute text_body.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def text_body @text_body end |
#vertical_merge ⇒ Object
Returns the value of attribute vertical_merge.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb', line 5 def vertical_merge @vertical_merge end |
Class Method Details
.parse(cell_node) ⇒ Object
14 15 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/common_parser/common_data/table/row/cell/cell.rb', line 14 def self.parse(cell_node) cell = TableCell.new cell_node.xpath('*').each do |cell_node_child| case cell_node_child.name when 'txBody' cell.text_body = TextBody.parse(cell_node_child) when 'tcPr' cell.properties = CellProperties.parse(cell_node_child) when 'p' paragraph = DocxParagraph.parse(cell_node_child, 0, DocumentStructure.default_table_paragraph_style, DocumentStructure.default_table_run_style) cell.elements << paragraph when 'tbl' table = Table.parse(cell_node_child) cell.elements << table end end cell_node.attributes.each do |key, value| case key when 'gridSpan' cell.grid_span = value.value.to_i when 'hMerge' cell.horizontal_merge = value.value.to_i when 'vMerge' cell.vertical_merge = value.value.to_i end end cell end |