java通过jxl生成excel文档(三)

2014-11-24 02:29:16 · 作者: · 浏览: 2
+1, rowIndx);
startColNum=startColNum+2;
ws.addCell(new Label(startColNum,rowIndx,(i%2==0) "男":"女",wcf_value));
ws.mergeCells(startColNum, rowIndx, startColNum+1, rowIndx);
startColNum=startColNum+2;
ws.addCell(new Number(startColNum,rowIndx,i+15,wcf_value));
ws.mergeCells(startColNum, rowIndx, startColNum+1, rowIndx);
startColNum=startColNum+2;
ws.addCell(new Label(startColNum,rowIndx,"住址"+i,wcf_value));

startColNum=0;
}


wb.write();
wb.close();
}


//生成空单元格
public static void generateCells(WritableSheet ws,int startRows,int startColNums,int rows,int cols){
for(int r=0;r for(int c = 0;c try {
ws.addCell(new Label(startColNums+c,startRows+r,""));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

public static void main(String[] args) throws Exception {
File file = new File("D:\\text.xls");
file.createNewFile();
new ExcelReport().genarateExcel(file);
}

}

本文出自“greatjone”