Class: Oxcelix::Cellrange

Inherits:
Xlsheet
  • Object
show all
Defined in:
lib/oxcelix/sax/xlsheet.rb

Overview

A class that is inherited from the Xlsheet parser, but only parses a given range of the given sheet. Its initialize will accept a range parameter. Cells outside this range will not be parsed at all. Mergegroups will only be included if the starting cell is within the selected range.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Xlsheet

#attr, #end_element, #start_element

Constructor Details

#initialize(range) ⇒ Cellrange


116
117
118
119
120
121
# File 'lib/oxcelix/sax/xlsheet.rb', line 116

def initialize(range)
  @cell        = Cell.new
  @RANGE_START = range.begin
  @RANGE_END   = range.end
  super()
end

Instance Attribute Details

#cellObject

Returns the value of attribute cell


114
115
116
# File 'lib/oxcelix/sax/xlsheet.rb', line 114

def cell
  @cell
end

#cellarrayObject

Returns the value of attribute cellarray


114
115
116
# File 'lib/oxcelix/sax/xlsheet.rb', line 114

def cellarray
  @cellarray
end

#mergedcellsObject

Returns the value of attribute mergedcells


114
115
116
# File 'lib/oxcelix/sax/xlsheet.rb', line 114

def mergedcells
  @mergedcells
end

#xmlstackObject

Returns the value of attribute xmlstack


114
115
116
# File 'lib/oxcelix/sax/xlsheet.rb', line 114

def xmlstack
  @xmlstack
end

Instance Method Details

#text(str) ⇒ Object


123
124
125
126
127
128
129
130
131
132
133
# File 'lib/oxcelix/sax/xlsheet.rb', line 123

def text(str)
  if @xmlstack.last == :c
    if @cell.type != "shared" && @cell.type != "e" && str.numeric?
      if (((@cell.x(@RANGE_START)..@cell.x(@RANGE_END)).include? @cell.x) && ((@cell.y(@RANGE_START)..@cell.y(@RANGE_END)).include? @cell.y))
        @cell.v str
        @cellarray << @cell
      end
    end
    @cell = Cell.new
  end
end