Class: PoiSpreadsheet

Inherits:
Object
  • Object
show all
Defined in:
lib/poi_spreadsheet.rb

Defined Under Namespace

Classes: Workbook, Worksheet

Class Method Summary collapse

Class Method Details

.cell_classObject



21
# File 'lib/poi_spreadsheet.rb', line 21

def self.cell_class; @cell_class; end

.initObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/poi_spreadsheet.rb', line 6

def self.init
  apache_poi_path = File.dirname(__FILE__)+'/../apache/poi-3.10.1-20140818.jar'
  Rjb::load(apache_poi_path, ['-Xmx512M'])

  @cell_class = cell_class = Rjb::import('org.apache.poi.hssf.usermodel.HSSFCell')


  Rjb::import('org.apache.poi.hssf.usermodel.HSSFCreationHelper')
  Rjb::import('org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator')

  @cell_reference_class = Rjb::import('org.apache.poi.hssf.util.CellReference')
  # You can import all java classes that you need
  @loaded = true
end

.load(file) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/poi_spreadsheet.rb', line 24

def self.load file
  puts 'Hello!'
  unless @loaded
    init
  end
  Workbook.load file
end