Sha256: 43b041f95016354d4e82ca4afc6d0fc05737b16ce2f48b07037e241e948e6e3d

Contents?: true

Size: 1.61 KB

Versions: 15

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Table Position Data
  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

    # @return [String] result of convert of object to string
    def to_s
      "Table position left: #{left}, "\
        "right: #{right}, "\
        "top: #{top}, "\
        "bottom #{bottom}, "\
        "position x: #{position_x}, "\
        "position y: #{position_y}"
    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

15 entries across 15 versions & 1 rubygems

Version Path
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.21.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb