Sha256: 8010513e3f00c3c5ad505046707c97ccad7035244b80bc92011a965b788c3eb6
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# Docx Drawing Position module OoxmlParser class DocxDrawingPosition attr_accessor :relative_from, :offset, :align def self.parse(drawing_position_node) position = DocxDrawingPosition.new position.relative_from = case drawing_position_node.attribute('relativeFrom').value when 'leftMargin' :left_margin when 'rightMargin' :right_margin when 'bottomMargin' :bottom_margin when 'topMargin' :top_margin when 'insideMargin' :inside_margin when 'outsideMargin' :outside_margin else drawing_position_node.attribute('relativeFrom').value.to_sym end drawing_position_node.xpath('*').each do |position_node_child| case position_node_child.name when 'posOffset', 'pctPosHOffset', 'pctPosVOffset' position.offset = (position_node_child.text.to_f / 360_000.0).round(3) when 'align' position.align = position_node_child.text.to_sym end end position end end end
Version data entries
2 entries across 2 versions & 1 rubygems