freemarker 导出苹果电脑加载不出图片,安卓能加载出来,html模板富文本格式

因为mac电脑识别不出在线 base64图片连接,只识别http形式的在线连接,安卓之别base64链接,不识别http连接,所以得特殊处理,兼容。

//设置下级提交单位名称
Map<String,Object> dataMap = new HashMap<String, Object>();
dataMap.put("newsReadTitle", record.getNewsReadTitle());
dataMap.put("periodical", record.getPeriodical());
dataMap.put("periodicalDate", record.getPeriodicalDate());
dataMap.put("unitCall", record.getUnitCall());
dataMap.put("periodicalTitle", record.getPeriodicalTitle());
dataMap.put("pContent", record.getPeriodicalContent());
response.setContentType("application/vnd.ms-word;charset=UTF-8");
String fileName = record.getNewsReadTitle() +".doc";
String sDownLoadName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
response.setHeader("Content-disposition", "attachment; filename=" + sDownLoadName);
Configuration configuration = new Configuration();
configuration.setDefaultEncoding("utf-8");
/**
 * 以下是两种指定ftl文件所在目录路径的方式,注意这两种方式都是
 * 指定ftl文件所在目录的路径,而不是ftl文件的路径
 */
configuration.setClassForTemplateLoading(this.getClass(), "/template");
//以utf-8的编码读取ftl文件
Template template = configuration.getTemplate("newspaperreview.ftl", "utf-8");
ServletOutputStream servletout = response.getOutputStream();
Writer out = new BufferedWriter(new OutputStreamWriter(servletout, "utf-8"), 10240);
template.process(dataMap, out);
servletout.flush();
servletout.close();
out.flush();
out.close();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值