class PoiSpreadsheet::Worksheet::Row

Attributes

j_row[RW]
sheet[RW]

Public Class Methods

from_row(j_row) click to toggle source
# File lib/poi_spreadsheet.rb, line 195
def self.from_row j_row
  row = new
  row.j_row = j_row
  row
end
symbol_type(constant) click to toggle source
# File lib/poi_spreadsheet.rb, line 151
def self.symbol_type(constant)
  @types ||= begin
    cell = ::PoiSpreadsheet.cell_class
    {
      cell.CELL_TYPE_BOOLEAN => :boolean,
      cell.CELL_TYPE_NUMERIC => :numeric,
      cell.CELL_TYPE_STRING => :string,
      cell.CELL_TYPE_BLANK => :blank,
      cell.CELL_TYPE_ERROR => :error,
      cell.CELL_TYPE_FORMULA => :formula,
    }
  end
  @types[constant]
end

Public Instance Methods

[](col) click to toggle source
# File lib/poi_spreadsheet.rb, line 171
def [] col
  unless cell = j_row.getCell(col)
    return nil
  end

  #type = self.class.symbol_type(sheet.book._evaluator.evaluateFormulaCell(cell))
  type = self.class.symbol_type(cell.getCellType())
  
  case type
  when :boolean
    cell.getBooleanCellValue()
  when :numeric
    cell.getNumericCellValue()
  when :string
    cell.getStringCellValue()
  when :blank
    nil
  when :error
    cell.getErrorCellValue()
  when :formula
    cell.getNumericCellValue()
  end
end
[]=(col, value) click to toggle source
# File lib/poi_spreadsheet.rb, line 166
def []= col, value
  cell = j_row.getCell(col)
  cell.setCellValue(value)
end