class OoxmlParser::TableProperties
Class for parsing `w:tblPr` tags
Attributes
caption[RW]
@return [ValuedChild] caption of table
column_banding_size[RW]
description[RW]
@return [ValuedChild] description of table
fill[R]
@return [Color] fill type
grid_column[RW]
jc[RW]
row_banding_size[RW]
shade[RW]
@return [Shade] shade color of table
stretching[RW]
table_borders[RW]
table_cell_margin[RW]
table_cell_spacing[RW]
@return [OoxmlSize] table cell spacing
table_indent[RW]
table_layout[RW]
@return [TableLayout] table layout
table_look[RW]
table_positon[RW]
table_properties[RW]
table_style_column_band_size[RW]
@return [TableStyleColumnBandSize] table style column band size
table_style_element[R]
@return [TableStyle] element of table style
table_style_id[R]
@return [String] id of table style
table_style_row_band_size[RW]
@return [TableStyleRowBandSize] table style row band size
table_width[RW]
Public Class Methods
new(parent: nil)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/table/table_properties.rb, line 40 def initialize(parent: nil) @jc = :left @table_borders = TableBorders.new super end
Public Instance Methods
parse(node)
click to toggle source
Parse TableProperties
object @param node [Nokogiri::XML:Element] node to parse @return [TableProperties] result of parsing
# File lib/ooxml_parser/common_parser/common_data/table/table_properties.rb, line 49 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'tableStyleId' @table_style_id = node_child.text when 'tblBorders' @table_borders = TableBorders.new(parent: self).parse(node_child) when 'tblStyle' # TODO: Incorrect but to keep compatibility @table_style_element = TableStyle.new(parent: self).parse(node_child) 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 'solidFill' @fill = PresentationFill.new(parent: self).parse(node) 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
style()
click to toggle source
@return [TableStyle] style of table
# File lib/ooxml_parser/common_parser/common_data/table/table_properties.rb, line 94 def style root_object.table_styles.style_by_id(table_style_id) end
table_style()
click to toggle source
For compatibility reasons @return [DocumentStyle] table style of table
# File lib/ooxml_parser/common_parser/common_data/table/table_properties.rb, line 100 def table_style root_object.document_style_by_id(table_style_element.value) end