Class: OoxmlParser::TableProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/table_properties.rb
Overview
Class for parsing ‘w:tblPr` tags
Instance Attribute Summary collapse
-
#caption ⇒ ValuedChild
Caption of table.
-
#column_banding_size ⇒ Object
Returns the value of attribute column_banding_size.
-
#description ⇒ ValuedChild
Description of table.
-
#grid_column ⇒ Object
Returns the value of attribute grid_column.
-
#jc ⇒ Object
Returns the value of attribute jc.
-
#row_banding_size ⇒ Object
Returns the value of attribute row_banding_size.
-
#shade ⇒ Shade
Shade color of table.
-
#stretching ⇒ Object
Returns the value of attribute stretching.
-
#style ⇒ Object
Returns the value of attribute style.
-
#table_borders ⇒ Object
Returns the value of attribute table_borders.
-
#table_cell_margin ⇒ Object
Returns the value of attribute table_cell_margin.
-
#table_cell_spacing ⇒ OoxmlSize
Table cell spacing.
-
#table_indent ⇒ Object
Returns the value of attribute table_indent.
-
#table_layout ⇒ TableLayout
Table layout.
-
#table_look ⇒ Object
Returns the value of attribute table_look.
-
#table_positon ⇒ Object
(also: #table_properties)
Returns the value of attribute table_positon.
-
#table_style ⇒ Object
Returns the value of attribute table_style.
-
#table_style_column_band_size ⇒ TableStyleColumnBandSize
Table style column band size.
-
#table_style_row_band_size ⇒ TableStyleRowBandSize
Table style row band size.
-
#table_width ⇒ Object
Returns the value of attribute table_width.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ TableProperties
constructor
A new instance of TableProperties.
-
#parse(node) ⇒ TableProperties
Parse TableProperties 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(parent: nil) ⇒ TableProperties
Returns a new instance of TableProperties.
32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 32 def initialize(parent: nil) @jc = :left @table_borders = TableBorders.new @parent = parent end |
Instance Attribute Details
#caption ⇒ ValuedChild
Returns caption of table.
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 26 def caption @caption end |
#column_banding_size ⇒ Object
Returns the value of attribute column_banding_size.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def column_banding_size @column_banding_size end |
#description ⇒ ValuedChild
Returns description of table.
28 29 30 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 28 def description @description end |
#grid_column ⇒ Object
Returns the value of attribute grid_column.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def grid_column @grid_column end |
#jc ⇒ Object
Returns the value of attribute jc.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def jc @jc end |
#row_banding_size ⇒ Object
Returns the value of attribute row_banding_size.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def row_banding_size @row_banding_size end |
#shade ⇒ Shade
Returns shade color of table.
24 25 26 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 24 def shade @shade end |
#stretching ⇒ Object
Returns the value of attribute stretching.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def stretching @stretching end |
#style ⇒ Object
Returns the value of attribute style.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def style @style end |
#table_borders ⇒ Object
Returns the value of attribute table_borders.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_borders @table_borders end |
#table_cell_margin ⇒ Object
Returns the value of attribute table_cell_margin.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_cell_margin @table_cell_margin end |
#table_cell_spacing ⇒ OoxmlSize
Returns table cell spacing.
22 23 24 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 22 def table_cell_spacing @table_cell_spacing end |
#table_indent ⇒ Object
Returns the value of attribute table_indent.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_indent @table_indent end |
#table_layout ⇒ TableLayout
Returns table layout.
20 21 22 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 20 def table_layout @table_layout end |
#table_look ⇒ Object
Returns the value of attribute table_look.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_look @table_look end |
#table_positon ⇒ Object Also known as: table_properties
Returns the value of attribute table_positon.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_positon @table_positon end |
#table_style ⇒ Object
Returns the value of attribute table_style.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_style @table_style end |
#table_style_column_band_size ⇒ TableStyleColumnBandSize
Returns table style column band size.
16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 16 def table_style_column_band_size @table_style_column_band_size end |
#table_style_row_band_size ⇒ TableStyleRowBandSize
Returns table style row band size.
18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 18 def table_style_row_band_size @table_style_row_band_size end |
#table_width ⇒ Object
Returns the value of attribute table_width.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 13 def table_width @table_width end |
Instance Method Details
#parse(node) ⇒ TableProperties
Parse TableProperties object
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 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 41 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'tableStyleId' @style = TableStyle.new(parent: self).parse(style_id: node_child.text) when 'tblBorders' @table_borders = TableBorders.new(parent: self).parse(node_child) when 'tblStyle' @table_style = root_object.document_style_by_id(node_child.attribute('val').value) when 'tblW' @table_width = OoxmlSize.new.parse(node_child) when 'jc' @jc = node_child.attribute('val').text.to_sym when 'shd' @shade = Shade.new(parent: self).parse(node_child) when 'tblLook' @table_look = TableLook.new(parent: self).parse(node_child) when 'tblInd' @table_indent = OoxmlSize.new(node_child.attribute('w').text.to_f) when 'tblpPr' @table_positon = TablePosition.new(parent: self).parse(node_child) when 'tblCellMar' @table_cell_margin = TableMargins.new(parent: table_properties).parse(node_child) when 'tblStyleColBandSize' @table_style_column_band_size = TableStyleColumnBandSize.new(parent: self).parse(node_child) when 'tblStyleRowBandSize' @table_style_row_band_size = TableStyleRowBandSize.new(parent: self).parse(node_child) when 'tblLayout' @table_layout = TableLayout.new(parent: self).parse(node_child) when 'tblCellSpacing' @table_cell_spacing = OoxmlSize.new.parse(node_child) when 'tblCaption' @caption = ValuedChild.new(:string, parent: self).parse(node_child) when 'tblDescription' @description = ValuedChild.new(:string, parent: self).parse(node_child) end end @table_look = TableLook.new(parent: self).parse(node) if @table_look.nil? self end |