怎么实现java导出excel并设置excel不能另存,复制和修改
1个回答
2016-07-25
展开全部
1./**
* 出险信息导出到excel(fc)
* @param mapping
* @param form
* @param request
* @param response
* @throws IOException
*/
public void exportActoExcel(ActionMapping mapping, ActionForm form ,
HttpServletRequest request,HttpServletResponse response) throws IOException {
ActionErrors errors = new ActionErrors();
AcExcelBusi acBusi = new AcExcelBusi();
AccidentRecordForm arForm= (AccidentRecordForm) form;
AccidentRecordBusi arBusi = new AccidentRecordBusi();
// ////查询条件
FwUsers sessUser = (FwUsers)request.getSession().getAttribute(ConstValues.SESS_USER_MANAGE);
Map<String,Object> cisMap = arBusi.getTodoPageList(arForm,sessUser,errors);
List AcList = null;// 当页的记录
if (null != cisMap) {
AcList = (List) cisMap.get("list");
}
//导出excel的路径、文件名
String uuid = UUID.create("exp");
String path = request.getSession().getServletContext().getRealPath("/") + ConstValues.EXP_PATH_EXCEL + uuid + ".xls";
acBusi.exprotAcExcel(AcList, path,request);
response.sendRedirect("stdownload.jsp?path=" + path );
* 出险信息导出到excel(fc)
* @param mapping
* @param form
* @param request
* @param response
* @throws IOException
*/
public void exportActoExcel(ActionMapping mapping, ActionForm form ,
HttpServletRequest request,HttpServletResponse response) throws IOException {
ActionErrors errors = new ActionErrors();
AcExcelBusi acBusi = new AcExcelBusi();
AccidentRecordForm arForm= (AccidentRecordForm) form;
AccidentRecordBusi arBusi = new AccidentRecordBusi();
// ////查询条件
FwUsers sessUser = (FwUsers)request.getSession().getAttribute(ConstValues.SESS_USER_MANAGE);
Map<String,Object> cisMap = arBusi.getTodoPageList(arForm,sessUser,errors);
List AcList = null;// 当页的记录
if (null != cisMap) {
AcList = (List) cisMap.get("list");
}
//导出excel的路径、文件名
String uuid = UUID.create("exp");
String path = request.getSession().getServletContext().getRealPath("/") + ConstValues.EXP_PATH_EXCEL + uuid + ".xls";
acBusi.exprotAcExcel(AcList, path,request);
response.sendRedirect("stdownload.jsp?path=" + path );
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |