当前位置: 首页 > news >正文

专门做优选的网站wordpress默认用户名密码

专门做优选的网站,wordpress默认用户名密码,南阳网站建设南阳,wordpress怎么设置404伪静态8、jeecg 笔记之 自定义word 模板导出#xff08;一#xff09; 1、前言 jeecg 中已经自带 word 的导出导出功能#xff0c;其所使用的也是 easypoi#xff0c;尽管所导出的 word 能满足大部分需求#xff0c; 但总是有需要用到自定义 word导出模板#xff0c;下文所用到… 8、jeecg 笔记之 自定义word 模板导出一 1、前言 jeecg 中已经自带 word 的导出导出功能其所使用的也是 easypoi尽管所导出的 word 能满足大部分需求 但总是有需要用到自定义 word导出模板下文所用到的皆是 easypoi 提供的为方便下次翻阅故记之。   2、代码部分 2.1、controller RequestMapping(/ftl2word) public void velocity2word(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest request,HttpServletResponse response) throws IOException {try {jeecgDemoExcel this.jeecgDemoExcelService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());ListMapString, Object departs this.systemService.findForJdbc(select id,departname from t_s_depart);String docFileName word-模板导出测试.doc;MapString, Object rootMap new HashMapString, Object();rootMap.put(info, jeecgDemoExcel);rootMap.put(departs, departs);// FreemarkerUtil.createFile(exportMyExcel.xls,// docFileName,rootMap, request, response,// FreemarkerUtil.EXCEL_FILE);FreemarkerUtil.createFile(ftl2doc.ftl, docFileName, rootMap, request, response, FreemarkerUtil.WORD_FILE);} catch (Exception e) {e.printStackTrace();} }   2.2、entity 实体就不扔出来了详细说一下这个地方 jeecgDemoExcel this.jeecgDemoExcelService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId()); ListMapString, Object departs this.systemService.findForJdbc(select id,departname from t_s_depart); String docFileName word-模板导出测试.doc; MapString, Object rootMap new HashMapString, Object(); rootMap.put(info, jeecgDemoExcel); rootMap.put(departs, departs); jeecgDemoExcel  为 List实体departs 为 ListMapString, Object怎么用ftl 语法了解一下 2.3、工具类 FreemarkerUtil  public class FreemarkerUtil {private static final Object LOCK new Object();/*** word文件*/public static final int WORD_FILE 1;/*** excel文件*/public static final int EXCEL_FILE 2;private static Configuration cfg;private static FreemarkerUtil ftl ;private FreemarkerUtil(String templateFolder) throws IOException {cfg new Configuration();cfg.setDirectoryForTemplateLoading(new File(templateFolder));cfg.setObjectWrapper(new DefaultObjectWrapper());}private static void check(HttpServletRequest request) {if (ftl null) {synchronized (LOCK) {try {ftl new FreemarkerUtil(request.getServletContext().getRealPath(/)export/template);} catch (IOException e) {e.printStackTrace();}}}}/*** 创建 word 文档* 必须先设置response导出配置然后解析模版否则会出问题* throws IOException */public static void createFile(String templateName,String docFileName, MapString,Object rootMap,HttpServletRequest request, HttpServletResponse response,int fileType) throws IOException {// response.resetBuffer();//设置导出response.addHeader(Cache-Control,no-cache);response.setCharacterEncoding(UTF-8);if( WORD_FILE fileType){response.setContentType(application/vnd.ms-word;charsetUTF-8);}else if(EXCEL_FILE fileType){response.setContentType(application/octet-stream;charsetUTF-8);}else{response.setContentType(application/octet-stream);}String ua request.getHeader(user-agent);ua ua null ? null : ua.toLowerCase();if(ua ! null (ua.indexOf(firefox) 0 || ua.indexOf(safari)0)){try {docFileName new String(docFileName.getBytes(),ISO8859-1);response.addHeader(Content-Disposition,attachment;filename docFileName);} catch (Exception e) {}}else{try {docFileName URLEncoder.encode(docFileName, utf-8);response.addHeader(Content-Disposition,attachment;filename docFileName);} catch (Exception e) {}}check(request);//解析模版Template temp cfg.getTemplate(templateName, UTF-8);PrintWriter write response.getWriter();try {temp.process(rootMap, write);} catch (TemplateException e) {e.printStackTrace();}finally {if(write ! null){write.flush();write.close();}}} }   2.4、ftl 模板 https://files.cnblogs.com/files/niceyoo/ftl2doc.rar 至于ftl 如何生成以及如何写可自定查询后面也会单独文章补充。    博客地址http://www.cnblogs.com/niceyoo   posted 2018-12-17 13:33 niceyoo 阅读(...) 评论(...) 编辑 收藏
http://www.pierceye.com/news/315264/

相关文章:

  • idea的网站开发登录页面做网页的
  • 寻找大连网站建设wordpress换模板 seo
  • 二手房公司网站源码网站的维护步骤
  • 衡水企业网站建设公司wordpress 快速回复
  • 网站维护需要关闭网站么找哪些公司做网站
  • 阿里巴巴做轮播网站如何建设学校的微网站首页
  • 国内设计好的网站案例网店设计风格怎么写
  • 网站建设长沙创建网页需要多少钱
  • 南通电商网站建设网站背景怎么设置
  • 无锡网站托管aspnet通讯录网站开发
  • 卫计网站建设工作总结铜陵建设行业培训学校网站
  • 手机网站竞价网页界面设计遵循的原则
  • 徐州seo推广公司广州营销型网站优化
  • 小说网站首页模板安徽华力建设集团网站
  • 减肥网站如何做公司企业模板
  • 郑州网站建设搜q.479185700怎么在百度上推广自己的公司信息
  • 深圳住建设局官方网站大连在哪个省市
  • 吉林企业建站系统费用wordpress幻灯片加载很慢
  • com域名和网站小型企业网站排名前十
  • 网站内容 优化泉州网站开发公司
  • 假发外贸网站模板做图库网站需要多少钱
  • 网站建设公司 知道万维科技wordpress支持移动
  • 经典网站建设邢台网站建设策划
  • 系统数据库与建设网站网站提交入口大全
  • 网站做数据分析的意义西安网站建设kxccc
  • 免费建个人网站alexa排名搜索
  • 做的网站第二年续费多钱店铺装修模板
  • 这么自己建设网站中卫网站设计厂家
  • 公司网站制作哪家公司好广州建设执业资格注册中心网站
  • 北京所有做招聘类网站建站公司Apache Wordpress伪静态处理