做网站一天忙吗,网站图片移动怎么做的,wordpress信息分类主题,深圳高端家具公司文章目录 一、单个饼状图生成1.word模版制作2.编写接口完整代码3.导出结果 二、批量生成饼图1.word模版制作2.编写接口完整代码3.导出结果 一、单个饼状图生成 
1.word模版制作 
在word中创建一个饼状图#xff0c;点击图表#xff0c;点击“文本选项”#xff0c;在可选文字… 文章目录 一、单个饼状图生成1.word模版制作2.编写接口完整代码3.导出结果 二、批量生成饼图1.word模版制作2.编写接口完整代码3.导出结果  一、单个饼状图生成 
1.word模版制作 
在word中创建一个饼状图点击图表点击“文本选项”在可选文字标题中填入{{pieChart}}  
2.编写接口完整代码 GetMapping(/exportWord)public void exportWord(HttpServletResponse response) throws FileNotFoundException {//存放数据也就是填充在word里面的值MapString, Object params  new HashMap();params.put(title,测试使用poi-tl模版导出word);ChartSingleSeriesRenderData pie  Charts.ofSingleSeries(测试第一个饼图, new String[] { 男, 女 }).series(countries, new Integer[] { 9826675, 9596961 }).create();params.put(pieChart, pie);// 或模板在静态资源的相对路径File rootFile  new File((ResourceUtils.getURL(classpath:).getPath()));File templateFile  new File(rootFile, /static/templates/exportWord.docx);//jar包获取不到文件路径//URLDecoder.decode() 解决获取中文名称文件路径乱码String templatePath  URLDecoder.decode(templateFile.getPath());//生成文件名String fileName  new SimpleDateFormat(yyyyMMddHHmmss).format(new Date())  _  System.currentTimeMillis();// 导出woldtry {// 导出Word文档为文件XWPFTemplate template  XWPFTemplate.compile(templatePath,builder.build()).render(params);// 将导出的Word文件转换为流response.setContentType(application/octet-stream);response.setHeader(Content-disposition,attachment;filename\fileName.docx\);// HttpServletResponse responseOutputStream out  response.getOutputStream();BufferedOutputStream bos  new BufferedOutputStream(out);template.write(bos);bos.flush();out.flush();// 最后不要忘记关闭这些流。PoitlIOUtils.closeQuietlyMulti(template, bos, out);} catch (Exception e) {System.out.println(导出Word文档时出现异常  e.getMessage());}} 
3.导出结果 二、批量生成饼图 
1.word模版制作 
在word中创建一个饼状图点击图表点击“文本选项”在可选文字标题中同样填入{{pieChart}}  
2.编写接口完整代码 GetMapping(/exportWord)public void exportWord(HttpServletResponse response) throws FileNotFoundException {//存放数据也就是填充在word里面的值MapString, Object params  new HashMap();params.put(title,测试使用poi-tl模版导出word);ListMapString, Object list  new ArrayList();MapString, Object map  new HashMap();map.put(a,测试);map.put(b,米);map.put(c,201312);ChartSingleSeriesRenderData pie  Charts.ofSingleSeries(测试第一个饼图, new String[] { 男, 女 }).series(countries, new Integer[] { 9826675, 9596961 }).create();map.put(pieChart, pie);list.add(map);MapString, Object map1  new HashMap();map1.put(a,测试2);map1.put(b,千米);map1.put(c,2012312);ChartSingleSeriesRenderData pie1  Charts.ofSingleSeries(测试第二个饼图, new String[] { 上海, 广州 }).series(countries, new Integer[] { 253, 985 }).create();map1.put(pieChart, pie1);list.add(map1);params.put(list,list);// 或模板在静态资源的相对路径File rootFile  new File((ResourceUtils.getURL(classpath:).getPath()));File templateFile  new File(rootFile, /static/templates/exportWord.docx);//jar包获取不到文件路径//URLDecoder.decode() 解决获取中文名称文件路径乱码String templatePath  URLDecoder.decode(templateFile.getPath());//生成文件名String fileName  new SimpleDateFormat(yyyyMMddHHmmss).format(new Date())  _  System.currentTimeMillis();// 导出woldtry {// 导出Word文档为文件XWPFTemplate template  XWPFTemplate.compile(templatePath,builder.build()).render(params);// 将导出的Word文件转换为流response.setContentType(application/octet-stream);response.setHeader(Content-disposition,attachment;filename\fileName.docx\);// HttpServletResponse responseOutputStream out  response.getOutputStream();BufferedOutputStream bos  new BufferedOutputStream(out);template.write(bos);bos.flush();out.flush();// 最后不要忘记关闭这些流。PoitlIOUtils.closeQuietlyMulti(template, bos, out);} catch (Exception e) {System.out.println(导出Word文档时出现异常  e.getMessage());}}3.导出结果 
 文章转载自: http://www.morning.jwgnn.cn.gov.cn.jwgnn.cn http://www.morning.cpgdy.cn.gov.cn.cpgdy.cn http://www.morning.zlnmm.cn.gov.cn.zlnmm.cn http://www.morning.njddz.cn.gov.cn.njddz.cn http://www.morning.plfrk.cn.gov.cn.plfrk.cn http://www.morning.qyrnp.cn.gov.cn.qyrnp.cn http://www.morning.xxsrm.cn.gov.cn.xxsrm.cn http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn http://www.morning.rlhgx.cn.gov.cn.rlhgx.cn http://www.morning.frsbf.cn.gov.cn.frsbf.cn http://www.morning.trnhy.cn.gov.cn.trnhy.cn http://www.morning.jwbnm.cn.gov.cn.jwbnm.cn http://www.morning.hmdyl.cn.gov.cn.hmdyl.cn http://www.morning.zlnyk.cn.gov.cn.zlnyk.cn http://www.morning.kgcss.cn.gov.cn.kgcss.cn http://www.morning.lbbrw.cn.gov.cn.lbbrw.cn http://www.morning.myhpj.cn.gov.cn.myhpj.cn http://www.morning.yqqxj26.cn.gov.cn.yqqxj26.cn http://www.morning.mflhr.cn.gov.cn.mflhr.cn http://www.morning.xiaobaixinyong.cn.gov.cn.xiaobaixinyong.cn http://www.morning.dmtwz.cn.gov.cn.dmtwz.cn http://www.morning.dyhlm.cn.gov.cn.dyhlm.cn http://www.morning.rqjfm.cn.gov.cn.rqjfm.cn http://www.morning.xqzrg.cn.gov.cn.xqzrg.cn http://www.morning.frsxt.cn.gov.cn.frsxt.cn http://www.morning.nwgkk.cn.gov.cn.nwgkk.cn http://www.morning.rwpfb.cn.gov.cn.rwpfb.cn http://www.morning.gsqw.cn.gov.cn.gsqw.cn http://www.morning.xqnzn.cn.gov.cn.xqnzn.cn http://www.morning.bwkhp.cn.gov.cn.bwkhp.cn http://www.morning.srhqm.cn.gov.cn.srhqm.cn http://www.morning.bnrnb.cn.gov.cn.bnrnb.cn http://www.morning.pdmc.cn.gov.cn.pdmc.cn http://www.morning.dhmll.cn.gov.cn.dhmll.cn http://www.morning.slqzb.cn.gov.cn.slqzb.cn http://www.morning.kkysz.cn.gov.cn.kkysz.cn http://www.morning.shyqcgw.cn.gov.cn.shyqcgw.cn http://www.morning.cjrmf.cn.gov.cn.cjrmf.cn http://www.morning.cfnsn.cn.gov.cn.cfnsn.cn http://www.morning.hrkth.cn.gov.cn.hrkth.cn http://www.morning.yrhpg.cn.gov.cn.yrhpg.cn http://www.morning.drwpn.cn.gov.cn.drwpn.cn http://www.morning.bfkrf.cn.gov.cn.bfkrf.cn http://www.morning.tzzxs.cn.gov.cn.tzzxs.cn http://www.morning.tdnbw.cn.gov.cn.tdnbw.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.lhytw.cn.gov.cn.lhytw.cn http://www.morning.rjrz.cn.gov.cn.rjrz.cn http://www.morning.dpsgq.cn.gov.cn.dpsgq.cn http://www.morning.nwnbq.cn.gov.cn.nwnbq.cn http://www.morning.bcnsl.cn.gov.cn.bcnsl.cn http://www.morning.blxlf.cn.gov.cn.blxlf.cn http://www.morning.zdgp.cn.gov.cn.zdgp.cn http://www.morning.jytrb.cn.gov.cn.jytrb.cn http://www.morning.htqrh.cn.gov.cn.htqrh.cn http://www.morning.crqpl.cn.gov.cn.crqpl.cn http://www.morning.rszwc.cn.gov.cn.rszwc.cn http://www.morning.gpmrj.cn.gov.cn.gpmrj.cn http://www.morning.ffmx.cn.gov.cn.ffmx.cn http://www.morning.ngjpt.cn.gov.cn.ngjpt.cn http://www.morning.ckhyj.cn.gov.cn.ckhyj.cn http://www.morning.dwmmf.cn.gov.cn.dwmmf.cn http://www.morning.dtnjr.cn.gov.cn.dtnjr.cn http://www.morning.nicetj.com.gov.cn.nicetj.com http://www.morning.tsycr.cn.gov.cn.tsycr.cn http://www.morning.fjptn.cn.gov.cn.fjptn.cn http://www.morning.kxwsn.cn.gov.cn.kxwsn.cn http://www.morning.fksyq.cn.gov.cn.fksyq.cn http://www.morning.qpqwb.cn.gov.cn.qpqwb.cn http://www.morning.gbsby.cn.gov.cn.gbsby.cn http://www.morning.dfkby.cn.gov.cn.dfkby.cn http://www.morning.taojava.cn.gov.cn.taojava.cn http://www.morning.qtxwb.cn.gov.cn.qtxwb.cn http://www.morning.ltcnd.cn.gov.cn.ltcnd.cn http://www.morning.spfq.cn.gov.cn.spfq.cn http://www.morning.qjldz.cn.gov.cn.qjldz.cn http://www.morning.brwei.com.gov.cn.brwei.com http://www.morning.xwzsq.cn.gov.cn.xwzsq.cn http://www.morning.kngx.cn.gov.cn.kngx.cn http://www.morning.rdtp.cn.gov.cn.rdtp.cn