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.
-
#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.
-
#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 ⇒ ValuedChild
readonly
Vertical align type.
-
#vertical_merge ⇒ TableMargins
Margins.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ CellProperties
Parse CellProperties object.
-
#vertical_align ⇒ nil, Symbol
Vertical align of cell.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
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.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def anchor @anchor end |
#borders ⇒ Object
Returns the value of attribute borders.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def borders @borders end |
#borders_properties ⇒ Object Also known as: table_cell_borders
Returns the value of attribute borders_properties.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def borders_properties @borders_properties end |
#color ⇒ Object
Returns the value of attribute color.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def color @color end |
#fill ⇒ Object
Returns the value of attribute fill.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def fill @fill end |
#grid_span ⇒ GridSpan
Returns data about grid span.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 9 def grid_span @grid_span end |
#margins ⇒ ParagraphMargins
Returns margins of text in cell.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 13 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.
24 25 26 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 24 def no_wrap @no_wrap end |
#shade ⇒ Shade
Returns shade of cell.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 15 def shade @shade end |
#table_cell_margin ⇒ TableMargins
Returns margins of cell.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 17 def table_cell_margin @table_cell_margin end |
#table_cell_width ⇒ Object
Returns the value of attribute table_cell_width.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def table_cell_width @table_cell_width end |
#text_direction ⇒ Object
Returns the value of attribute text_direction.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 7 def text_direction @text_direction end |
#vertical_align_object ⇒ ValuedChild (readonly)
Returns vertical align type.
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 26 def vertical_align_object @vertical_align_object end |
#vertical_merge ⇒ TableMargins
Returns margins.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 11 def vertical_merge @vertical_merge end |
Instance Method Details
#parse(node) ⇒ CellProperties
Parse CellProperties object
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 86 87 88 89 90 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 33 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 = ValuedChild.new(:symbol, parent: self).parse(node_child) when 'vAlign' @vertical_align_object = ValuedChild.new(:symbol, parent: self).parse(node_child) when 'gridSpan' @grid_span = GridSpan.new(parent: self).parse(node_child) when 'tcW' @table_cell_width = OoxmlSize.new.parse(node_child) when 'tcMar' @table_cell_margin = TableMargins.new(parent: self).parse(node_child) when 'textDirection' @text_direction_object = ValuedChild.new(:string, parent: self).parse(node_child) @text_direction = value_to_symbol(@text_direction_object) 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 'tcBdr' @borders_properties = Borders.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) end end self end |
#vertical_align ⇒ nil, Symbol
Returns vertical align of cell.
93 94 95 96 97 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb', line 93 def vertical_align return nil unless @vertical_align_object @vertical_align_object.value end |