Martin Hoeijmakers wrote:

<moved your reply down, to avoid top posting mix-up>

<adapted subject line>

> On 11/19/2011 7:45 PM, Philip Nienhuis wrote:
>
>> Martin Hoeijmakers wrote:
<snip>
>>> Because I use my program on two systems - one without Excel - I used POI
>>> (with Octave 3.2.4). If I use POI now, I get the error message
>>>
>>> error: [java] java.lang.NoSuchMethodException: getNumWorkSheets
>>> error: called from:
>>> error:
>>> C:\Octave\Octave3.4.3_gcc4.5.2\share\octave\packages\io-1.0.15\oct2xls.m
>>> at line 491, column 14
>>> error:
>>> C:\Octave\Octave3.4.3_gcc4.5.2\share\octave\packages\io-1.0.15\oct2xls.m
>>> at line 163, column 17
>>>
>>> Do you have a solution for this?
>>
>> Looks like you have something mixed up in the Apache POI Java class libs.
>>
>> Please run this command:
>>
>> chk_spreadsheet_support ('', 3)
>>
>> ('' = 2 consecutive quotes, w/o space in between, and NO ";" at the end)
>>
>> and copy the output in your reply.
>>
>> Do you know the POI version? (3.5, 3.6, 3.7, 3.8?)
>>
>> I need this info to be able to help you solve this issue.
 >
 >   Hi Philip,
 >
 > I get:
 >
 > octave:1> chk_spreadsheet_support([],3)
 >
 > Checking Excel/ActiveX/COM... OK.
 >
 > Checking Java support...
 > 1. Checking Java JRE presence.... OK, found one.
 > 2. Checking Octave Java support... Java package seems to work OK.
 > Java (version 1.6.0_29) seems OK.
 > Maximum JVM memory: 495 MiB; sufficient.
 > Java support OK
 >
 > Checking javaclasspath for .jar class libraries needed for spreadsheet
 > I/O...:
 >
 > Basic POI (.xls) <poi-3> <poi-ooxml>:
 > - C:\Octave\Octave3.4.3_gcc4.5.2\bin\poi-3.7-20101029.jar OK
 > - C:\Octave\Octave3.4.3_gcc4.5.2\bin\poi-ooxml-3.7-20101029.jar OK
 > => Apache (POI) OK
 >
 > POI OOXML (.xlsx) <xbean> <poi-ooxml-schemas> <dom4j>:
 > - C:\Octave\Octave3.4.3_gcc4.5.2\bin\xbean.jar OK
 > - 
C:\Octave\Octave3.4.3_gcc4.5.2\bin\poi-ooxml-schemas-3.7-20101029.jar OK
 > - C:\Octave\Octave3.4.3_gcc4.5.2\bin\dom4j-1.6.1.jar OK
 > => POI OOXML OK
:
<rest snipped>
:
 > So, I think my POI version is 3.7.

Yes; btw you get exactly the same output as on my box.

So I made a simple test case and I hit the same error.
I remember vaguely I had to change the call to get the number of 
worksheets as it changed in some POI version. Hmmm....

The proposed fix:

In oct2xls, change L.490 from:

   nr_of_sheets = xls.workbook.getNumWorkSheets ();

into the following sequence:

   try
     nr_of_sheets = xls.workbook.getNumWorkSheets ();
   catch
     nr_of_sheets = xls.workbook.getNumberOfSheets ();
   end_try_catch

Please report back if this works OK for you.

Philip

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to