Class: OoxmlParser::TablePosition

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

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?

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.



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

Instance Method Details

#parse(node) ⇒ TablePosition

Parse TablePosition object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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

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_sObject



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

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