JSP导出EXCEL多sheet


%>

<%@page contentType="text/html;charset=GBK"%>

<%@page import="java.util.*"%>

<%@page import="java.io.*"%>

<%@page import="com.sinosoft.lis.pubfun.*"%>

<%@page import="com.sinosoft.utility.*"%>

<%@page import="org.apache.poi.hssf.usermodel.*" %>

<%@page import=" org.apache.poi.hssf.util.*" %>

<%

String printoutflag = request.getParameter("printoutflag");

String Insusql="";

String Bnfsql="";

String Contdition="";

  //读取Session中的全局类

GlobalInput tG = (GlobalInput)session.getAttribute("GI");

String Grpcontno = request.getParameter("ProposalGrpContNo");

String tBatchNo[] = request.getParameterValues("InsuImpBatchGrid1");

String tChk[] = request.getParameterValues("InpInsuImpBatchGridChk");

System.out.println("printoutflag = "+printoutflag);  //batch:选择批次导出被报人安按钮   all:选择导出全部被报人按钮,不用作判断

   if(printoutflag.equals("batch")){

   Contdition+="and a.BatchNo in (";

 for(int index = 0; index < tBatchNo.length; index++)

 {

 if(tChk[index].equals("1"))

 {

    if(index == tBatchNo.length-1)

    {

    Contdition+=tBatchNo[index];

    }

    else{

    Contdition+=tBatchNo[index];

    Contdition+=",";

    }

 }

 }  

 Contdition = Contdition.substring(0, Contdition.length()-1);

 Contdition+=")";

    }

   else{

   

  Contdition += " and businessno = '"+Grpcontno+"' ";

  

   }

  Insusql = "select a.batchno           as 批次号,"

 +"a.SerialNo               as 被保险人序号, "

         +"(select contno from lcinsured b where b.insuredno = a.insuredno and grpcontno = a.businessno)      as 个人保单号,"

         +"a.insuredno               as 被保人客户号,"

         +"a.insuname                as 客户姓名,"

     +"(Select b.CodeName from LDCode b where b.CodeType = 'sex' and b.code = a.insusex)                as 性别,"

         +"a.insubirthday            as 出生日期,"

     +"(Select b.CodeName from LDCode b where b.CodeType = 'idtype' and b.code = a.insuidtype)             as 证件类型,"

         +"a.insuidno                as 证件号码,"       

         +"(Select b.CodeName from LDCode b where b.CodeType = 'occupationtype' and b.code = a.occupationtype)          as 职业类别,"

         +"(Select OccupationName from LDOccupation b where b.occupationcode = a.occupationcode)          as 职业代码,"

         +"a.mobile                  as 被保人移动电话,"        

         +"a.contplancode            as 保险计划,"

         +"'',"//指定生效日标志

         +"(select  b.cvalidate from lccont b where b.grpcontno = a.businessno and b.insuredno = a.insuredno)   as 个人保单生效日期, "                       

         +"(select  b.paytodate from lccont b where b.grpcontno = a.businessno and b.insuredno = a.insuredno)   as 个人保单截止日期,"

         +" '',"//有名单/无名单

         +" '' "//既往重疾理赔标记

         +"from lcgrpimportinsu  a where 1 = 1"

         +Contdition;

  

 System.out.println("Insusql="+Insusql);

 

    Bnfsql = "select a.serialno,"

   +" '' ,"//险种代码

         +"a.bnftype,"

         +"a.Name,"

         +"a.IDType,"

         +"a.IDNo,"

         +"a.Sex,"

         +"a.Birthday,"

         +"a.RelationToInsured,"

         +"a.BnfGrade,"

         +"a.BnfLot,"

         +"a.Mobile,"

         +"a.Phone "

   +" from lcgrpimportbnf a where a.serialno in(select b.serialno from lcgrpimportinsu b where b.checkstate = '3')"

   +Contdition;

  System.out.println("Bnfsql="+Bnfsql);

  

try {

      //分sheet显示所有数据

System.out.println("正在生成Sheet清单...");

 

ExeSQL exeSql = new ExeSQL();

SSRS t_SSRS = new SSRS();

    t_SSRS = exeSql.execSQL(Insusql.toString());

    SSRS s_SSRS = new SSRS();

    s_SSRS = exeSql.execSQL(Bnfsql.toString());

    

System.out.println("被保险人最大行数"+t_SSRS.getMaxRow());

System.out.println("受益人最大行数"+s_SSRS.getMaxRow());

int maxRowNum = 65000;// 每个Excel页卡最大存放行数

String InsuName = "被保人清单";

String BnfName = "受益人清单";

HSSFWorkbook wb = new HSSFWorkbook();

int InsuallRowInd = 0;// 当前页卡总行数

int BnfallRowInd = 0;// 当前页卡总行数

int InsucurrSheetInd = 0;

int BnfcurrSheetInd = 0;

HSSFSheet Insusheet = wb.createSheet();

HSSFSheet Bnfsheet = wb.createSheet();

Insusheet.setSelected(true);

Bnfsheet.setSelected(true);

HSSFRow Insurow = null;

HSSFRow Bnfrow = null;

Insurow = Insusheet.createRow(InsuallRowInd++);// 添加主题

Bnfrow = Bnfsheet.createRow(BnfallRowInd++);// 添加主题

HSSFFont fontTitle = wb.createFont();//标题样式

fontTitle.setFontHeightInPoints((short) 10);

fontTitle.setFontName("宋体");

fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

HSSFFont fontValue = wb.createFont();//边框样式

fontValue.setFontHeightInPoints((short) 10);

fontValue.setFontName("宋体");

fontValue.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);

HSSFCellStyle styleBorderTitle = wb.createCellStyle();

styleBorderTitle.setBorderBottom(HSSFCellStyle.BORDER_THIN);

styleBorderTitle.setBorderLeft(HSSFCellStyle.BORDER_THIN);

styleBorderTitle.setBorderRight(HSSFCellStyle.BORDER_THIN);

styleBorderTitle.setBorderTop(HSSFCellStyle.BORDER_THIN);

styleBorderTitle.setFillForegroundColor(HSSFColor.YELLOW.index);

styleBorderTitle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

styleBorderTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);

styleBorderTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

styleBorderTitle.setWrapText(true);

styleBorderTitle.setFont(fontTitle);

HSSFCellStyle styleBorderValue = wb.createCellStyle();

styleBorderValue.setBorderBottom(HSSFCellStyle.BORDER_THIN);

styleBorderValue.setBorderLeft(HSSFCellStyle.BORDER_THIN);

styleBorderValue.setBorderRight(HSSFCellStyle.BORDER_THIN);

styleBorderValue.setBorderTop(HSSFCellStyle.BORDER_THIN);

styleBorderValue.setFillForegroundColor(HSSFColor.LIGHT_CORNFLOWER_BLUE.index);

styleBorderValue.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

styleBorderValue.setAlignment(HSSFCellStyle.ALIGN_CENTER);

styleBorderValue.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

styleBorderValue.setWrapText(true);

styleBorderValue.setFont(fontValue);

HSSFCell Insucell = Insurow.createCell((short) 0);

HSSFCell Bnfcell = Bnfrow.createCell((short) 0);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insurow.setHeight((short)(20*30));

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfrow.setHeight((short)(20*30));

int t = 0;

int s = 0;

//18

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("批次号");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("被保险人序号");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("个人保单号");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("客户号");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("客户姓名");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("性别");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("出生日期");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("证件类型");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("证件号码");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("职业类别");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("职业代码");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("移动电话");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("保险计划");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("指定生效日标志");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("个人保单生效日期");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("个人保单截止日期");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("有名单/无名单");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue("既往重疾理赔标记");

Insucell = Insurow.createCell((short) t++);

Insucell.setCellType(HSSFCell.CELL_TYPE_STRING);

Insucell.setCellStyle(styleBorderTitle);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

//受益人 13

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("被保险人序号");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("险种代码");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("受益人类型");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("受益人姓名");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("证件类型");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("证件号码");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("性别");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("出生日期");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("与被保人关系");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("受益级别");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("受益份额");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("手机");

Bnfcell = Bnfrow.createCell((short) s++);

Bnfcell.setCellType(HSSFCell.CELL_TYPE_STRING);

Bnfcell.setCellStyle(styleBorderTitle);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue("联系电话");

  if(t_SSRS.getMaxRow() > 0)

{

  int count = 1 ;

for(int k = 1 ;k<=t_SSRS.getMaxRow();k++)

{

// 判断是否需要添加Excel页卡

if(InsuallRowInd >= maxRowNum)

{

InsuallRowInd = 0;

Insusheet.setSelected(false);

// 创建新的页卡

Insusheet = wb.createSheet("被保人清单");

wb.setSheetName(InsucurrSheetInd++, InsuName, HSSFWorkbook.ENCODING_UTF_16);

Insusheet.setSelected(true);

}

Insurow = Insusheet.createRow(InsuallRowInd++);

Insurow.setHeight((short)(20*15));

for(int m = 1;m<=18;m++){

    Insucell = Insurow.createCell((short) (m-1));

Insucell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);

Insucell.setCellStyle(styleBorderValue);

Insucell.setEncoding(HSSFCell.ENCODING_UTF_16);

Insucell.setCellValue(t_SSRS.GetText(k, m));

}

// 调整列宽

Insusheet.setColumnWidth((short) 0, (short) (256*10));

Insusheet.setColumnWidth((short) 1, (short) (256*20));

Insusheet.setColumnWidth((short) 2, (short) (256*20));

Insusheet.setColumnWidth((short) 3, (short) (256*20));

Insusheet.setColumnWidth((short) 4, (short) (256*20));

Insusheet.setColumnWidth((short) 5, (short) (256*20));

Insusheet.setColumnWidth((short) 6, (short) (256*20));

Insusheet.setColumnWidth((short) 7, (short) (256*20));

Insusheet.setColumnWidth((short) 8, (short) (256*12));

Insusheet.setColumnWidth((short) 9, (short) (256*12));

Insusheet.setColumnWidth((short) 10, (short) (256*12));

Insusheet.setColumnWidth((short) 11, (short) (256*20));

Insusheet.setColumnWidth((short) 12, (short) (256*20));

Insusheet.setColumnWidth((short) 13, (short) (256*20));

Insusheet.setColumnWidth((short) 14, (short) (256*20));

Insusheet.setColumnWidth((short) 15, (short) (256*20));

Insusheet.setColumnWidth((short) 16, (short) (256*12));

Insusheet.setColumnWidth((short) 17, (short) (256*20));

}

}

// 调整列宽

wb.setSheetName(0, InsuName, HSSFWorkbook.ENCODING_UTF_16);

Insusheet.setColumnWidth((short) 0, (short) (256*12));

Insusheet.setColumnWidth((short) 1, (short) (256*20));

Insusheet.setColumnWidth((short) 2, (short) (256*20));

Insusheet.setColumnWidth((short) 3, (short) (256*20));

Insusheet.setColumnWidth((short) 4, (short) (256*20));

Insusheet.setColumnWidth((short) 5, (short) (256*20));

Insusheet.setColumnWidth((short) 6, (short) (256*20));

Insusheet.setColumnWidth((short) 7, (short) (256*20));

Insusheet.setColumnWidth((short) 8, (short) (256*12));

Insusheet.setColumnWidth((short) 9, (short) (256*12));

Insusheet.setColumnWidth((short) 10, (short) (256*12));

Insusheet.setColumnWidth((short) 11, (short) (256*20));

Insusheet.setColumnWidth((short) 12, (short) (256*20));

Insusheet.setColumnWidth((short) 13, (short) (256*20));

Insusheet.setColumnWidth((short) 14, (short) (256*20));

Insusheet.setColumnWidth((short) 15, (short) (256*20));

Insusheet.setColumnWidth((short) 16, (short) (256*12));

Insusheet.setColumnWidth((short) 17, (short) (256*20));

Insusheet.setSelected(false);

if(s_SSRS.getMaxRow() >= 0)

{

  int count = 1 ;

for(int k = 1 ;k<=s_SSRS.getMaxRow();k++)

{

// 判断是否需要添加Excel页卡

if(BnfallRowInd >= maxRowNum)

{

BnfallRowInd = 0;

Bnfsheet.setSelected(false);

// 创建新的页卡

Bnfsheet = wb.createSheet("受益人清单");

wb.setSheetName(BnfcurrSheetInd, InsuName, HSSFWorkbook.ENCODING_UTF_16);

Bnfsheet.setSelected(true);

}

Bnfrow = Bnfsheet.createRow(BnfallRowInd++);

Bnfrow.setHeight((short)(20*15));

for(int m = 1;m<=13;m++){

     System.out.println("m=="+m);

    Bnfcell = Bnfrow.createCell((short) (m-1));

Bnfcell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);

Bnfcell.setCellStyle(styleBorderValue);

Bnfcell.setEncoding(HSSFCell.ENCODING_UTF_16);

Bnfcell.setCellValue(s_SSRS.GetText(k, m));

}

// 调整列宽

Bnfsheet.setColumnWidth((short) 0, (short) (256*10));

Bnfsheet.setColumnWidth((short) 1, (short) (256*20));

Bnfsheet.setColumnWidth((short) 2, (short) (256*20));

Bnfsheet.setColumnWidth((short) 3, (short) (256*20));

Bnfsheet.setColumnWidth((short) 4, (short) (256*20));

Bnfsheet.setColumnWidth((short) 5, (short) (256*20));

Bnfsheet.setColumnWidth((short) 6, (short) (256*20));

Bnfsheet.setColumnWidth((short) 7, (short) (256*20));

Bnfsheet.setColumnWidth((short) 8, (short) (256*12));

Bnfsheet.setColumnWidth((short) 9, (short) (256*12));

Bnfsheet.setColumnWidth((short) 10, (short) (256*12));

Bnfsheet.setColumnWidth((short) 11, (short) (256*20));

Bnfsheet.setColumnWidth((short) 12, (short) (256*20));

}

}

// 调整列宽

wb.setSheetName(1,BnfName , HSSFWorkbook.ENCODING_UTF_16);

Bnfsheet.setColumnWidth((short) 0, (short) (256*12));

Bnfsheet.setColumnWidth((short) 1, (short) (256*20));

Bnfsheet.setColumnWidth((short) 2, (short) (256*20));

Bnfsheet.setColumnWidth((short) 3, (short) (256*20));

Bnfsheet.setColumnWidth((short) 4, (short) (256*20));

Bnfsheet.setColumnWidth((short) 5, (short) (256*20));

Bnfsheet.setColumnWidth((short) 6, (short) (256*20));

Bnfsheet.setColumnWidth((short) 7, (short) (256*20));

Bnfsheet.setColumnWidth((short) 8, (short) (256*12));

Bnfsheet.setColumnWidth((short) 9, (short) (256*12));

Bnfsheet.setColumnWidth((short) 10, (short) (256*12));

Bnfsheet.setColumnWidth((short) 11, (short) (256*20));

Bnfsheet.setColumnWidth((short) 12, (short) (256*20));

Bnfsheet.setSelected(false);

System.out.println("校验失败被保人Sheet清单生成完毕...");

response.reset();

response.setContentType("application/octet-stream");

response.setHeader("Content-Disposition","attachment; filename = "+tBatchNo+".xls");

OutputStream outOS = response.getOutputStream();

wb.write(outOS);

outOS.flush();

outOS.close();

response.flushBuffer();

out.clear();

out = pageContext.pushBody();

} catch (Exception e) {

System.out.println(e.getMessage());

e.printStackTrace();

System.out.println("导出Excel失败!");

}

%>


猜你喜欢

转载自blog.csdn.net/qq_29153851/article/details/79483412
今日推荐