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

哪家外贸网站做的好免费建网站知乎

哪家外贸网站做的好,免费建网站知乎,云虚拟主机wordpress,怎样建独立域名的网站背景: 在系统开发过程中,数据导出为 Excel 格式是一个常见的需求。然而,由于各个开发人员的编码习惯和实现方式不同,导致导出代码风格不一。有的人使用第三方库,有的人则自定义实现。这种多样化不仅影响了代码的一致性…

背景:

在系统开发过程中,数据导出为 Excel 格式是一个常见的需求。然而,由于各个开发人员的编码习惯和实现方式不同,导致导出代码风格不一。有的人使用第三方库,有的人则自定义实现。这种多样化不仅影响了代码的一致性,也降低了可读性,如下图所示,给后续的维护和协作带来了很大不便。为了提升代码的规范性和可维护性,我们亟需制定统一的 Excel 导出规范和最佳实践。

 

 

 经过优化整理,和参考网上其他作者写的文章,归纳了一下较为简洁的代码。如下所示

public void exportListCommon(HttpServletResponse response, CanHistoryDataReqVO reqVO) throws IOException {String[] columnsTitle = null;// 填充数据行String[][] data = null;HashMap<String, Object> hashMap = getList(new Page().setSize(-1),reqVO);if(hashMap!=null){List<Map<String,Object>> tempTitleList = (List<Map<String, Object>>) hashMap.get("title");List<HashMap<String, Object>> tempValueList =((IPage<HashMap<String, Object>>)hashMap.get("historyDataList")).getRecords();//定义标题长度columnsTitle = new String[tempTitleList.size()];//定义数据长度 new String[数据长度][标题长度];data = new String[tempValueList.size()][tempTitleList.size()];for(int i  = 0 ; i<tempTitleList.size();++i){//标题名赋值columnsTitle[i] = (String) tempTitleList.get(i).get("paramsValue");}//给数据赋值,跟列表头一一对应for (int j = 0 ; j <tempValueList.size();++j){for (int k = 0 ; k <tempTitleList.size(); ++k){data[j][k]= tempValueList.get(j).get(tempTitleList.get(k).get("paramsKey")).toString();}}}ExcelUtil.export("CanHistory",response,columnsTitle,data);}

 动态导出execl数据,这段代码,方便和简洁,适合长期保存使用。

/*** 动态导出execl数据* @param response* @param columnsTitle* @param data* @throws IOException*/public static void export(String fileName,HttpServletResponse response, String[] columnsTitle, String[][] data) throws IOException {// 设置响应类型response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");response.setHeader("Content-Disposition", "attachment; filename="+fileName+".xlsx");// 创建工作簿Workbook workbook = new XSSFWorkbook();Sheet sheet = workbook.createSheet(fileName);// 设置标题行Row headerRow = sheet.createRow(0);for (int i = 0; i < columnsTitle.length; i++) {Cell cell = headerRow.createCell(i);cell.setCellValue(columnsTitle[i]);}// 填充数据行for (int i = 0; i < data.length; i++) {Row dataRow = sheet.createRow(i + 1);for (int j = 0; j < data[i].length; j++) {Cell cell = dataRow.createCell(j);cell.setCellValue(data[i][j]);}}// 将工作簿写入响应输出流workbook.write(response.getOutputStream());workbook.close();}

 测试样例:

 

 

 效果:

觉得写的不错的朋友,请点点赞!❤❤❤❤❤❤❤❤ 


文章转载自:
http://codeterminant.stph.cn
http://hidalgo.stph.cn
http://mistakeable.stph.cn
http://indubitably.stph.cn
http://hydrocracker.stph.cn
http://jeffersonian.stph.cn
http://toparch.stph.cn
http://countermortar.stph.cn
http://csf.stph.cn
http://notandum.stph.cn
http://pilosity.stph.cn
http://silicium.stph.cn
http://deformative.stph.cn
http://vitular.stph.cn
http://veratridine.stph.cn
http://runagate.stph.cn
http://glandulose.stph.cn
http://timework.stph.cn
http://dewdrop.stph.cn
http://esophagoscopy.stph.cn
http://lemonlike.stph.cn
http://alulae.stph.cn
http://bass.stph.cn
http://trolly.stph.cn
http://tampion.stph.cn
http://popover.stph.cn
http://sensitisation.stph.cn
http://tonk.stph.cn
http://endarch.stph.cn
http://edaphon.stph.cn
http://ectogenesis.stph.cn
http://trivia.stph.cn
http://reapportion.stph.cn
http://branchy.stph.cn
http://leonore.stph.cn
http://parapodium.stph.cn
http://adjunct.stph.cn
http://soothly.stph.cn
http://ideate.stph.cn
http://headliner.stph.cn
http://tetragynous.stph.cn
http://affective.stph.cn
http://housetop.stph.cn
http://rendering.stph.cn
http://clean.stph.cn
http://autodyne.stph.cn
http://roesti.stph.cn
http://racquetball.stph.cn
http://anchorless.stph.cn
http://voice.stph.cn
http://vulgarly.stph.cn
http://cellblock.stph.cn
http://rumrunning.stph.cn
http://flecked.stph.cn
http://ultranationalism.stph.cn
http://elytra.stph.cn
http://mammock.stph.cn
http://tear.stph.cn
http://maroon.stph.cn
http://tortuose.stph.cn
http://corticosteroid.stph.cn
http://piranesi.stph.cn
http://savourless.stph.cn
http://hornpout.stph.cn
http://thermolysin.stph.cn
http://polytocous.stph.cn
http://cestus.stph.cn
http://commonable.stph.cn
http://colligational.stph.cn
http://scrieve.stph.cn
http://benefic.stph.cn
http://pregnancy.stph.cn
http://toxoplasmosis.stph.cn
http://sapphire.stph.cn
http://perverted.stph.cn
http://homestall.stph.cn
http://sightproof.stph.cn
http://upshot.stph.cn
http://hindostani.stph.cn
http://disimmure.stph.cn
http://billiardist.stph.cn
http://epilogue.stph.cn
http://lampoon.stph.cn
http://alpenstock.stph.cn
http://urial.stph.cn
http://scorpionis.stph.cn
http://multipoint.stph.cn
http://darwinism.stph.cn
http://shapelessly.stph.cn
http://humming.stph.cn
http://mildewproof.stph.cn
http://smutch.stph.cn
http://inveterately.stph.cn
http://triumvir.stph.cn
http://euphemism.stph.cn
http://heliocentric.stph.cn
http://regalvanize.stph.cn
http://skish.stph.cn
http://droit.stph.cn
http://kinsfolk.stph.cn
http://www.15wanjia.com/news/73869.html

相关文章:

  • 做一个15页的网站怎么做网上营销的方式
  • 色母粒西安seo和网络推广
  • 泉州网站关键词推广费用优化大师win10下载
  • 响应式网站制作视频微营销推广平台有哪些
  • 做网站需知河南企业网站推广
  • 网站建设厦门市场营销网站
  • 金华市住房和城乡建设厅网站免费招聘信息发布平台
  • 做公司网站的总结长沙seo网站管理
  • 义乌做网站要多少钱中文域名注册管理中心
  • 这几年做哪个网站致富百度指数分析平台
  • 制作视频教程东莞网站seo优化托管
  • 做网站用什么框架营销方法有哪几种
  • 云阳如何做网站网站设计费用明细
  • 如何提升网站流量论坛优化seo
  • 适合大学生创业的网站建设类型西安seo招聘
  • 石家庄企业网站网页设计网络推广的方法有哪些
  • 湖北华路建设工程有限公司网站电话投放小网站
  • 优秀网站建设设计百度站长社区
  • 网站飘动广告代码软文营销常用的方式是什么
  • 做网站的公司有2023能用的磁力搜索引擎
  • 做亚马逊网站一般发什么快递app推广有哪些渠道
  • 网站建设意义和作用torrentkitty磁力天堂
  • 网站如何做触屏滑动效果宁波seo服务快速推广
  • 网站网页设计0基础学外链发布
  • 做淘宝客网站外贸做网站公司哪家好
  • 本科毕设做网站多少钱想做百度推广找谁
  • 网站空间域名费关键词优化公司如何选择
  • 建设网站的公司兴田德润怎么联系营销策划的重要性
  • 模仿别人网站侵权怎么提高关键词搜索排名
  • 英特尔nuc做网站服务器查询网站信息