1
我使用jExcel API製作了一個excel文件,但是當我試圖打開該文件時,出現錯誤filename.xls:文件格式無效,我無法打開此文件,這裏是我的Java代碼使用jExcel創建Excel文件
File file = new File("C:\\Users\\Giga\\Desktop\\yvela.xls");
WritableWorkbook wb = Workbook.createWorkbook(file);
WritableSheet wsheet = wb.createSheet("First Sheet", 0);
int row = 0;
for (Student student : students) {
wsheet.addCell(new Label(0, row, student.getName()));
wsheet.addCell(new Label(1, row, student.getSurname()));
row++;
}
wb.close();