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.
-
#fill ⇒ Color
readonly
Fill type.
-
#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.
-
#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_column_band_size ⇒ TableStyleColumnBandSize
Table style column band size.
-
#table_style_element ⇒ TableStyle
readonly
Element of table style.
-
#table_style_id ⇒ String
readonly
Id of table style.
-
#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.
-
#style ⇒ TableStyle
Style of table.
-
#table_style ⇒ DocumentStyle
For compatibility reasons.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ TableProperties
Returns a new instance of TableProperties.
40 41 42 43 44 |
# 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 |
Instance Attribute Details
#caption ⇒ ValuedChild
Returns caption of table.
30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 30 def @caption end |
#column_banding_size ⇒ Object
Returns the value of attribute column_banding_size.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def column_banding_size @column_banding_size end |
#description ⇒ ValuedChild
Returns description of table.
32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 32 def description @description end |
#fill ⇒ Color (readonly)
Returns fill type.
34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 34 def fill @fill end |
#grid_column ⇒ Object
Returns the value of attribute grid_column.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def grid_column @grid_column end |
#jc ⇒ Object
Returns the value of attribute jc.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def jc @jc end |
#row_banding_size ⇒ Object
Returns the value of attribute row_banding_size.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def row_banding_size @row_banding_size end |
#shade ⇒ Shade
Returns shade color of table.
28 29 30 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 28 def shade @shade end |
#stretching ⇒ Object
Returns the value of attribute stretching.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def stretching @stretching end |
#table_borders ⇒ Object
Returns the value of attribute table_borders.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_borders @table_borders end |
#table_cell_margin ⇒ Object
Returns the value of attribute table_cell_margin.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_cell_margin @table_cell_margin end |
#table_cell_spacing ⇒ OoxmlSize
Returns table cell spacing.
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 26 def table_cell_spacing @table_cell_spacing end |
#table_indent ⇒ Object
Returns the value of attribute table_indent.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_indent @table_indent end |
#table_layout ⇒ TableLayout
Returns table layout.
24 25 26 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 24 def table_layout @table_layout end |
#table_look ⇒ Object
Returns the value of attribute table_look.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_look @table_look end |
#table_positon ⇒ Object Also known as: table_properties
Returns the value of attribute table_positon.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_positon @table_positon end |
#table_style_column_band_size ⇒ TableStyleColumnBandSize
Returns table style column band size.
20 21 22 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 20 def table_style_column_band_size @table_style_column_band_size end |
#table_style_element ⇒ TableStyle (readonly)
Returns element of table style.
36 37 38 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 36 def table_style_element @table_style_element end |
#table_style_id ⇒ String (readonly)
Returns id of table style.
18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 18 def table_style_id @table_style_id end |
#table_style_row_band_size ⇒ TableStyleRowBandSize
Returns table style row band size.
22 23 24 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 22 def table_style_row_band_size @table_style_row_band_size end |
#table_width ⇒ Object
Returns the value of attribute table_width.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 15 def table_width @table_width end |
Instance Method Details
#parse(node) ⇒ TableProperties
Parse TableProperties object
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 91 92 |
# 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' @justification_object = ValuedChild.new(:symbol, parent: self).parse(node_child) @jc = @justification_object.value 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(parent: self).parse(node_child) 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 ⇒ TableStyle
Returns style of table.
95 96 97 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 95 def style root_object.table_styles.style_by_id(table_style_id) end |
#table_style ⇒ DocumentStyle
For compatibility reasons
101 102 103 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 101 def table_style root_object.document_style_by_id(table_style_element.value) end |