如何使用java jxl更新excelsheet

时间:2015-03-24 11:29:08

标签: jxl

我想使用java jxl更新我现有的excelsheet.I经历了很多链接但未找到解决方案请参考

更新excelsheet屏幕截图之前

http://i.stack.imgur.com/L2LNz.png

更新excelsheet screenshoot后

http://i.stack.imgur.com/mMivW.png

public void  writeExcel() {

        String xlFilePath="test\\Resources\\Data\\dataExcel.xls";
        String sheetName="loginSheet";


Workbook existingWorkbook = Workbook.getWorkbook(new File(xlFilePath));
        WritableWorkbook workbookCopy = Workbook.createWorkbook(new File("output.xls"), existingWorkbook);
        WritableSheet sheetToEdit = workbookCopy.getSheet(sheetName);
WritableCell cell;
        Label label = new Label(2, 4, "value");
        cell = (WritableCell) label;
        sheetToEdit.addCell(label);
        workbookCopy.write();
        workbookCopy.close();
} 

0 个答案:

没有答案