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

做公司网站软件做三维特效的好网站

做公司网站软件,做三维特效的好网站,wordpress 改成 中文,自己做网站怎么修改语言一、介绍 在上篇文章中#xff0c;我们介绍了 apache poi 工具实现 excel 文件的导入导出。 本篇我们继续深入介绍另一款优秀的 excel 工具库#xff1a;easypoi。 二、easypoi 以前的以前#xff0c;有个大佬程序员#xff0c;跳到一家公司之后就和业务人员聊上了我们介绍了 apache poi 工具实现 excel 文件的导入导出。 本篇我们继续深入介绍另一款优秀的 excel 工具库easypoi。 二、easypoi 以前的以前有个大佬程序员跳到一家公司之后就和业务人员聊上了这些业务员对excel报表有着许许多多的要求比如想要一个报表他的表头是一个多行表头过几天之后他想要给这些表头添加样式比如关键的数据标红再过几天他想要再末尾添加一条合计的数据等等 起初还好都是copy、copy之后发现系统中出现大量的重复代码于是有一天真的忍受不了了采用注解搞定来搞定这些定制化成程度高的逻辑将公共化抽离出来于是诞生了 easypoi easypoi 的底层也是基于 apache poi 进行深度开发的它主要的特点就是将更多重复的工作全部简单化避免编写重复的代码 下面我们就一起来了解一下这款高大上的开源工具easypoi 3.1、首先添加依赖包 dependenciesdependencygroupIdcn.afterturn/groupIdartifactIdeasypoi-base/artifactIdversion4.1.0/version/dependencydependencygroupIdcn.afterturn/groupIdartifactIdeasypoi-web/artifactIdversion4.1.0/version/dependencydependencygroupIdcn.afterturn/groupIdartifactIdeasypoi-annotation/artifactIdversion4.1.0/version/dependency /dependencies3.2、采用注解导出导入 easypoi 最大的亮点就是基于注解实体类来导出、导入excel使用起来非常简单 首先我们创建一个实体类UserEntity其中Excel注解表示导出文件的头部信息。 public class UserEntity {Excel(name 姓名)private String name;Excel(name 年龄)private int age;Excel(name 操作时间,formatyyyy-MM-dd HH:mm:ss, width 20.0)private Date time;//set、get省略 }接着我们来编写导出服务 public static void main(String[] args) throws Exception {ListUserEntity dataList new ArrayList();for (int i 0; i 10; i) {UserEntity userEntity new UserEntity();userEntity.setName(张三 i);userEntity.setAge(20 i);userEntity.setTime(new Date(System.currentTimeMillis() i));dataList.add(userEntity);}//生成excel文档Workbook workbook ExcelExportUtil.exportExcel(new ExportParams(用户,用户信息),UserEntity.class, dataList);FileOutputStream fos new FileOutputStream(/Users/hello/Documents/easypoi-user1.xls);workbook.write(fos);fos.close(); }导出的文件预览如下 对应的导入操作也很简单源码如下 public static void main(String[] args) {ImportParams params new ImportParams();params.setTitleRows(1);params.setHeadRows(1);long start new Date().getTime();ListStudentEntity list ExcelImportUtil.importExcel(new File(/Users/hello/Documents/easypoi-user1.xls),UserEntity.class, params);System.out.println(new Date().getTime() - start);System.out.println(JSONArray.toJSONString(list)); }运行程序输出结果如下 [{age:20,name:张三0,time:1616919493000},{age:21,name:张三1,time:1616919493000},{age:22,name:张三2,time:1616919493000},{age:23,name:张三3,time:1616919493000},{age:24,name:张三4,time:1616919493000},{age:25,name:张三5,time:1616919493000},{age:26,name:张三6,time:1616919493000},{age:27,name:张三7,time:1616919493000},{age:28,name:张三8,time:1616919493000},{age:29,name:张三9,time:1616919493000}]3.3、自定义数据结构导出导入 easypoi 同样也支持自定义数据结构导出导入excel。 自定义数据导出 excel public static void main(String[] args) throws Exception {//封装表头ListExcelExportEntity entityList new ArrayListExcelExportEntity();entityList.add(new ExcelExportEntity(姓名, name));entityList.add(new ExcelExportEntity(年龄, age));ExcelExportEntity entityTime new ExcelExportEntity(操作时间, time);entityTime.setFormat(yyyy-MM-dd HH:mm:ss);entityTime.setWidth(20.0);entityList.add(entityTime);//封装数据体ListMapString, Object dataList new ArrayList();for (int i 0; i 10; i) {MapString, Object userEntityMap new HashMap();userEntityMap.put(name, 张三 i);userEntityMap.put(age, 20 i);userEntityMap.put(time, new Date(System.currentTimeMillis() i));dataList.add(userEntityMap);}//生成excel文档Workbook workbook ExcelExportUtil.exportExcel(new ExportParams(学生,用户信息), entityList, dataList);FileOutputStream fos new FileOutputStream(/Users/panzhi/Documents/easypoi-user2.xls);workbook.write(fos);fos.close(); }导入 excel public static void main(String[] args) {ImportParams params new ImportParams();params.setTitleRows(1);params.setHeadRows(1);long start new Date().getTime();ListMapString, Object list ExcelImportUtil.importExcel(new File(/Users/panzhi/Documents/easypoi-user2.xls),Map.class, params);System.out.println(new Date().getTime() - start);System.out.println(JSONArray.toJSONString(list)); }更多的 api 操作可以访问 Easypoi - 接口文档 三、小结 总体来说easypoi 在读写数据的时候优先是先将数据写入内存优点是读写性能非常高但是当数据量很大的时候会出现oom当然它也提供了 sax 模式的读写方式需要调用特定的方法实现。 四、参考 1、apache poi - 接口文档 2、easypoi - 接口文档 3、easyexcel - 接口文档 写到最后 不会有人刷到这里还想白嫖吧点赞对我真的非常重要在线求赞。加个关注我会非常感激 本文已整理到技术笔记中此外笔记内容还涵盖 Spring、Spring Boot/Cloud、Dubbo、JVM、集合、多线程、JPA、MyBatis、MySQL、微服务等技术栈。 需要的小伙伴可以点击 技术笔记 获取
http://www.hkea.cn/news/14565382/

相关文章:

  • 成年男女做羞羞视频网站网站的图片要会员才能下载怎么做
  • 如何攻击织梦做的网站方法义乌制作网站公司
  • 青岛网站搭建公司哪家好手机3d动画制作软件
  • 视频网站建设服务网站seo优化的重要性
  • 广州市口碑seo推广外包湖南seo优化价格
  • 南昌网站排名优化支付宝小程序代理
  • phpcms v9漏洞山西网站建设适合v加xtdseo
  • 宁波网站建设caiyiduo手机访问网站建设中
  • 快捷的网站建设软件不用买服务器可以做网站
  • 公司网站建设费会计处理wordpress term_id
  • 做效果图常用的网站有哪些软件自己代理一款手游需要多少钱
  • 用百度云做网站个人备案经营网站备案
  • .net 网站 源代码衡阳网站建设 千度网络
  • 建设网站知乎app开发公司价格
  • 帝国做的电影网站比亚迪新能源汽车e2
  • 徐州市网站如果做车站车次查询的网站需要什么消息信息
  • 重庆公司网站建设价格湖南天人安装建设有限公司网站
  • 宁波甬晟园林建设有限公司网站网站seo怎么做知乎
  • 长沙专业建设网站旅游网站的建设背景
  • 广西营销型网站建设江苏省建设招标网站
  • 伪原创php网站镜像同步程序百度经验怎么赚钱
  • 吉林省建设工程造价信息网站外贸俄罗斯俄语网站制作
  • 深圳手机网站设计公司邯郸企业建站
  • 企业门户网站建设精英三合一网站介绍
  • 杭州企业网站建设页面设置在哪里找
  • 徐州网站制作建设wordpress category.php
  • 国内外ai设计素材网站wordpress安裝
  • 新闻发布会邀请哪些媒体揭阳市seo上词外包
  • 做文化墙的网站温州建站费用
  • 网站建设app开发公司网站建设 牛商网技术提供