Class: OoxmlParser::TableStyleProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb

Overview

Class for parsing ‘w:tblStylePr`

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(type: nil, parent: nil) ⇒ TableStyleProperties

Returns a new instance of TableStyleProperties.



22
23
24
25
26
27
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 22

def initialize(type: nil, parent: nil)
  @type = type
  @run_properties = nil
  @table_cell_properties = CellProperties.new
  super(parent: parent)
end

Instance Attribute Details

#paragraph_propertiesParagraphProperties

Returns properties of paragraph.

Returns:



18
19
20
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 18

def paragraph_properties
  @paragraph_properties
end

#run_propertiesRunProperties

Returns properties of run.

Returns:



10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 10

def run_properties
  @run_properties
end

#table_cell_propertiesCellProperties Also known as: cell_properties

Returns properties of table cell.

Returns:



12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 12

def table_cell_properties
  @table_cell_properties
end

#table_propertiesTableProperties

Returns properties of table.

Returns:



14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 14

def table_properties
  @table_properties
end

#table_row_propertiesTableRowProperties (readonly)

Returns properties of table row.

Returns:



16
17
18
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 16

def table_row_properties
  @table_row_properties
end

#typeSymbol

Returns type of Table Style Properties.

Returns:

  • (Symbol)

    type of Table Style Properties



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 8

def type
  @type
end

Instance Method Details

#parse(node) ⇒ TableStyleProperties

Parse table style property

Parameters:

  • node (Nokogiri::XML::Element)

    node to parse

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb', line 32

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'type'
      @type = value.value.to_sym
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'rPr'
      @run_properties = RunProperties.new(parent: self).parse(node_child)
    when 'tcPr'
      @table_cell_properties = CellProperties.new(parent: self).parse(node_child)
    when 'tblPr'
      @table_properties = TableProperties.new(parent: self).parse(node_child)
    when 'trPr'
      @table_row_properties = TableRowProperties.new(parent: self).parse(node_child)
    when 'pPr'
      @paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
    end
  end
  self
end