Class: OoxmlParser::TableProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/table_properties.rb
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#column_banding_size ⇒ Object
Returns the value of attribute column_banding_size.
-
#grid_column ⇒ Object
Returns the value of attribute grid_column.
-
#jc ⇒ Object
Returns the value of attribute jc.
-
#right_to_left ⇒ Object
Returns the value of attribute right_to_left.
-
#row_banding_size ⇒ Object
Returns the value of attribute row_banding_size.
-
#shd ⇒ Object
Returns the value of attribute shd.
-
#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_indent ⇒ Object
Returns the value of attribute table_indent.
-
#table_look ⇒ Object
Returns the value of attribute table_look.
-
#table_positon ⇒ Object
(also: #table_properties)
Returns the value of attribute table_positon.
-
#table_properties ⇒ Object
Sets the attribute table_properties.
-
#table_style ⇒ Object
Returns the value of attribute table_style.
-
#table_width ⇒ Object
Returns the value of attribute table_width.
Class Method Summary collapse
Instance Method Summary collapse
- #copy ⇒ Object
-
#initialize ⇒ TableProperties
constructor
A new instance of TableProperties.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize ⇒ TableProperties
Returns a new instance of TableProperties.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 14 def initialize @table_indent = nil @table_cell_margin = nil @jc = :left @shd = nil @stretching = true @table_borders = TableBorders.new @table_properties = nil @table_width = nil @grid_column = nil @right_to_left = nil @style = nil end |
Instance Attribute Details
#column_banding_size ⇒ Object
Returns the value of attribute column_banding_size.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def column_banding_size @column_banding_size end |
#grid_column ⇒ Object
Returns the value of attribute grid_column.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def grid_column @grid_column end |
#jc ⇒ Object
Returns the value of attribute jc.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def jc @jc end |
#right_to_left ⇒ Object
Returns the value of attribute right_to_left.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def right_to_left @right_to_left end |
#row_banding_size ⇒ Object
Returns the value of attribute row_banding_size.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def row_banding_size @row_banding_size end |
#shd ⇒ Object
Returns the value of attribute shd.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def shd @shd end |
#stretching ⇒ Object
Returns the value of attribute stretching.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def stretching @stretching end |
#style ⇒ Object
Returns the value of attribute style.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def style @style end |
#table_borders ⇒ Object
Returns the value of attribute table_borders.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_borders @table_borders end |
#table_cell_margin ⇒ Object
Returns the value of attribute table_cell_margin.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_cell_margin @table_cell_margin end |
#table_indent ⇒ Object
Returns the value of attribute table_indent.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_indent @table_indent end |
#table_look ⇒ Object
Returns the value of attribute table_look.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_look @table_look end |
#table_positon ⇒ Object Also known as: table_properties
Returns the value of attribute table_positon.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_positon @table_positon end |
#table_properties=(value) ⇒ Object
Sets the attribute table_properties
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_properties=(value) @table_properties = value end |
#table_style ⇒ Object
Returns the value of attribute table_style.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_style @table_style end |
#table_width ⇒ Object
Returns the value of attribute table_width.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 9 def table_width @table_width end |
Class Method Details
.parse(table_properties_node) ⇒ Object
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 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 44 def self.parse(table_properties_node) table_properties = TableProperties.new table_properties_node.xpath('*').each do |table_props_node_child| case table_props_node_child.name when 'tableStyleId' table_properties.style = TableStyle.parse(style_id: table_props_node_child.text) when 'tblBorders' table_properties.table_borders = TableBorders.parse(table_props_node_child) when 'tblStyle' style = DocxParagraphRun.get_style_by_id(table_props_node_child.attribute('val').value) next if style.nil? table_properties.table_style = TableStyle.parse(table_style_node: style) when 'tblW' table_properties.table_width = table_props_node_child.attribute('w').text.to_f / 567.0 when 'jc' table_properties.jc = table_props_node_child.attribute('val').text.to_sym when 'shd' unless table_props_node_child.attribute('fill').nil? background_color = Color.from_int16(table_props_node_child.attribute('fill').value) table_properties.shd = background_color end when 'tblLook' table_properties.table_look = TableLook.parse(table_props_node_child) when 'tblInd' table_properties.table_indent = table_props_node_child.attribute('w').text.to_f / 567.0 when 'tblpPr' table_properties.table_positon = TablePosition.parse(table_props_node_child) when 'tblCellMar' table_properties.table_cell_margin = TableMargins.parse(table_props_node_child) end end table_properties.table_look = TableLook.parse(table_properties_node) if table_properties.table_look.nil? table_properties.right_to_left = OOXMLDocumentObject.option_enabled?(table_properties_node, 'rtl') table_properties end |
Instance Method Details
#copy ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_properties.rb', line 28 def copy table = TableProperties.new table.jc = @jc table.table_width = @table_width table.shd = @shd table.stretching = @stretching table.table_borders = @table_borders table.table_properties = @table_properties table.table_cell_margin = @table_cell_margin table.table_indent = @table_indent table.grid_column = @grid_column table.right_to_left = @right_to_left table.style = style table end |