save a excel file with poi
Hi.
i want to save the modification i made in a excel file using poi, without open the MS excel program and do it manually ( Ctrl+s)...
i used
FileOutputStream out = null;
out = new FileOutputStream("c:/VolumeDetails.xls");
wbD.write(out);
but the program not recognize de changes until i saved manualy
and i need to work with these modifications.
i hope you can help me. Thanks!
[434 byte] By [
Camposa] at [2007-11-27 10:26:39]

HSSFWorkbook workBook = new HSSFWorkbook();
FileOutputStream fileOutputStream = new FileOutputStream("filestreams_workbook.xls");
HSSFSheet sheet = workBook.createSheet();
HSSFRow excelRow = sheet.createRow((short)0);
HSSFCell dataCell = excelRow.createCell((short)0);
dataCell.setCellValue(1);
workBook.write(fileOutputStream);
fileOutputStream.close();
FileOutputStream out = null;
out = new FileOutputStream("c:/VolumeDetails.xls");
I can never understand why people do this. Why would you initialize something to null when you change its value on the very next line?
wbD.write(out);
You must have got an IOException somewhere if the above didn't produce a new file. What was it? Or do you have the dreaded empty-catch-block problem?
ejpa at 2007-7-28 17:40:43 >
