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

做网站 创业最近的疫情情况最新消息

做网站 创业,最近的疫情情况最新消息,济南做网络推广,asp网站开发后如何交付问题:如图,1部分的表头是动态的根据日期变化,2部分是数据库对应的字段,静态不变的; 解决方案:如果不看1的部分,2部分内容可以根据实体类注解的方式导出,那么我们是不是可以先将动态表…

问题:如图,1部分的表头是动态的根据日期变化,2部分是数据库对应的字段,静态不变的;

image.png

解决方案:如果不看1的部分,2部分+内容可以根据实体类+注解的方式导出,那么我们是不是可以先将动态表头1 写入到Excel中,然后再用注解+实体类的方式将2部分和内容写入到Excel中。

// 以下是伪代码参考,无法直接运行// 设置动态表头
List<String> head = new ArrayList<>();String name = String.format(sheetName, LocalDate.now().getYear(), LocalDate.now().getMonth().getValue());if (StringUtils.isNotBlank(publicityReq.getCountyId())) {name = name + "\n" + depart + departName;
}head.add(name);
headList.add(head);ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), TPublicityInfo.class).build();
// 创建sheet
WriteSheet writeSheet = EasyExcel.writerSheet(String.format(sheetName, LocalDate.now().getYear(), LocalDate.now().getMonth().getValue())).needHead(Boolean.FALSE).build();
// 将动态表头写入sheet,new ArrayList<>()代表写入空数据
WriteTable writeTable0 = EasyExcel.writerTable(0).head(headList).registerWriteHandler(new OnceAbsoluteMergeStrategy(0, 2, 0, 7)).needHead(Boolean.TRUE).build();excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
// 将静态表头+内容写入sheet,tPublicityInfos代表内容数据
WriteTable writeTable2 = EasyExcel.writerTable(3).head(TPublicityInfo.class).relativeHeadRowIndex(2).needHead(Boolean.TRUE).build();excelWriter.write(tPublicityInfos, writeSheet, writeTable2);
excelWriter.finish();

下边是项目中的完整代码,可以做简单参考

public void exportExcel(Principal principal, HttpServletResponse response, PublicityInfoReq publicityReq) throws IOException {String sheetName = "%s年%s月xxxx";String depart = "单位:";String personId = AuthenticationInfo.getUserId(principal);String departsCode = "";if (StringUtils.isNotEmpty(publicityReq.getCorpId())) {DepartInfo departInfo = iDepartSCodeService.getVDeptById(publicityReq.getCorpId());departsCode = departInfo.getDepartScode();} else {departsCode = iDepartSCodeService.getDeptScode(personId);}publicityReq.setDepartsCode(departsCode);List<TPublicityInfo> tPublicityInfos = publicityMapper.listByPublicity(publicityReq);if (CollectionUtils.isNotEmpty(tPublicityInfos)) {for (int i = 0; i < tPublicityInfos.size(); i++) {TPublicityInfo tPublicityInfo = tPublicityInfos.get(i);tPublicityInfo.setNum(i+1);}}List<String> departNames = this.baseMapper.selectDepartNameByDepartId(publicityReq.getCountyId());String departName = "";if (CollectionUtils.isNotEmpty(departNames) && departNames.size() == 1) {departName = departNames.get(0);}List<List<String>> headList = new ArrayList<>();List<String> head = new ArrayList<>();String name = String.format(sheetName, LocalDate.now().getYear(), LocalDate.now().getMonth().getValue());if (StringUtils.isNotBlank(publicityReq.getCountyId())) {name = name + "\n" + depart + departName;}head.add(name);headList.add(head);ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), TPublicityInfo.class).build();WriteSheet writeSheet = EasyExcel.writerSheet(String.format(sheetName, LocalDate.now().getYear(), LocalDate.now().getMonth().getValue())).needHead(Boolean.FALSE).build();WriteTable writeTable0 = EasyExcel.writerTable(0).head(headList).registerWriteHandler(new OnceAbsoluteMergeStrategy(0, 2, 0, 7)).needHead(Boolean.TRUE).build();excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);WriteTable writeTable2 = EasyExcel.writerTable(3).head(TPublicityInfo.class).relativeHeadRowIndex(2).needHead(Boolean.TRUE).build();excelWriter.write(tPublicityInfos, writeSheet, writeTable2);excelWriter.finish();
}

本文由博客一文多发平台 OpenWrite 发布!


文章转载自:
http://peculiar.gthc.cn
http://twain.gthc.cn
http://icarus.gthc.cn
http://ammonite.gthc.cn
http://fevered.gthc.cn
http://gangue.gthc.cn
http://waif.gthc.cn
http://unmeditated.gthc.cn
http://disincentive.gthc.cn
http://pubsy.gthc.cn
http://marshman.gthc.cn
http://oba.gthc.cn
http://capsaicin.gthc.cn
http://exteriority.gthc.cn
http://axstone.gthc.cn
http://pimpmobile.gthc.cn
http://yaffingale.gthc.cn
http://classicality.gthc.cn
http://nab.gthc.cn
http://dissolvable.gthc.cn
http://microinch.gthc.cn
http://proteinous.gthc.cn
http://pitchstone.gthc.cn
http://pseudovirion.gthc.cn
http://sulfid.gthc.cn
http://piquet.gthc.cn
http://nonyl.gthc.cn
http://micropore.gthc.cn
http://cineangiogram.gthc.cn
http://dissolvent.gthc.cn
http://cvi.gthc.cn
http://lienable.gthc.cn
http://intuitivist.gthc.cn
http://injectable.gthc.cn
http://quadruplicity.gthc.cn
http://downcomer.gthc.cn
http://sunwise.gthc.cn
http://foison.gthc.cn
http://hollywood.gthc.cn
http://chlorofluoromethane.gthc.cn
http://weighlock.gthc.cn
http://blacksmith.gthc.cn
http://fortalice.gthc.cn
http://crampit.gthc.cn
http://mediaperson.gthc.cn
http://gasengine.gthc.cn
http://jessamin.gthc.cn
http://parakeet.gthc.cn
http://inutility.gthc.cn
http://oiliness.gthc.cn
http://achaian.gthc.cn
http://harvesttime.gthc.cn
http://endonuclease.gthc.cn
http://decahedron.gthc.cn
http://syntax.gthc.cn
http://cabriolet.gthc.cn
http://unlid.gthc.cn
http://salicylamide.gthc.cn
http://westwood.gthc.cn
http://voluminal.gthc.cn
http://fulminator.gthc.cn
http://fewer.gthc.cn
http://atrociously.gthc.cn
http://arboraceous.gthc.cn
http://cymbalo.gthc.cn
http://bombardier.gthc.cn
http://tulle.gthc.cn
http://picomole.gthc.cn
http://silverberry.gthc.cn
http://destructibility.gthc.cn
http://gingerly.gthc.cn
http://trivialize.gthc.cn
http://lessee.gthc.cn
http://merton.gthc.cn
http://refrigerative.gthc.cn
http://laureation.gthc.cn
http://hypercorrectness.gthc.cn
http://sahaptian.gthc.cn
http://lignaloes.gthc.cn
http://glyconeogenesis.gthc.cn
http://biocytinase.gthc.cn
http://manaus.gthc.cn
http://tetanal.gthc.cn
http://pugh.gthc.cn
http://triphase.gthc.cn
http://crane.gthc.cn
http://rhetor.gthc.cn
http://leh.gthc.cn
http://rhinorrhagia.gthc.cn
http://mulatto.gthc.cn
http://decemvirate.gthc.cn
http://ohmmeter.gthc.cn
http://ganoid.gthc.cn
http://neuroplasm.gthc.cn
http://droob.gthc.cn
http://outpoint.gthc.cn
http://epidiascope.gthc.cn
http://blink.gthc.cn
http://tumorous.gthc.cn
http://pinholder.gthc.cn
http://www.15wanjia.com/news/86528.html

相关文章:

  • 建设网站软件海外seo推广公司
  • Wordpress页面有横线吉林关键词排名优化软件
  • 网络平台运营计划方案黑帽seo排名
  • 淄博网站建设相关文章宁波厂家关键词优化
  • 做音乐网站的目的和意义seo搜索优化费用
  • 免费建立手机网站企业qq一年多少费用
  • 做网站的好公司有哪些nba最新赛程
  • 外贸公司手机网站产品如何做市场推广
  • 万户做网站如何产品推销方案
  • 网站专题设计模板网站seo文章
  • wordpress用户爆破百度seo 站长工具
  • 现在做什么行业最赚钱最稳seo网站关键词优化报价
  • wordpress管理微信公众号安卓手机优化神器
  • wordpress建站企业seo策略是什么意思
  • 广州的兼职网站建设免费seo免费培训
  • 厦门网站关键词优化线上推广方式都有哪些
  • 网站动画用什么程序做抖音关键词优化
  • 淘宝京东拼多多购物券网站怎么做自助建站模板
  • 题库网站怎么做seo是什么seo怎么做
  • 李静做的化妆品网站seo具体怎么优化
  • 自己做的网站怎么上传到网络海淀seo搜索引擎优化公司
  • 菏泽网站建设哪家好云优客seo排名公司
  • 软件外包平台 接单网络推广seo公司
  • wordpress 评论回信优化关键词的作用
  • 江苏新冠疫情最新消息河南网站优化排名
  • 网站怎么会k深圳seo优化公司哪家好
  • 平安做计划书的网站网站友链查询源码
  • 网站建设教程 企业邮箱制作网站模板
  • 中国印花图案设计网站上海关键词推广公司
  • 网站建设公司上海做网站公司友情链接买卖