Class: OoxmlParser::TableStyle

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

Overview

Style of Table

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#banding_1_horizontalObject

Returns the value of attribute banding_1_horizontal.



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

def banding_1_horizontal
  @banding_1_horizontal
end

#banding_1_verticalObject

Returns the value of attribute banding_1_vertical.



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

def banding_1_vertical
  @banding_1_vertical
end

#banding_2_horizontalObject

Returns the value of attribute banding_2_horizontal.



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

def banding_2_horizontal
  @banding_2_horizontal
end

#banding_2_verticalObject

Returns the value of attribute banding_2_vertical.



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

def banding_2_vertical
  @banding_2_vertical
end

#first_columnObject

Returns the value of attribute first_column.



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

def first_column
  @first_column
end

#first_rowObject

Returns the value of attribute first_row.



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

def first_row
  @first_row
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#last_columnObject

Returns the value of attribute last_column.



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

def last_column
  @last_column
end

#last_rowObject

Returns the value of attribute last_row.



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

def last_row
  @last_row
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#northeast_cellObject

Returns the value of attribute northeast_cell.



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

def northeast_cell
  @northeast_cell
end

#northwest_cellObject

Returns the value of attribute northwest_cell.



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

def northwest_cell
  @northwest_cell
end

#southeast_cellObject

Returns the value of attribute southeast_cell.



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

def southeast_cell
  @southeast_cell
end

#southwest_cellObject

Returns the value of attribute southwest_cell.



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

def southwest_cell
  @southwest_cell
end

#valueString (readonly)

Returns value of table style.

Returns:

  • (String)

    value of table style



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

def value
  @value
end

#whole_tableObject

Returns the value of attribute whole_table.



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

def whole_table
  @whole_table
end

Instance Method Details

#parse(node) ⇒ TableStyle

Parse TableStyle object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb', line 16

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'styleId'
      @id = value.value.to_s
    when 'styleName'
      @name = value.value.to_s
    when 'val'
      @value = value.value.to_s
    end
  end

  node.xpath('*').each do |style_node_child|
    case style_node_child.name
    when 'wholeTbl'
      @whole_table = TableElement.new(parent: self).parse(style_node_child)
    when 'band1H'
      @banding_1_horizontal = TableElement.new(parent: self).parse(style_node_child)
    when 'band2H', 'band2Horz'
      @banding_2_horizontal = TableElement.new(parent: self).parse(style_node_child)
    when 'band1V'
      @banding_1_vertical = TableElement.new(parent: self).parse(style_node_child)
    when 'band2V'
      @banding_2_vertical = TableElement.new(parent: self).parse(style_node_child)
    when 'lastCol'
      @last_column = TableElement.new(parent: self).parse(style_node_child)
    when 'firstCol'
      @first_column = TableElement.new(parent: self).parse(style_node_child)
    when 'lastRow'
      @last_row = TableElement.new(parent: self).parse(style_node_child)
    when 'firstRow'
      @first_row = TableElement.new(parent: self).parse(style_node_child)
    when 'seCell'
      @southeast_cell = TableElement.new(parent: self).parse(style_node_child)
    when 'swCell'
      @southwest_cell = TableElement.new(parent: self).parse(style_node_child)
    when 'neCell'
      @northeast_cell = TableElement.new(parent: self).parse(style_node_child)
    when 'nwCell'
      @northwest_cell = TableElement.new(parent: self).parse(style_node_child)
    end
  end
  self
end