java生成excel模板导出.doc

java生成excel模板导出.doc

ID:51690431

大小:166.00 KB

页数:6页

时间:2020-03-15

java生成excel模板导出.doc_第1页
java生成excel模板导出.doc_第2页
java生成excel模板导出.doc_第3页
java生成excel模板导出.doc_第4页
java生成excel模板导出.doc_第5页
资源描述:

《java生成excel模板导出.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、java生成excel模板导出getTimeStr方法:publicstaticStringgetTimeStr(Datedate,Stringformat){  SimpleDateFormatsimpleDateFormat=newSimpleDateFormat(format);  returnsimpleDateFormat.format(date); } createExcelModel方法全部代码:publicstaticHSSFWorkbookcreateExcelModel()throwsException{  HSSFWorkbookwb=newHSS

2、FWorkbook();//创建工作薄  HSSFSheetsheet=wb.createSheet("任务模板");//新建工作表  HSSFRowrow=sheet.createRow((short)0);//创建行  row.setHeightInPoints((short)20);//设置excel单元格高度  HSSFRichTextStringtext=null;  HSSFFontfont=wb.createFont();  font.setColor(HSSFFont.COLOR_RED);  font.setBoldweight(HSSFFont.BO

3、LDWEIGHT_BOLD);  HSSFCellStylestyle=wb.createCellStyle();  style.setFont(font);  for(inti=0;i<21;i++){//创建列   HSSFCellcell=row.createCell(i);//创建单元格   switch(i){    case0:     if(i==0){      text=newHSSFRichTextString("客户编号");      cell.setCellValue(text);      cell.setCellStyle(style); 

4、     cell.setCellType(HSSFCell.CELL_TYPE_STRING);     }    case1:     if(i==1){      text=newHSSFRichTextString("客户姓名");      cell.setCellValue(text);      cell.setCellStyle(style);      cell.setCellType(HSSFCell.CELL_TYPE_STRING);     }    case2:     if(i==2){      text=newHSSFRichTextS

5、tring("英文名称");      cell.setCellValue(text);      cell.setCellType(HSSFCell.CELL_TYPE_STRING);     }    case3:     if(i==3){      text=newHSSFRichTextString("英文简称");      cell.setCellValue(text);      cell.setCellType(HSSFCell.CELL_TYPE_STRING);     }    case4:     if(i==4){      text=ne

6、wHSSFRichTextString("客户级别");      cell.setCellValue(text);      cell.setCellStyle(style);//      cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);     }    case5:     if(i==5){      text=newHSSFRichTextString("证件类别");      cell.setCellValue(text);      cell.setCellStyle(style);//      cell.s

7、etCellType(HSSFCell.CELL_TYPE_NUMERIC);     }    case6:     if(i==6){      text=newHSSFRichTextString("证件号码");      cell.setCellValue(text);      cell.setCellStyle(style);//      cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);     }    case7:     if(i==7){      text=newHSSF

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。