Class: Oxcelix::PagSheet

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 “page” of the given sheet. Its initialize will honor the per_page option (lines per page) and the pageno option (actual page to be parsed) Cells outside the actual page will be omitted from the parsing process. Mergegroups will only be included if the starting cell is within the actual page

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Xlsheet

#attr, #end_element, #start_element

Constructor Details

#initialize(per_page, pageno) ⇒ PagSheet

Returns a new instance of PagSheet


93
94
95
96
97
# File 'lib/oxcelix/sax/xlsheet.rb', line 93

def initialize(per_page, pageno)
  @PER_PAGE = per_page
  @PAGENO   = pageno
  super()
end

Instance Attribute Details

#cellObject

Returns the value of attribute cell


91
92
93
# File 'lib/oxcelix/sax/xlsheet.rb', line 91

def cell
  @cell
end

#cellarrayObject

Returns the value of attribute cellarray


91
92
93
# File 'lib/oxcelix/sax/xlsheet.rb', line 91

def cellarray
  @cellarray
end

#mergedcellsObject

Returns the value of attribute mergedcells


91
92
93
# File 'lib/oxcelix/sax/xlsheet.rb', line 91

def mergedcells
  @mergedcells
end

#xmlstackObject

Returns the value of attribute xmlstack


91
92
93
# File 'lib/oxcelix/sax/xlsheet.rb', line 91

def xmlstack
  @xmlstack
end

Instance Method Details

#text(str) ⇒ Object


99
100
101
102
103
104
105
106
107
# File 'lib/oxcelix/sax/xlsheet.rb', line 99

def text(str)
  if @xmlstack.last == :c
    if @cell.type != "shared" && @cell.type != "e" && str.numeric? && ((@PER_PAGE * (@PAGENO-1)..(@PER_PAGE*@PAGENO-1)).include?@cell.y)
      @cell.v str
      @cellarray << @cell
    end
    @cell = Cell.new
  end
end