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

上海网站空间百度数据网站

上海网站空间,百度数据网站,日本亚马逊官网,免费做微网站本文相当于笔记,主要根据官方文档Poi-tl Documentation和poi-tl的使用(最全详解)_JavaSupeMan的博客-CSDN博客文章进行学习(上班够用) Data AllArgsConstructor NoArgsConstructor ToString EqualsAndHashCode public …

本文相当于笔记,主要根据官方文档Poi-tl Documentation和poi-tl的使用(最全详解)_JavaSupeMan的博客-CSDN博客文章进行学习(上班够用)

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class Author {private String name;private String sex;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class Student implements Serializable {private String name;private String startTime;private Author author;private String img;
}

两个实体类

下边测试类

@SpringBootTest
@RunWith(SpringRunner.class)
@Slf4j
public class Demo {@Testpublic void Tx01() throws IOException {Map<String, Object> datas = new HashMap<String, Object>();//        对象形式 存储对象Student student = new Student("华", "2023-09-02 20:41:10",new Author("张三", "男"),null);datas.put("student",student);//        处理文字样式(下划线等)
//        Style underlineStyle = Style.builder().underline().build();datas.put("var",Texts.of("hello").bold().italic().create());//        图片  http://deepoove.com/images/icecream.png
//        datas.put("image","http://deepoove.com/images/icecream.png");
//        datas.put("svg","http://deepoove.com/images/icecream.png");
//        datas.put("svg",Pictures.ofUrl("http://deepoove.com/images/icecream.png")
//                .size(100,100).create());datas.put("image", Pictures.ofUrl("https://ee19hua.oss-cn-beijing.aliyuncs.com/images/2022/09/24/1664008700443.jpg").size(400, 300).create());//        表格 基本操作//RowRenderData就是指定每一行数据的,可以去官网查阅,这里相当于设置了三行,row0就是表头,row1,row2是表内容RowRenderData row0 = Rows.of("姓名", "学历").textColor("FFFFFF").bgColor("4472C4").center().create();RowRenderData row1 = Rows.create("李四", "博士");RowRenderData row2 = Rows.create("李四", "博士");MergeCellRule rule1 = MergeCellRule.builder().map(MergeCellRule.Grid.of(0,0),MergeCellRule.Grid.of(0,1)).build();//合并单元格(第几行第几列)datas.put("var1", Tables.of(row0, row1,row2).mergeRule(rule1).create());//合并单元格RowRenderData roW0 = Rows.of("列0", "列1", "列2", "列3").bgColor("4472C4").textColor("7F7f7F").textFontFamily("Hei").textFontSize(15).center().create();RowRenderData roW1 = Rows.create("没有数据", null, null, null);//第一行//合并第几行第几列 到 第几行第几列MergeCellRule rule = MergeCellRule.builder().map(MergeCellRule.Grid.of(1, 0), MergeCellRule.Grid.of(1, 2)).build();datas.put("var2", Tables.of(roW0, roW1).mergeRule(rule).create());//       动态生成表格   列表循环  Configure.builder()Student s1 = new Student("张三", "2023-09-02 20:41:10",new Author("赵", "男"),"https://ee19hua.oss-cn-beijing.aliyuncs.com/images/2022/09/24/1664008700443.jpg");Student s2 = new Student("李四", "2023-09-02 20:41:10",new Author("钱", "男"),"https://ee19hua.oss-cn-beijing.aliyuncs.com/images/2022/09/24/1664008700443.jpg");Student s3 = new Student("王五", "2023-09-02 20:41:10",new Author("孙", "女"),"https://ee19hua.oss-cn-beijing.aliyuncs.com/images/2022/09/24/1664016579528.png");Student s4 = new Student("赵六", "2023-09-02 20:41:10",new Author("李", "女"),"https://ee19hua.oss-cn-beijing.aliyuncs.com/images/2022/09/24/1664008700443.jpg");List<Student> studentList = new ArrayList<>();studentList.add(s1);studentList.add(s2);studentList.add(s3);studentList.add(s4);datas.put("lists",studentList);// 插件列表,可以去官网查看,有列循环,还有行循环,这里是行循环实例LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();//这里可以指定一个 config 类,用来指定一些规则,也可以改变模板中{{}}的这种格式Configure config = Configure.builder().bind("lists", policy).build();//        列表datas.put("listString",studentList);//模板地址String templateFilePath = "d:/data/template/";//生成文件的保存地址String destFilePath = "d:/data/template/word";
//        生成wordXWPFTemplate compile = XWPFTemplate.compile(templateFilePath + "test1.docx",config);
//        XWPFTemplate compile = XWPFTemplate.compile(templateFilePath + "test3.docx",config);compile.render(datas);//输出为文件,指定输出文件名compile.writeToFile(destFilePath+"out_test01.docx");System.out.println("运行完成-------------------------------------");}}

word模板

 生成结果:

 

如果想生成柱状图等,按照官网进行学习即可,以上两篇(官网,和博客学习够用)

http://www.yidumall.com/news/31291.html

相关文章:

  • 电商网站开发的项目描述跨境电商有哪些平台
  • 学校网站建设汇报游戏推广员如何推广引流
  • 网站地址栏seo案例模板
  • 做网站怎么打不开localhost中国十大搜索引擎排名
  • 网站制作 推荐新鸿儒优化设计七年级下册语文答案
  • 网站建设最流行语言收录优美的图片app
  • 张家港网站建设做网站现在做百度推广有用吗
  • 短视频网站如何做推广网站优化外包多少钱
  • 室内设计作品欣赏海洋seo
  • 长沙装修网站排名企业建站流程
  • 免费注册个人个人网站如何创建个人网页
  • 如何用oss做视频网站巨量算数数据分析入口
  • 淘客手机版网站怎么做推广发帖网站
  • 哪些网站是用vue做的教育培训机构官网
  • 上海网站建设品牌灰色关键词排名收录
  • 泉州网站制作推广站长之家域名查询鹿少女
  • 做网站怎么收费软文推广营销平台
  • 成人版哔哩哔哩bilibiliseo业务培训
  • 金融网站建设方案ppt模板关键字排名优化公司
  • 手机网站建设动态推广用哪个平台效果好
  • 小程序商城开发优化网站搜索
  • 十堰北京网站建设重大新闻事件
  • 网站单页站群佛山本地网站建设
  • 模板做的网站不好优化nba最新交易
  • 查找网站开发者宁波网站排名优化seo
  • 做网站需求 后期方便优化培训网
  • 黔东南企业网站建设网站优化排名查询
  • 青海省教育厅门户网站外贸seo公司
  • 网站建设长春企业网站seo优化
  • 怎么做校园表白网站百度官网app