|
Hey all, Just thought I'd let you know that I was able to work my way around this problem...thanks to David Hinselwood...I saw that he'd had a similar problem back in the day and contacted him to see if he had ever resolved it...he said that he created his own java program to open the spreadsheet instead of having RPG do it...here's his java program: XLWorkBook.java import java.io.*; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class XLWorkBook { static public HSSFWorkbook loadWB(String fileName) { POIFSFileSystem fs = null; HSSFWorkbook wb = null; FileInputStream infile = null; try { infile = new FileInputStream(fileName); fs = new POIFSFileSystem(infile); wb = new HSSFWorkbook(fs); infile.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (infile != null) { try { infile.close(); } catch (IOException e) { e.printStackTrace(); } } } return wb; } } place this java program in the same IFS folder as the Jakarta POI jar files...change your current directory on the iSeries using CHGCURDIR DIR('/QIBM/UserData/Java400/ext/')...or wherever your POI files are...then compile the java program using STRQSH...in there execute the following command...javac /QIBM/UserData/Java400/ext/XLWorkBook.java...this will create your class for use in your RPGLE programs... then, in my RPGLE program: d openXL pr o extproc(*JAVA d :'XLWorkBook' d :'loadWB') d CLASS(*JAVA: d 'org.apache.poi.hssf.usermodel- d .HSSFWorkbook') d static d fileName like(jString) ... d fileName s like(jString) ... fileName = new_String('/home/scessna/excel/May05DailyLaborHours.xls'); book = openXL(fileName); hope this helps anyone else who was/is having the same problem as me... Shane Cessna iSeries Programmer iSeries WAS Administrator North American Lighting, Inc. (618) 662-4483 x2776 shane_cessna@xxxxxxx Barbara Morris <bmorris@xxxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 05/27/2005 06:06 PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To java400-l@xxxxxxxxxxxx cc Subject Re: Jakarta POI HSSF question... Shane_Cessna@xxxxxxx wrote: > ... > if someone could help me out on how I can get this stack trace, that'd be > great...I don't know a whole lot about java, so trying to use this in an > RPGLE program is quite a challenge for me... If you're on V5R3, you can get the RPG runtime to do a stack trace by having environment variable QIBM_RPG_JAVA_EXCP_TRACE set to a value of 'Y'. You'll probably also need to have your stderr go to an IFS file (see the link below for how to do that), although in batch it might automatically go to a QPRINT spool file, I'm not sure. If you're not on V5R3, here is a not-so-easy way to get a stack trace (a different Java method from yours, but the principle is the same): http://archive.midrange.com/rpg400-l/200402/msg00301.html
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.