Sha256: 65a186ce7fb6831c7e5d1353135034b4ec1ec12a6d5025c0b3ed42b96b1c41fe

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

module OoxmlParser
  class XlsxDrawingPositionParameters
    attr_accessor :column, :column_offset, :row, :row_offset

    def self.parse(position_node)
      drawing_position_parameters = XlsxDrawingPositionParameters.new
      position_node.xpath('*').each do |position_node_child|
        case position_node_child.name
        when 'col'
          drawing_position_parameters.column = Coordinates.get_column_name(position_node_child.text.to_i + 1)
        when 'colOff'
          drawing_position_parameters.column_offset = (position_node_child.text.to_f / 360_000.0).round(3)
        when 'row'
          drawing_position_parameters.row = position_node_child.text.to_i + 1
        when 'rowOff'
          drawing_position_parameters.row_offset = (position_node_child.text.to_f / 360_000.0).round(3)
        end
      end
      drawing_position_parameters
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb
ooxml_parser-0.1.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb