Avik’s Ruminations

Musings on technology and life by Avik Sengupta

Do you think this is cool?

without comments

irb(main):001:0> require 'release/poi4r'
=> true
irb(main):002:0> h=Poi4r::HSSFWorkbook.new
=> #
irb(main):003:0> s=h.createSheet("Sheet1")
=> #
irb(main):004:0> r=s.createRow(0)
=> #
irb(main):005:0> c=r.createCell(0)
=> #
irb(main):006:0> c.setCellValue(24)
=> nil
irb(main):007:0> c.getNumericCellValue()
=> 24.0
irb(main):008:0> c.setCellValue("blah")
=> nil
irb(main):009:0> c.getNumericCellValue()
RuntimeError: error calling poi
java.lang.NumberFormatException: You cannot get a numeric value from a String based cell
at org.apache.poi.hssf.usermodel.HSSFCell.getNumericCellValue() (...../release/poi4r.so)
at ruby_exec (/usr/lib/libruby.so.1.8.2)
at ruby_run (/usr/lib/libruby.so.1.8.2)
at main (Unknown Source)
at __libc_start_main (/lib/tls/libc-2.3.4.so)
at _start (Unknown Source)
from (irb):9:in `getNumericCellValue'
from (irb):9
irb(main):010:0> c.getStringCellValue()
=> "blah"
irb(main):011:0>


The exception should give you an idea of whats going on. Currently just a proof of concept. Real thing coming to a repository near you… any time now!

Written by

January 28th, 2005 at 3:15 pm

Posted in Technology