67,513
社区成员
发帖
与我相关
我的任务
分享
HSSFWorkbook workBook = new HSSFWorkbook();
HSSFSheet sheet = workBook.createSheet("工作表");
sheet.setColumnWidth((short)0, (short)2000);
sheet.autoSizeColumn((short)1);
sheet.setColumnWidth((short)2, (short)5000);
for(int i = 0;i < 23;i++)
{
HSSFRow row = sheet.createRow(i);
HSSFCell cell1 = row.createCell((short)0);
cell1.setCellValue(i);
HSSFCell cell2 = row.createCell((short)1);
cell2.setCellValue("xxx");
HSSFCell cell3 = row.createCell((short)2);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
cell3.setCellValue(sdf.format(new java.util.Date()));
HSSFCell cell4 = row.createCell((short)3);
cell4.setCellValue(2323.52345235);
sheet.addMergedRegion(new Region((short)i,(short)3,(short)i,(short)4));
}
FileOutputStream fos = new FileOutputStream("e:\\abc.xls");
workBook.write(fos);
fos.close();