class OoxmlParser::TablePosition

Table Position Data

Attributes

bottom[RW]
horizontal_align_from_anchor[RW]
horizontal_anchor[RW]
left[RW]
position_x[RW]
position_y[RW]
right[RW]
top[RW]
vertical_align_from_anchor[RW]
vertical_anchor[RW]

Public Instance Methods

parse(node) click to toggle source

Parse TablePosition object @param node [Nokogiri::XML:Element] node to parse @return [TablePosition] result of parsing

# 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_s() click to toggle source

@return [String] result of convert of object to string

# 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