Sha256: ade2773933ee31c200f2aac1a46a2c3d229e9f0a64e9dbbe332e679b7a83d471

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

# Table Position Data
module OoxmlParser
  class TablePosition < OOXMLDocumentObject
    attr_accessor :left, :right, :top, :bottom, :position_x, :position_y, :horizontal_anchor, :vertical_anchor, :vertical_align_from_anchor,
                  :horizontal_align_from_anchor

    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

    # Parse TablePosition object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [TablePosition] result of parsing
    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb