Class: Java::OrgApachePoiHssfUsermodel::HSSFRow

Inherits:
Object
  • Object
show all
Includes:
Enumerable, RubyPoiTranslations
Defined in:
lib/datashift/applications/hssf_row_extensions.rb

Overview

Instance Method Summary collapse

Methods included from RubyPoiTranslations

#cell_value, #poi_cell_type, #poi_cell_value

Instance Method Details

#[](column) ⇒ Object



33
34
35
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 33

def []( column)
  cell_value( get_or_create_cell( column ) )
end

#[]=(column, value) ⇒ Object



37
38
39
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 37

def []=( column, value )
  get_or_create_cell(column, value).setCellValue( poi_cell_value(value) )
end

#each(&_block) ⇒ Object

Iterate over each column in the row and yield on the cell



55
56
57
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 55

def each(&_block)
  cellIterator.each { |c| yield cell_value(c) }
end

#empty?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 23

def empty?
  getLastCellNum == -1
end

#get_or_create_cell(column, value = nil) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 41

def get_or_create_cell( column, value = nil )
  ref = CellReference.new(getRowNum, column)
  if value
    getCell(ref.getCol) # || createCell(column, poi_cell_type(value))
  else
    getCell(ref.getCol) # || java_send(:createCell, column)
  end
end

#idxObject



50
51
52
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 50

def idx
  getRowNum
end

#sizeObject



27
28
29
30
31
# File 'lib/datashift/applications/hssf_row_extensions.rb', line 27

def size
  # Gets the number of defined cells (NOT number of cells in the actual row!).
  # That is to say if only columns 0,4,5 have values then there would be 3.
  getPhysicalNumberOfCells # or getLastCellNum ?
end