[code="java"]
private void readWriter(){
WritableWorkbook wwb=null;
WritableSheet wws=null;
FileOutputStream out =null;
ByteArrayOutputStream targetFile=null;
File is = new File("f:\ExcelTest\try.xls");
try {
out = new FileOutputStream("f:\ExcelTest\try1.xls");
Workbook wb = Workbook.getWorkbook(is);
targetFile = new ByteArrayOutputStream();
wwb = Workbook.createWorkbook(targetFile, wb);
wws = wwb.createSheet("Sheet名称",0);
Label label= new Label(2,0,"单元格内容");
wws.addCell(label);
targetFile.writeTo(out);
} catch (Exception e) {
e.printStackTrace();
} finally{
try {
wwb.close();
out.close();
targetFile.close();
} catch (WriteException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
[/code]
为什么我输出excel文件的时候,excel里面什么都,我到底哪里写错了呢