问题描述
- java网页导出excel为什么在兼容模式下时而好使时而不好使,极速模式没问题
- java网页导出excel为什么在兼容模式下时而好使时而不好使,极速模式没问题。求大神指点。
下面是导出代码和excel的JSP文件开头。
/** * 导出Excel * @return * @throws Exception */ public String getListExcel() throws Exception { this.init(); chuKuList = dao.getList(startTimeendTimeshouHuoDanWeicheHaopinMing); //页面核算 for(int i =0;i<chuKuList.size();i++){ ChuKu chuKu=chuKuList.get(i); heji1=heji1+chuKu.getDanJia(); he1 = TypeChange.stringToDouble(df.format(heji1)); heji2=heji2+chuKu.getJinE(); he2 = TypeChange.stringToDouble(df.format(heji2)); heji3=heji3+chuKu.getZhuangCheFei(); he3 = TypeChange.stringToDouble(df.format(heji3)); heji4=heji4+chuKu.getYunFei(); he4 = TypeChange.stringToDouble(df.format(heji4)); heji5=heji5+chuKu.getZongJinE(); he5 = TypeChange.stringToDouble(df.format(heji5)); heji6=heji6+chuKu.getMaoZhong(); he6 = TypeChange.stringToDouble(df.format(heji6)); heji7=heji7+chuKu.getPiZhong(); he7 = TypeChange.stringToDouble(df.format(heji7)); heji8=heji8+chuKu.getJingZhong(); he8 = TypeChange.stringToDouble(df.format(heji8)); heji9=heji9+chuKu.getDanJianZhongLiang(); he9 = TypeChange.stringToDouble(df.format(heji9)); } return SUCCESS; }
<%@ page contentType=""application/vnd.ms-excel; charset=UTF-8"" %><%@ page import=""com.sysgrrj.common.TypeChange"" %><%@ taglib prefix=""s"" uri=""/struts-tags"" %><% String f = ""出库信息"" + TypeChange.GetDate() + "".xls""; response.addHeader(""Content-Disposition""filename="" + new String(f.getBytes()iso8859-1"")); %><html> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8""/> <style type=""text/css""> body p td { font-family: '宋体'; font-size: 12px; } </style>
解决方案
这个应该是兼容问题吧。你用的IE吧?
时间: 2024-12-23 10:56:54