Class: OoxmlParser::CellProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::CellProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb
Overview
Class for parsing ‘w:tcPr’ element
Instance Attribute Summary collapse
-
#anchor ⇒ Object
Returns the value of attribute anchor.
-
#anchor_center ⇒ Object
Returns the value of attribute anchor_center.
-
#borders ⇒ Object
Returns the value of attribute borders.
-
#borders_properties ⇒ Object
(also: #table_cell_borders)
Returns the value of attribute borders_properties.
-
#color ⇒ Object
Returns the value of attribute color.
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#grid_span ⇒ GridSpan
Data about grid span.
-
#horizontal_overflow ⇒ Object
Returns the value of attribute horizontal_overflow.
-
#margins ⇒ ParagraphMargins
Margins of text in cell.
-
#no_wrap ⇒ True, False
wrapping in the cell under certain conditions.
-
#shade ⇒ Shade
Shade of cell.
-
#table_cell_margin ⇒ TableMargins
Margins of cell.
-
#table_cell_width ⇒ Object
Returns the value of attribute table_cell_width.
-
#text_direction ⇒ Object
Returns the value of attribute text_direction.
-
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
-
#vertical_merge ⇒ TableMargins
Margins.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
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
#anchor ⇒ Object
Returns the value of attribute anchor.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def anchor @anchor end |
#anchor_center ⇒ Object
Returns the value of attribute anchor_center.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def anchor_center @anchor_center end |
#borders ⇒ Object
Returns the value of attribute borders.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def borders @borders end |
#borders_properties ⇒ Object Also known as: table_cell_borders
Returns the value of attribute borders_properties.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def borders_properties @borders_properties end |
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def color @color end |
#fill ⇒ Object
Returns the value of attribute fill.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def fill @fill end |
#grid_span ⇒ GridSpan
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 8 def grid_span @grid_span end |
#horizontal_overflow ⇒ Object
Returns the value of attribute horizontal_overflow.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def horizontal_overflow @horizontal_overflow end |
#margins ⇒ ParagraphMargins
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 12 def margins @margins end |
#no_wrap ⇒ True, False
wrapping in the cell under certain conditions. If the cell width is fixed, then noWrap specifies that the cell will not be smaller than that fixed value when other cells in the row are not at their minimum. If the cell width is set to auto or pct, then the content of the cell will not wrap. > ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference 17.4.30.
23 24 25 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 23 def no_wrap @no_wrap end |
#shade ⇒ Shade
14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 14 def shade @shade end |
#table_cell_margin ⇒ TableMargins
16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 16 def table_cell_margin @table_cell_margin end |
#table_cell_width ⇒ Object
Returns the value of attribute table_cell_width.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def table_cell_width @table_cell_width end |
#text_direction ⇒ Object
Returns the value of attribute text_direction.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def text_direction @text_direction end |
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 6 def vertical_align @vertical_align end |
#vertical_merge ⇒ TableMargins
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 10 def vertical_merge @vertical_merge end |
Instance Method Details
#parse(node) ⇒ Object
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 27 def parse(node) @borders_properties = Borders.new @margins = ParagraphMargins.new(parent: self).parse(node) @color = PresentationFill.new(parent: self).parse(node) @borders = Borders.new(parent: self).parse(node) node.xpath('*').each do |node_child| case node_child.name when 'vMerge' @vertical_merge = VerticalMerge.new.parse(node_child) when 'vAlign' @vertical_align = node_child.attribute('val').value.to_sym when 'gridSpan' @grid_span = GridSpan.new.parse(node_child) when 'tcW' @table_cell_width = OoxmlSize.new(node_child.attribute('w').value.to_f) when 'tcMar' @table_cell_margin = TableMargins.new(parent: self).parse(node_child) when 'textDirection' @text_direction = value_to_symbol(node_child.attribute('val')) when 'noWrap' @no_wrap = option_enabled?(node_child) when 'shd' @shade = Shade.new(parent: self).parse(node_child) when 'fill' @fill = DocxColorScheme.new(parent: self).parse(node_child) when 'tcBorders' node_child.xpath('*').each do |border_child| case border_child.name when 'top' @borders_properties.top = BordersProperties.new(parent: self).parse(border_child) when 'right' @borders_properties.right = BordersProperties.new(parent: self).parse(border_child) when 'left' @borders_properties.left = BordersProperties.new(parent: self).parse(border_child) when 'bottom' @borders_properties.bottom = BordersProperties.new(parent: self).parse(border_child) when 'tl2br' @borders_properties.top_left_to_bottom_right = BordersProperties.new(parent: self).parse(border_child) when 'tr2bl' @borders_properties.top_right_to_bottom_left = BordersProperties.new(parent: self).parse(border_child) end end end end node.attributes.each do |key, value| case key when 'vert' @text_direction = value.value.to_sym when 'anchor' @anchor = value_to_symbol(value) when 'anchorCtr' @anchor_center = value.value when 'horzOverflow' @horizontal_overflow = value.value.to_sym end end self end |