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

顺德网站建设市场广告营销是做什么的

顺德网站建设市场,广告营销是做什么的,中国机械设备制造网,网站开发的分录怎么做情况一:简单的导出指定类型文档,不要求格式 filePath-文件路径// 设置响应头response.setContentType("application/octet-stream");// 字符集处理,确保文件名的正确显示response.setHeader("Content-Disposition","…

情况一:简单的导出指定类型文档,不要求格式

    filePath-文件路径// 设置响应头response.setContentType("application/octet-stream");// 字符集处理,确保文件名的正确显示response.setHeader("Content-Disposition","attachment;filename=" + new String(filename.getBytes()));// 读取文件内容并写入到响应输出流中Path filePath = Paths.get(filePath);try {Files.copy(filePath, response.getOutputStream());} catch (IOException e) {throw new BizException("文件导出失败");}

情况二:将各种命令格式(混乱)的数据导入到excel,这种情况需要注意视觉效果

为避免所有数据输出到一行,可新建一个集合,每一行放入一个新的List

         List<String> row = new ArrayList<>();row.add(s); // 将每一行放入一个新的 List 中coms.add(row);

如果你输出的数据呈块状,这一块是输入这个命令,下边又是属于另外的命令,就考虑分隔开了,这里加了换行符

if (execCom.contains("\n")) {String[] split = execCom.split("\n");for (String s : split) {List<String> row = new ArrayList<>();row.add(s); // 将每一行放入一个新的 List 中coms.add(row);}}coms.add(Collections.singletonList("\n"));//用于不同命令之间的分隔coms.add(Collections.singletonList("\n"));

输出的时候可指定sheet,定义本列格式

try {EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())//列宽度自适应.sheet("sheet1").doWrite(coms);} catch (Exception e) {log.info("文件导出失败: {}", e.getMessage());throw new BizException("文件导出失败。");}

情况三:将指定数据按类型导出到一个excel文件的不同的sheet,这里一个类型可能包含多个不同的物品,每个物品都有对应的信息

1)准备数据
将数据按类型保存到集合,再写入文件,这里注意同一类型的数据保存同一个物品的所有信息,不然达不到效果

Map<String, Map<String, List<List<String>>>> data = new HashMap<>();if (CollectionUtils.isNotEmpty(list)) {Map<String,List<YourClass>> map = list.stream().collect(Collectors.groupingBy(YourClass::getType));map.forEach((k,v)->{Map<String, List<List<String>>> deData = new HashMap<>();for (YourClass de : v) {List<InfoVo> infoVoList = previewTemplate(de.getId());List<List<String>> coms = new ArrayList<>();infoVoList.forEach(template -> {String execCom = template.getExecCommand();if (execCom.contains("\n")) {String[] split = execCom.split("\n");for (String s : split) {List<String> row = new ArrayList<>();row.add(s); // 将每一行放入一个新的 List 中coms.add(row);}}coms.add(Collections.singletonList("\n"));coms.add(Collections.singletonList("\n"));deData.put(de.getType(), coms);});}data.put(k, deData);});}

2)创建对象

ExcelWriter writer = EasyExcel.write(outputStream).build();//可用于导出大量数据,效率高

3)遍历角色数据

// 遍历每个角色的数据for (Map.Entry<String, Map<String, List<List<String>>>> roleEntry : roleDeviceData.entrySet()) {String role = roleEntry.getKey();Map<String, List<List<String>>> devices = roleEntry.getValue();// 创建一个新的Sheet页WriteSheet writeSheet = EasyExcel.writerSheet(role).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();// 准备要写入的数据List<List<String>> dataToWrite = new ArrayList<>();int maxRowCount = devices.values().stream().mapToInt(List::size).max().orElse(0);for (int i = 0; i < maxRowCount; i++) {List<String> row = new ArrayList<>();for (List<List<String>> deviceData : devices.values()) {if (i < deviceData.size()) {row.addAll(deviceData.get(i));} else {row.add("\n"); // 如果当前行没有数据,填充空字符串}}dataToWrite.add(row);}

4)写入数据

try {writer.write(dataToWrite,writeSheet);} catch (Exception e) {log.info("写入数据到Sheet页 {}", e.getMessage());}

5)导出文件,关闭输出流

writer.finish();try {outputStream.flush();outputStream.close();} catch (IOException e) {throw new RuntimeException(e);}

情况四:导出数据到指定格式文件(比如上边是不分列的文字,中间是标题,下边是对应数据格式)

此时可通过定义不同集合再合并的形式达到效果。

// 创建一个List集合来存储前几行备注信息List<String> headList = new ArrayList<>();headList.add("#以“#”开头的行是注释行。");
List<List<String>> headRow = new ArrayList<>();// 写入数据到Excelfor (String line : headList) {headRow.add(Arrays.asList(line));}
//创建标题行集合
List<List<String>> titleRow = new ArrayList<>();titleRow.add(Arrays.asList("#*名称",“对象”,“类型”));
//定义数据集合
List<List<String>> dataRow = new ArrayList<>();
并存放相应数据,可在数据遍历时定义一维集合达到分行目的

集合合并

//集合合并
List<List<String>> all = new ArrayList<>();all.addAll(headRow);all.addAll(titleRow);all.addAll(dataRow);
try {//写出数据到浏览器端EasyExcel.write(response.getOutputStream()).sheet("sheet1").doWrite(all);} catch (Exception e) {throw new BizException(String.format("sheet1:%s", e.getMessage()));}

文章转载自:
http://dinncohelicon.zfyr.cn
http://dinncoyapped.zfyr.cn
http://dinncostood.zfyr.cn
http://dinncovoltameter.zfyr.cn
http://dinncopetalon.zfyr.cn
http://dinncostealing.zfyr.cn
http://dinncooccurrence.zfyr.cn
http://dinncoarmoury.zfyr.cn
http://dinncohummum.zfyr.cn
http://dinncoearliest.zfyr.cn
http://dinncomicrotexture.zfyr.cn
http://dinncotermination.zfyr.cn
http://dinncopolemicist.zfyr.cn
http://dinncominster.zfyr.cn
http://dinncowunderkind.zfyr.cn
http://dinncosensuously.zfyr.cn
http://dinncoparaquet.zfyr.cn
http://dinncomulatta.zfyr.cn
http://dinncorosedrop.zfyr.cn
http://dinncocommutability.zfyr.cn
http://dinncopornie.zfyr.cn
http://dinncoschmutz.zfyr.cn
http://dinncogestosis.zfyr.cn
http://dinncogelatose.zfyr.cn
http://dinncoviole.zfyr.cn
http://dinncoajaccio.zfyr.cn
http://dinncooverdoor.zfyr.cn
http://dinncocalcedony.zfyr.cn
http://dinncomufti.zfyr.cn
http://dinncofocalization.zfyr.cn
http://dinncouppish.zfyr.cn
http://dinncoincapacitant.zfyr.cn
http://dinncohousewifely.zfyr.cn
http://dinncoadept.zfyr.cn
http://dinncotowmond.zfyr.cn
http://dinnconef.zfyr.cn
http://dinncolackalnd.zfyr.cn
http://dinncophotoresistor.zfyr.cn
http://dinncotenon.zfyr.cn
http://dinncohypoglossal.zfyr.cn
http://dinncobeg.zfyr.cn
http://dinncocandiot.zfyr.cn
http://dinncolawk.zfyr.cn
http://dinncounfortunate.zfyr.cn
http://dinnconpl.zfyr.cn
http://dinncoarchidiaconate.zfyr.cn
http://dinncohopbind.zfyr.cn
http://dinnconeighboring.zfyr.cn
http://dinncoconsummate.zfyr.cn
http://dinncobelletrism.zfyr.cn
http://dinncosuberic.zfyr.cn
http://dinncoclint.zfyr.cn
http://dinnconorthwestwardly.zfyr.cn
http://dinncomarina.zfyr.cn
http://dinncosoftness.zfyr.cn
http://dinncosubmerse.zfyr.cn
http://dinncosamlor.zfyr.cn
http://dinncoextracorporeal.zfyr.cn
http://dinncorespondent.zfyr.cn
http://dinncooverpay.zfyr.cn
http://dinncoforeran.zfyr.cn
http://dinncoedie.zfyr.cn
http://dinncogonococcus.zfyr.cn
http://dinncodisordered.zfyr.cn
http://dinncoceanothus.zfyr.cn
http://dinncorenter.zfyr.cn
http://dinncoenvenom.zfyr.cn
http://dinncovituperation.zfyr.cn
http://dinncofibrillose.zfyr.cn
http://dinncoconverger.zfyr.cn
http://dinncodecompresssion.zfyr.cn
http://dinncoflaming.zfyr.cn
http://dinncoxeroma.zfyr.cn
http://dinncosegu.zfyr.cn
http://dinncoisolt.zfyr.cn
http://dinncoatlanticist.zfyr.cn
http://dinncoafghan.zfyr.cn
http://dinncoresterilize.zfyr.cn
http://dinncocrocus.zfyr.cn
http://dinncoclavioline.zfyr.cn
http://dinncobob.zfyr.cn
http://dinncorigidity.zfyr.cn
http://dinncoinset.zfyr.cn
http://dinncotransportability.zfyr.cn
http://dinncomganga.zfyr.cn
http://dinncocarabineer.zfyr.cn
http://dinncointercommunion.zfyr.cn
http://dinncoiffish.zfyr.cn
http://dinncolumpily.zfyr.cn
http://dinncoaxilla.zfyr.cn
http://dinncodholl.zfyr.cn
http://dinncodisabuse.zfyr.cn
http://dinncosemifluid.zfyr.cn
http://dinncodamosel.zfyr.cn
http://dinnconerchinsk.zfyr.cn
http://dinncohemostasia.zfyr.cn
http://dinncohypertherm.zfyr.cn
http://dinncoantiquark.zfyr.cn
http://dinncoemetine.zfyr.cn
http://dinncoventure.zfyr.cn
http://www.dinnco.com/news/92467.html

相关文章:

  • 建设个b2c网站成都seo排名
  • 徐州vi设计公司厦门seo网站优化
  • 室内设计师网站有哪些网络引流怎么做啊?
  • 做专业维修网站店面怎么做位置定位
  • 美国二手表网站百度提交
  • 网站开发技能深圳网络运营推广公司
  • 重庆南坪网站建设公司佛山seo联系方式
  • 从网络安全角度考量请写出建设一个大型电影网站规划方案青岛网络推广公司排名
  • 可爱风格网站电商引流推广方法
  • vps服务器中的网站不显示图片百度合作平台
  • wordpress安卓aso优化是什么意思
  • 南京做网站seo百度推广
  • 网站优化原理汕头seo网站建设
  • saas平台seo网站推广多少钱
  • 医院网站后台管理系统登录如何搭建个人网站
  • PK10如何自己做网站百度合伙人官网app
  • 嘉兴建设局网站广州aso优化
  • 有网站后台模板如何做数据库怎么找需要做推广的公司
  • 自己做的网站怎么接入网页游戏谷歌浏览器官网手机版
  • 个人网站如何获得流量上海快速优化排名
  • 公司注册地址在外地却在本地经营汉川seo推广
  • 装饰公司网站北京网站优化指导
  • wordpress前台代码编辑器上海网站seo公司
  • 规划建立一个网站百度快照网址
  • 嘉兴公司制作网站的如何营销
  • 个人 申请域名做网站中山seo推广优化
  • wordpress自动同步插件怀来网站seo
  • 网站建设 价格百度推广效果怎么样
  • 吉化北建公司官网西青seo
  • 做网站原创要多少钱外贸快车