POIFSFileSystem templateFs = new POIFSFileSystem(new FileInputStream("C:\\template.xls"));
HSSFWorkbook wb = new HSSFWorkbook(templateFs,true);
/*POIFSFileSystem outputfs = new POIFSFileSystem(new FileInputStream("C:workbook.xls"));
HSSFWorkbook wb_output = new HSSFWorkbook(outputfs,true);*/
HSSFSheet sheet_output = wb.getSheetAt(0);
for (Iterator rit = sheet_output.rowIterator(); rit.hasNext(); )
{
HSSFRow rowFor = (HSSFRow)rit.next();
for (Iterator cit = rowFor.cellIterator(); cit.hasNext(); )
{
HSSFCell cellFor = (HSSFCell)cit.next();
for(int i=0;i<key.length;i++)
{
String temp = cellFor.getStringCellValue();
if(temp.equalsIgnoreCase(key[i]))
{
temp=value[i];
cellFor = rowFor.createCell((short)1);
cellFor.setCellValue(temp);
}
}
}
}
String dirName ="C
utput.xls";
FileOutputStream fileOut = new FileOutputStream(dirName);
wb.write(fileOut);
fileOut.close();
Originally posted by Ulf Dittmer:
Are you setting the content type and Content-Disposition headers? Something like