Sha256: c1f5db54ff09f3ed034efce74caae54c278b6ff519eed17b7e5de1f74b99816f

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

# Docx Drawing Distance From Text
module OoxmlParser
  class DocxDrawingDistanceFromText
    attr_accessor :top, :bottom, :left, :right

    def self.parse(distance_node)
      distance_from_text = DocxDrawingDistanceFromText.new
      distance_node.attributes.each do |key, value|
        case key
        when 'distT'
          distance_from_text.top = (value.value.to_f / 360_000.0).round(2)
        when 'distB'
          distance_from_text.bottom = (value.value.to_f / 360_000.0).round(2)
        when 'distL'
          distance_from_text.left = (value.value.to_f / 360_000.0).round(2)
        when 'distR'
          distance_from_text.right = (value.value.to_f / 360_000.0).round(2)
        end
      end
      distance_from_text
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb
ooxml_parser-0.1.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb