Class: OoxmlParser::Selection

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view/selection.rb

Overview

Class for ‘selection` data

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

#active_cellCoordinates (readonly)

Returns Reference to the active cell.

Returns:



7
8
9
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view/selection.rb', line 7

def active_cell
  @active_cell
end

#active_cell_idInteger (readonly)

Returns Id of active cell.

Returns:

  • (Integer)

    Id of active cell



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view/selection.rb', line 9

def active_cell_id
  @active_cell_id
end

#reference_sequenceString (readonly)

Returns Selected range.

Returns:

  • (String)

    Selected range



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view/selection.rb', line 11

def reference_sequence
  @reference_sequence
end

Instance Method Details

#parse(node) ⇒ Selection

Parse Selection object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view/selection.rb', line 16

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'activeCell'
      @active_cell = Coordinates.new.parse_string(value.value)
    when 'activeCellId'
      @active_cell_id = value.value.to_i
    when 'sqref'
      @reference_sequence = value.value.to_s
    end
  end
  self
end