Thank you Scott. I have tried various versions of this. I did get it to
compile once, even had the sheet in there when I called it, but then got a
run time error. The reason for using HSSF is just because it's the first
version I started working with before I realized there was the SS version.
I appreciate you taking time out to answer this newbie type question.
----- Original Message -----
From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
Sent: Thursday, May 24, 2012 6:34 PM
Subject: Re: POI - autoSizeColumn
hi Joe,
Any time you call a Java method from RPG, you must pass the object in
the first parameter. Each object has it's own methods -- how could Java
know which object you're calling the method of if you don't provide it?
In Java syntax, you'd do something like this:
HSSFSheet mySheet = book.createSheet();
mySheet.autoSizeColumn((int)2);
So you've declared an object named mySheet, which is part of the
HSSFSheet class. You've called the autoSizeColumn method of the mySheet
object.
RPG doesn't have a means of specifying "object.method()" like Java does.
So how can you tell RPG which object yo call the method from? The way
you do that is by passing the object name as the first parameter.
HSSFSheet_autoSizeColumn( sheet: 2);
Also, although you say you know the method takes an integer as a
parameter, when you wrote the prototype you didn't code any
parameters... that doesn't make any sense. If you knew there was a
parameter, why didn't you include it in the prototype?
Here's what I think your parameter should look like:
D HSSFSheet_autoSizeColumn...
D PR extproc(*JAVA:
D 'org.apache.poi.hssf.-
D usermodel.HSSFSheet'
D :'autoSizeColumn')
D Column like(jint) value
Finally... I don't understand why you're using the old HSSF versions
of the classes. Wouldn't it make more sense to use the SS versions so
it'll work for both XSSF/HSSF spreadsheets?
-SK
On 5/24/2012 4:36 PM, Joe Giusto II wrote:
I am having trouble with the autoSizeColumn. The spec says that it take
an
int but when I try to compile, it says that I need to pass it an object.
D Column S LIKE(jint)
D HSSFSheet_autoSizeColumn...
D PR extproc(*JAVA:
D 'org.apache.poi.hssf.-
D usermodel.HSSFSheet'
D :'autoSizeColumn')
/free
HSSFSheet_autoSizeColumn(COLUMN);
/end-free
the error message:
*RNF7588 30 1 The first parameter for a non-static Java method call
must be
an Object.
As an Amazon Associate we earn from qualifying purchases.