package com.bestpay.bpbp.bill.init;
/**
* Created by Qj on 2015/08/17.
*/
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import java.io.File;
/**
* Created by Qj on 2015/08/03.
*/
public class OutExcelDataForTestNG {
private final File file = new File("E:\\add222.xls");
public void modifyExcel(int SheetNo, int lieshu, int hangshu, String value) {
try {
Workbook rwb = Workbook.getWorkbook(file);
WritableWorkbook wwb = Workbook.createWorkbook(file, rwb);// copy
WritableSheet ws = wwb.getSheet(SheetNo);
Label labelCF = new Label(lieshu, hangshu, value);
ws.addCell(labelCF);
wwb.write();
wwb.close();
rwb.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println("您是否打开了excel文件!请关闭后再试。");
}
}
public static void main(String[] args) {
OutExcelDataForTestNG out=new OutExcelDataForTestNG();
out.modifyExcel(0,1,1,"修改xls内容");
}
}
转载于:https://blog.51cto.com/7883830/1727056