HSSFWorkbook workbook = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("c:/poi/tete.xls");
for(int i=0; i<f1.length;i++) {
workbook.write(fileOut);
fileOut.close();
//System.out.println(f1[i]);
}
Exception in thread "main" java.io.IOException: Write error
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at org.apache.poi.poifs.storage.BigBlock.doWriteData(BigBlock.java:55)
at org.apache.poi.poifs.storage.HeaderBlockWriter.writeData(HeaderBlockWriter.java:214)
at org.apache.poi.poifs.storage.BigBlock.writeBlocks(BigBlock.java:86)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.writeFilesystem(POIFSFileSystem.java:390)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1168)
at test.Test.<init>(Test.java:48)
at test.Test.main(Test.java:62)
try{
HSSFWorkbook workbook = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("c:/poi/tete.xls");
for(int i=0; i<f1.length;i++) {
workbook.write(fileOut);
//System.out.println(f1[i]);
}
fileOut.close();
}
catch (IOException ioe) {
System.out.println("Fehler ins Excel Schreiben!");
}
for (int i = 0; i < daten.length; i++) {
cell = row.createCell(i);
cell.setCellValue(daten[i].valName);
createCell(workbook, row, (short) i, HSSFCellStyle.ALIGN_CENTER);
}
private void createCell(HSSFWorkbook workbook, HSSFRow row, short align,
short alignCenter) {
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(align);
cell.setCellStyle(cellStyle);
}
HSSFCellStyle cellStyle = workbook.createCellStyle();
for (int i = 0; i < daten.length; i++) {
cell = row.createCell(i);
cell.setCellValue(daten[i].valName);
cellStyle.setAlignment((short)i);
cell.setCellStyle(HSSFCellStyle.ALIGN_CENTER); //????
}
terrly hat gesagt.:also noch mal Danke für deine Hilfe aber du sollst das nicht vergessen dass du gerade im Anfänger Bereich antwortest. Das heisst diese Thread ist dafür ausgedacht dass die "blöde" Anfänger nicht überall mit ihrem "blöden" Fragen nerven sollen sondern hier in seperaten Thread. Also es tut mir leid das ich nicht java kann und auch wenn du hören wirst Programmieren kann. . Ich hätte gleich von dir die fertigen Code anforden können Aber ich versuche zumindest irgendwas zu lernen. Du kannst davon ausgehen dass ich was lernen will...
Verjigorm hat gesagt.:Für einen "Anfänger" ist das Thema meiner Meinung nach etwas "oversized" :bloed: