fayevalentine
Programmer
Hello,
I am trying to generate an excel file with POI Library, so far here is a piece of code, I get about 150,000 registers between 2 dates
FileInputStream fis = new FileInputStream(new File(my_template));
XSSFWorkbook workbook = new XSSFWorkbook (fis);
XSSFSheet sheet = workbook.getSheetAt(0);
FileOutputStream fos1 =new FileOutputStream(new File(path_to_report));
while (date1 <= date2 )
{ ...
row1 = sheet.createRow(ln_excel);
ln_excel++;
row1.createCell(0).setCellValue(rs.getString(2));
... (about 15 columns)
fos1.flush();
}
fos1.close();
my process takes too much time,
Any hint to improve my code?
Thank in advance.
I am trying to generate an excel file with POI Library, so far here is a piece of code, I get about 150,000 registers between 2 dates
FileInputStream fis = new FileInputStream(new File(my_template));
XSSFWorkbook workbook = new XSSFWorkbook (fis);
XSSFSheet sheet = workbook.getSheetAt(0);
FileOutputStream fos1 =new FileOutputStream(new File(path_to_report));
while (date1 <= date2 )
{ ...
row1 = sheet.createRow(ln_excel);
ln_excel++;
row1.createCell(0).setCellValue(rs.getString(2));
... (about 15 columns)
fos1.flush();
}
fos1.close();
my process takes too much time,
Any hint to improve my code?
Thank in advance.