Writing Excel File from Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing Excel File from Plugin

Steffen Rehberg
Hello,

I’m using Apachi POI to output results from my plugin into an .xls file.

Everything worked fine with the old version 1.5.1 (jakarta-poi-1.5.1-final-20020615.jar). However, the Excel file generated is not readable with Excel versions newer than Excel 2010, so I updated to the current version 3.9 (poi-3.9-20121203.jar). Here I get a problem with the createRow function:
In 1.5.1 it used to be: HSSFRow row = sheet.createRow((short)0);
In 3.9 the row number type is changed to int: HSSFRow row = sheet.createRow(0);.
This works fine as standalone, but when I use the same in my plugin, I get an error: Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFSheet.createRow(I)Lorg/apache/poi/hssf/usermodel/HSSFRow;
(when I leave it as createRow((short)0), I get the same error).

Any hints as to why this doesn’t work in the plugin are highly appreciated.

Steffen

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Writing Excel File from Plugin

ctrueden
Hi Steffen,

> Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError:
>
org.apache.poi.hssf.usermodel.HSSFSheet.createRow(I)Lorg/apache/poi/hssf/usermodel/HSSFRow;
>
> Any hints as to why this doesn’t work in the plugin are highly
> appreciated.

Perhaps you have conflicting versions of POI on your classpath. If you are
using Fiji, you can check via the command: Plugins > Utilities > Find Jar
For Class and then typing "org.apache.poi.hssf.usermodel.HSSFSheet" into
the text field.

I checked for a vanilla installation of Fiji, and that class is not
present. But maybe you have extra plugins installed which conflict?

Regards,
Curtis


On Wed, Jan 8, 2014 at 10:28 AM, Steffen Rehberg <[hidden email]>wrote:

> Hello,
>
> I’m using Apachi POI to output results from my plugin into an .xls file.
>
> Everything worked fine with the old version 1.5.1
> (jakarta-poi-1.5.1-final-20020615.jar). However, the Excel file generated
> is not readable with Excel versions newer than Excel 2010, so I updated to
> the current version 3.9 (poi-3.9-20121203.jar). Here I get a problem with
> the createRow function:
> In 1.5.1 it used to be: HSSFRow row = sheet.createRow((short)0);
> In 3.9 the row number type is changed to int: HSSFRow row =
> sheet.createRow(0);.
> This works fine as standalone, but when I use the same in my plugin, I get
> an error: Exception in thread "AWT-EventQueue-0"
> java.lang.NoSuchMethodError:
> org.apache.poi.hssf.usermodel.HSSFSheet.createRow(I)Lorg/apache/poi/hssf/usermodel/HSSFRow;
> (when I leave it as createRow((short)0), I get the same error).
>
> Any hints as to why this doesn’t work in the plugin are highly appreciated.
>
> Steffen
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Writing Excel File from Plugin

Steffen Rehberg
In reply to this post by Steffen Rehberg
Hi Curtis,

Thank you so much for your tip. The culprit was the Excel_Writer plugin (http://rsb.info.nih.gov/ij/plugins/excel-writer.html) which contains the old POI version in its jar. I removed the plugin and everything works perfectly.

Many thanks,

Steffen

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html