class POI::Worksheet
Public Class Methods
new(worksheet, workbook)
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 31 def initialize(worksheet, workbook) @worksheet = worksheet @workbook = workbook end
Public Instance Methods
[](row_index)
click to toggle source
Accepts a Fixnum or a String as the row_index
row_index as Fixnum: returns the 0-based row
row_index as String: assumes a cell reference within this sheet
if the value of the reference is non-nil the value is returned, otherwise the referenced cell is returned
# File lib/poi/workbook/worksheet.rb, line 59 def [](row_index) if Fixnum === row_index rows[row_index] else ref = org.apache.poi.ss.util.CellReference.new(row_index) cell = rows[ref.row][ref.col] cell && cell.value ? cell.value : cell end end
first_row()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 40 def first_row @worksheet.first_row_num end
last_row()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 44 def last_row @worksheet.last_row_num end
name()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 36 def name @worksheet.sheet_name end
poi_worksheet()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 69 def poi_worksheet @worksheet end
rows()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 48 def rows @rows ||= Rows.new(self) end
workbook()
click to toggle source
# File lib/poi/workbook/worksheet.rb, line 73 def workbook @workbook end