Boa noite!
tenho o seginte trecho de codigo
try {
InputStream input = te.class.getResourceAsStream( "jesse.xls" );
POIFSFileSystem fs = new POIFSFileSystem( input );
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
//varre linha a linha da planilha
Iterator rows = sheet.rowIterator();
while( rows.hasNext() ) {
HSSFRow row = (HSSFRow) rows.next();
// varre cada celula da linha e imprime seu valor na Tela
Iterator cells = row.cellIterator();
while( cells.hasNext() ) {
HSSFCell cell = (HSSFCell) cells.next();
switch ( cell.getCellType() ) {
case HSSFCell.CELL_TYPE_NUMERIC:
jTextArea1.setText(jTextArea1.getText()+ "\n" + "Cell #"
+ cell.getCellNum() +" " +"Row #" + row.getRowNum()+" "
+ cell.getNumericCellValue());
break;
case HSSFCell.CELL_TYPE_STRING:
jTextArea1.setText(jTextArea1.getText()+ "\n" + "Cell #"
+ cell.getCellNum() +" " +"Row #" + row.getRowNum()+" "
+ cell.getRichStringCellValue());
cell.setCellValue(867); // aki tento alterar o valor da celula...
break;
default:
System.out.println( "unsuported sell type" );
break;
}
}
}
}
catch ( IOException ex ) { System.exit(0);
ex.printStackTrace();
}
alguem sabe como fazer pra salvar as alterações feitas na planilha?
desde jah agradeço!