Class: OoxmlParser::XlsxDrawingPositionParameters

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb

Overview

Class for parsing offset of drawing ‘xdr:from`, `xdr:to`

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#columnObject

Returns the value of attribute column.



6
7
8
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb', line 6

def column
  @column
end

#column_offsetObject

Returns the value of attribute column_offset.



6
7
8
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb', line 6

def column_offset
  @column_offset
end

#rowObject

Returns the value of attribute row.



6
7
8
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb', line 6

def row
  @row
end

#row_offsetObject

Returns the value of attribute row_offset.



6
7
8
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb', line 6

def row_offset
  @row_offset
end

Instance Method Details

#parse(node) ⇒ XlsxDrawingPositionParameters

Parse XlsxDrawingPositionParameters object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb', line 11

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'col'
      @column = Coordinates.get_column_name(node_child.text.to_i + 1)
    when 'colOff'
      @column_offset = OoxmlSize.new(node_child.text.to_f, :emu)
    when 'row'
      @row = node_child.text.to_i + 1
    when 'rowOff'
      @row_offset = OoxmlSize.new(node_child.text.to_f, :emu)
    end
  end
  self
end