每当我尝试操作 excel 文件时,相应的 excel 文件都会损坏。请提出如何解决这个问题的建议。我已经用java编写了代码。
这是代码:
Workbook workbook = Workbook.getWorkbook(new File("book.xls"));
WritableWorkbook copy = Workbook.createWorkbook(newFile(""), workbook);
WritableSheet sheet = copy.getSheet(0);
WritableFont times16font = new WritableFont(WritableFont.TIMES, 20, WritableFont.BOLD); WritableCellFormat times16format = new WritableCellFormat (times16font);
Label label = new Label(3, 4, "Good", times16format);
sheet.addCell(label);
Label label1 = new Label(3, 5, "Good", times16format);
heet.addCell(label);
copy.write();
copy.close();