POI impossible ouvrir fichier
Bonjour , je découvre POI et j'utilise la version 3.9
je tente un petit code d'essai , tout se passe bien mais lorsque j'essaie
d'ouvrir le doc créé ds Excel il m'indique
"impossible d'ouvrir le fichier" et tente une réparation."
Pour un début , c'est un peu ennuyant , une idée ?
voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
package poi_2;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class TestPOI1 {
public static void main(String[] args) {
HSSFWorkbook wb = new HSSFWorkbook();
FileOutputStream fileOut;
try {
fileOut = new FileOutputStream("monfichier.xls");
wb.write(fileOut);
fileOut.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
} |