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

网上做游戏任务赚钱的网站学市场营销后悔死了

网上做游戏任务赚钱的网站,学市场营销后悔死了,3d动画制作软件手机版,wordpress主题包怎么做文章目录 一、单个饼状图生成1.word模版制作2.编写接口完整代码3.导出结果 二、批量生成饼图1.word模版制作2.编写接口完整代码3.导出结果 一、单个饼状图生成 1.word模版制作 在word中创建一个饼状图,点击图表,点击“文本选项”,在可选文字…

文章目录

  • 一、单个饼状图生成
    • 1.word模版制作
    • 2.编写接口完整代码
    • 3.导出结果
  • 二、批量生成饼图
    • 1.word模版制作
    • 2.编写接口完整代码
    • 3.导出结果

一、单个饼状图生成

1.word模版制作

在word中创建一个饼状图,点击图表,点击“文本选项”,在可选文字标题中填入{{pieChart}}
在这里插入图片描述

2.编写接口完整代码

    @GetMapping("/exportWord")public void exportWord(HttpServletResponse response) throws FileNotFoundException {//存放数据,也就是填充在word里面的值Map<String, 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}}
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d4c372a1df774bad94b3f0662e886959.png

2.编写接口完整代码

    @GetMapping("/exportWord")public void exportWord(HttpServletResponse response) throws FileNotFoundException {//存放数据,也就是填充在word里面的值Map<String, Object> params = new HashMap<>();params.put("title","测试使用poi-tl模版导出word");List<Map<String, Object>> list = new ArrayList<>();Map<String, 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);Map<String, 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.ds6.com.cn/news/115345.html

相关文章:

  • 怎么做qq盗号网站seo快速排名服务
  • 浙江城乡建设网站如何做网站搜索引擎优化
  • 金华app网站开发seo技术介绍
  • 企业网站管理系统模板如何自己开网站
  • 项目推广平台排行榜衡阳seo优化报价
  • 南阳网站排名优化报价青岛seo推广专员
  • 蘑菇丁毕业设计网站昆山网站建设推广
  • 做一张网站图多少钱软文写作300字
  • 网站开发报价表的文档成都网站快速开发
  • 网站建设开发综合实训报告全国疫情最新消息
  • 外贸网络推广怎样做武汉seo服务多少钱
  • seo建设网站如何去做网络推广
  • 如何帮客户做网站2022推广app赚佣金平台
  • 网络规划设计师考纲教材改版新旧对比宁波正规站内优化seo
  • 做网站实训心得线下营销方式主要有哪些
  • 郑州高端网站开发3分钟搞定网站seo优化外链建设
  • 信誉好的唐山网站建设百度图像搜索
  • 现在还有用dw做网站百度关键词排名联系方式
  • 做网站推广的工作内容郑州seo外包公司哪家好
  • 产品设计公司规划seo关键词排名优化技巧
  • 苏州刚刚发生大事件淘宝关键词优化怎么弄
  • 甘肃省水利厅引洮工程建设管理局网站广告投放的方式有哪些
  • 服务公司口号网络seo优化平台
  • 广东哪家网站建设网页设计服务百度关键词快速排名方法
  • 做网站用什么软件最简单湖南百度推广开户
  • 做网站推广选择什么最好长春网站推广排名
  • 聊城网站建设哪个好些站长seo推广
  • 宜昌优化网站建设搜索量查询百度指数
  • 苏州建站推广公司seo优化师
  • wordpress做商城网站seo每天一贴博客