× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




I've developed the following Java code, to reduce the number of call I make
from RPG via JNI to the HSSF POI API's that I use to generate large
spreadsheets. I've seen incredible performance gains, however, when a
spreadsheet got particularly large, I started getting Java dumps. I
suspect that I may be leaking objects due to my being a Java newbie, and
was hoping someone might see my error. I'm posting the Java code, and then
the RPG prototypes used to initiate the code. Thank you in advance, and
you're certainly welcome to use the code if you find it useful.

// The two routines within this program are intended to replace the
hssf_text and hssf_num
// routines in the HSSFR4 service program. Since they execute all the
small commands in
// native java, with no objects created to RPG, it seems to improve
performance
// dramatically, perhaps either through better memory management, or fewer
external calls to the JVM.
// Using these routines also seems to improve temporary storage used in the
calling program as well.


package cellutil;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;

public final class newcell {
public static void Text(HSSFRow row, int col, byte[] array,
HSSFCellStyle style ) {

HSSFCell cell = row.createCell(col);
cell.setCellType(1);
String value=new String(array);
cell.setCellValue(new HSSFRichTextString(value));
cell.setCellStyle(style);
}

public static void Num(HSSFRow row, int col, double value,
HSSFCellStyle style ) {

HSSFCell cell = row.createCell(col);
cell.setCellType(0);
cell.setCellValue(value);
cell.setCellStyle(style);
}

}



D hssf_textz...
D PR static EXTPROC(*JAVA
D :'cellutil.newcell'
D :'Text')
D peRow like(HSSFRow)
D peCol like(jint) value
D peString 128 varying const
D peStyle like(HSSFCellStyle)

D hssf_numz...
D PR static EXTPROC(*JAVA
D :'cellutil.newcell'
D :'Num')
D peRow like(HSSFRow)
D peCol like(jint) value
D peValue 8f value
D peStyle like(HSSFCellStyle)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.