Class: OoxmlParser::TablePosition

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

Overview

Table Position Data

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

#bottomObject

Returns the value of attribute bottom.



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

def bottom
  @bottom
end

#horizontal_align_from_anchorObject

Returns the value of attribute horizontal_align_from_anchor.



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

def horizontal_align_from_anchor
  @horizontal_align_from_anchor
end

#horizontal_anchorObject

Returns the value of attribute horizontal_anchor.



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

def horizontal_anchor
  @horizontal_anchor
end

#leftObject

Returns the value of attribute left.



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

def left
  @left
end

#position_xObject

Returns the value of attribute position_x.



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

def position_x
  @position_x
end

#position_yObject

Returns the value of attribute position_y.



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

def position_y
  @position_y
end

#rightObject

Returns the value of attribute right.



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

def right
  @right
end

#topObject

Returns the value of attribute top.



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

def top
  @top
end

#vertical_align_from_anchorObject

Returns the value of attribute vertical_align_from_anchor.



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

def vertical_align_from_anchor
  @vertical_align_from_anchor
end

#vertical_anchorObject

Returns the value of attribute vertical_anchor.



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

def vertical_anchor
  @vertical_anchor
end

Instance Method Details

#parse(node) ⇒ TablePosition

Parse TablePosition object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb', line 22

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'leftFromText'
      @left = OoxmlSize.new(value.value.to_f)
    when 'rightFromText'
      @right = OoxmlSize.new(value.value.to_f)
    when 'topFromText'
      @top = OoxmlSize.new(value.value.to_f)
    when 'bottomFromText'
      @bottom = OoxmlSize.new(value.value.to_f)
    when 'tblpX'
      @position_x = OoxmlSize.new(value.value.to_f)
    when 'tblpY'
      @position_y = OoxmlSize.new(value.value.to_f)
    when 'vertAnchor'
      @vertical_anchor = value.value.to_sym
    when 'horzAnchor'
      @horizontal_anchor = value.value.to_sym
    when 'tblpXSpec'
      @horizontal_align_from_anchor = value.value.to_sym
    when 'tblpYSpec'
      @vertical_align_from_anchor = value.value.to_sym
    end
  end
  self
end

#to_sString

Returns result of convert of object to string.

Returns:

  • (String)

    result of convert of object to string



10
11
12
13
14
15
16
17
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb', line 10

def to_s
  "Table position left: #{left}, " \
    "right: #{right}, " \
    "top: #{top}, " \
    "bottom #{bottom}, " \
    "position x: #{position_x}, " \
    "position y: #{position_y}"
end