java word 乱码怎么办?
Java另存Word并解决乱码问题
* 专家意见另存word*@YaoWei*2014-6-16 下午12:09:07* @param request* @param response* @return*/public static String saveExpertOptionAsWord(HttpServletRequest request, HttpServletResponse response){ExpertCheckService.getOptionInfo(request, response);//生成最终的下载附件的名称@SuppressWarnings("unchecked")Map<String, String> corpInfoMap = (Map<String, String>) request.getAttribute("corpInfoMap");String fileName = "建筑业企业资质审查情况登记表["+corpInfoMap.get("corpName")+"].doc";try {//解决中文乱fileName = new String(fileName.getBytes("GB2312"),"ISO8859-1");} catch (UnsupportedEncodingException e) {e.printStackTrace();}//设置返回信息为word格式response.setContentType("application/msword"); response.setHeader("Content-disposition","attachment;filename="+fileName);return "success";}
推荐教程:《java学习》
以上就是java word 乱码怎么办的详细内容,更多请关注24课堂在线网其它相关文章!