Class: OoxmlParser::TablePosition

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTablePosition

Returns a new instance of TablePosition.



7
8
9
10
11
12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb', line 7

def initialize
  @left = nil
  @right = nil
  @top = nil
  @bottom = nil
  @position_x = nil
  @position_y = nil
end

Instance Attribute Details

#bottomObject

Returns the value of attribute bottom.



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

def bottom
  @bottom
end

#horizontal_align_from_anchorObject

Returns the value of attribute horizontal_align_from_anchor.



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

def horizontal_align_from_anchor
  @horizontal_align_from_anchor
end

#horizontal_anchorObject

Returns the value of attribute horizontal_anchor.



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

def horizontal_anchor
  @horizontal_anchor
end

#leftObject

Returns the value of attribute left.



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

def left
  @left
end

#position_xObject

Returns the value of attribute position_x.



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

def position_x
  @position_x
end

#position_yObject

Returns the value of attribute position_y.



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

def position_y
  @position_y
end

#rightObject

Returns the value of attribute right.



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

def right
  @right
end

#topObject

Returns the value of attribute top.



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

def top
  @top
end

#vertical_align_from_anchorObject

Returns the value of attribute vertical_align_from_anchor.



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

def vertical_align_from_anchor
  @vertical_align_from_anchor
end

#vertical_anchorObject

Returns the value of attribute vertical_anchor.



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

def vertical_anchor
  @vertical_anchor
end

Class Method Details

.parse(node) ⇒ Object



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

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

Instance Method Details

#to_sObject



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

def to_s
  'Table position left: ' + @left.to_s + ', right: ' + @right.to_s + ', top: ' + @top.to_s + ', bottom: ' + @bottom.to_s + 'position x: ' + position_x.to_s + 'position y: ' + position_x.to_s
end