I manage to create Excel 97-2003 file with Java, but when I try to open it with Windows Explorer, I get the error message file format is not valid. The filename is file.xls so it should be right? What goes wrong then?
+1
A:
Question is not clear. How was you creating excel file with Java? The problem is because tool you used for file creation created it incorrectly, in incorrect format.
Consider using Apache POI library: http://poi.apache.org/spreadsheet/index.html I was using it for a while and it works correctly. I didn't have problems with it.
Andriy Sholokh
2010-10-01 09:38:00
public static void write () throws IOException, WriteException { WorkbookSettings settings = new WorkbookSettings(); File seurantaraportti = new File(ta.xls"); WritableWorkbook seurw = Workbook.createWorkbook(ta,settings); seurw.createSheet("ta", 0); WritableSheet ws = seurw.getSheet(0); addNumber(ws,0,0,100.0); seurw.close();}
jaana
2010-10-01 11:43:13
private static void addNumber(WritableSheet sheet, int column, int row, Double d) throws WriteException, RowsExceededException { Number number=new Number(column, row,d); sheet.addCell(number); }
jaana
2010-10-01 11:43:55