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

如何建手机销售网站网页设计公司哪个好

如何建手机销售网站,网页设计公司哪个好,可以仿做网站吗,福田外贸网站建设EasyPoi系列之框架集成及基础使用 1 EasyPoi1.1 gitee仓库地址 2 EasyPoi集成至SpringBoot2.1 maven引入jar包 3 EasyPoi Excel导出3.1 基于实体对象导出3.1.1 Excel 注解3.1.2 编写实体3.1.3 编写导出方法3.1.4 导出效果 3.2 基于模板导出3.2.1 编写模板文件3.2.2 编写导出方法… EasyPoi系列之框架集成及基础使用 1 EasyPoi1.1 gitee仓库地址 2 EasyPoi集成至SpringBoot2.1 maven引入jar包 3 EasyPoi Excel导出3.1 基于实体对象导出3.1.1 Excel 注解3.1.2 编写实体3.1.3 编写导出方法3.1.4 导出效果 3.2 基于模板导出3.2.1 编写模板文件3.2.2 编写导出方法3.2.3 导出效果 4 EasyPoi 数据导入4.1 导入数据准备4.2 编写接口4.3 导入测试4.3.1 编写apiFox4.3.2 导入结果4.3.3 修改 核定金额 为“核定金额1” 5 EasyPoi 模板填充5.1 模板表达式5.2 Excel模板填充导出5.3 Word模板填充导出5.3.1 模板准备5.3.2 编写导出代码5.3.3 导出效果 6 总结 1 EasyPoi 官方介绍为EasyPoi Excel和 Word简易工具类 easypoi功能如同名字easy,主打的功能就是容易,让一个没见接触过poi的人员 就可以方便的写出Excel导出,Excel模板导出,Excel导入,Word模板导出,通过简单的注解和模板 语言(熟悉的表达式语法),完成以前复杂的写法。 1.1 gitee仓库地址 https://gitee.com/wupaas/easypoi 2 EasyPoi集成至SpringBoot 2.1 maven引入jar包 dependencygroupIdcn.afterturn/groupIdartifactIdeasypoi-spring-boot-starter/artifactIdversion4.4.0/version /dependency3 EasyPoi Excel导出 3.1 基于实体对象导出 3.1.1 Excel 注解 代码位于cn.afterturn.easypoi.excel.annotation.Excel用于通过注解标识实体字段核心属性如下 name用于表示Excel表头width导出时在excel中每个列的宽 单位为字符一个汉字2个字符suffix文字后缀如% 90 变成90%isWrap是否换行 即支持\ntype导出类型 1 是文本 2 是图片,3 是函数,10 是数字 11 特殊符号 默认是文本enumExportField枚举导出使用的字段 3.1.2 编写实体 import cn.afterturn.easypoi.excel.annotation.Excel; import lombok.Data; /*** 导出实体*/ Data public class ExportEntity {Excel(name 序号,width 20)private Integer index;Excel(name 资金性质,width 50)private String accountType;Excel(name 项目名称,width 50)private String projectName;Excel(name 申请金额,width 50)private String amountApplied;Excel(name 核定金额,width 50)private String approvedAmount; }3.1.3 编写导出方法 /*** 构建到处数据模拟数据库查询* param num* return*/ private ListExportEntity buildExportData(int num){ListExportEntity exportData new ArrayList();ExportEntity exportEntity null;for (int i 0; i num; i) {exportEntity new ExportEntity();exportEntity.setIndex(i1);exportEntity.setAccountType(资金性质i);exportEntity.setProjectName(项目名称i);exportEntity.setAmountApplied(申请金额i);exportEntity.setApprovedAmount(核定金额i);exportData.add(exportEntity);}return exportData; }/** * 通过实体导出Excel * param response */ RequestMapping(/excel/exportByEntity) public void exportByEntity(HttpServletResponse response) throws Exception {ExportParams exportParams new ExportParams();ListExportEntity datas this.buildExportData(10);Workbook workbook null;try{response.setContentType(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charsetutf-8);response.setHeader(Content-Disposition, attachment;filename URLEncoder.encode(测试exportByEntity, utf-8) .xlsx);workbook ExcelExportUtil.exportExcel(exportParams, ExportEntity.class, datas);workbook.write(response.getOutputStream());}finally {IoUtil.close(workbook);} }3.1.4 导出效果 浏览器访问 http://ip:port/excel/exportByEntity根据实际情况进行替换导出文件效果如下 3.2 基于模板导出 3.2.1 编写模板文件 具体模板语法在后续会进行讲解 3.2.2 编写导出方法 /*** 构建到处数据模拟数据库查询* param num* return*/ private ListExportEntity buildExportData(int num){ListExportEntity exportData new ArrayList();ExportEntity exportEntity null;for (int i 0; i num; i) {exportEntity new ExportEntity();exportEntity.setIndex(i1);exportEntity.setAccountType(资金性质i);exportEntity.setProjectName(项目名称i);exportEntity.setAmountApplied(申请金额i);exportEntity.setApprovedAmount(核定金额i);exportData.add(exportEntity);}return exportData; } /*** 通过模板导出* param response*/ RequestMapping(/excel/exportTemplate) public void exportByTemplate(HttpServletResponse response) throws Exception{//exportTemplate.xlsx 放在resources目录下TemplateExportParams templateExportParams new TemplateExportParams(templates/exportTemplate.xlsx);//定义map对象MapString,Object data new HashMap();ListExportEntity datas this.buildExportData(10);//将导出数据put至map中注意此处的datas与模板$fe: 后的变量名称一致data.put(datas,datas);Workbook workbook null;try{response.setContentType(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charsetutf-8);response.setHeader(Content-Disposition, attachment;filename URLEncoder.encode(测试exportTemplate, utf-8) .xlsx);workbook ExcelExportUtil.exportExcel(templateExportParams, data);workbook.write(response.getOutputStream());}finally {IoUtil.close(workbook);} }3.2.3 导出效果 浏览器访问 http://ip:port/excel/exportByEntity根据实际情况进行替换导出文件效果如下 注意通过模板导出可以用于针对复杂表头使用Excel注解无法或不好实现场景。 4 EasyPoi 数据导入 4.1 导入数据准备 以3.1中导出的Excel为例如下图 4.2 编写接口 ExportEntity为3.1中导出文件时定义的实体类 /*** excel导入* param response*/ PostMapping(/excel/importData) ResponseBody public ListExportEntity importData(HttpServletResponse response, MultipartFile file) throws Exception{ImportParams importParams new ImportParams();ListExportEntity datas ExcelImportUtil.importExcel(file.getInputStream(), ExportEntity.class, importParams);return datas; }4.3 导入测试 4.3.1 编写apiFox 在ApiFox中新建请求如下图选择对应的导入文件点击发送 4.3.2 导入结果 如下图通过图中可看出数据已从Excel中读入到实体集合中 4.3.3 修改 “核定金额” 为“核定金额1” 将“核定金额” 修改为 “核定金额1”如下图 再次进行导入可以看到由于字段不匹配未能成功导入 注意通过Excel进行导入时候1、需要保证导入的实体注解上的内容要与Excel表头文本一致前后空格会自动进行处理2、如果存在多列相同的表头会以最后一列为匹配数据进行导入。 5 EasyPoi 模板填充 5.1 模板表达式 空格分割三目运算 {{test ? obj:obj2}}n: 表示 这个cell是数值类型 {{n:}}le: 代表长度{{le:()}} 在if/else 运用{{le:() 8 ? obj1 : obj2}}fd: 格式化时间 {{fd:(obj;yyyy-MM-dd)}}fn: 格式化数字 {{fn:(obj;###.00)}}fe: 遍历数据,创建row!fe: 遍历数据不创建row$fe: 下移插入,把当前行,下面的行全部下移.size()行,然后插入!if: 删除当前列 {{!if:(test)}}单引号表示常量值 ‘’ 比如’1’ 那么输出的就是 1NULL 控制]] 换行符 5.2 Excel模板填充导出 excel模板填充可以参考3.2 基于模板导出 5.3 Word模板填充导出 5.3.1 模板准备 编写 纳税信息.docx放置在resources/templates目录下内容如下 5.3.2 编写导出代码 /*** word 测试*/ Controller RequestMapping(/word) public class WordTestController {/*** 通过模板填充word文档* param response*/RequestMapping(/exportByTemplate)public void exportByTemplate(HttpServletResponse response){try {//模拟从数据库读取数据ListMapString,String taxlist new ArrayList();MapString,String tax1 new HashMap();tax1.put(type,税种1);tax1.put(presum,1);tax1.put(thissum,2);tax1.put(curmonth,1);tax1.put(now,2025-02-18);taxlist.add(tax1);MapString,String tax2 new HashMap();tax2.put(type,税种2);tax2.put(presum,3);tax2.put(thissum,4);tax2.put(curmonth,2);tax2.put(now,2025-02-19);taxlist.add(tax2);MapString,Object data new HashMap();data.put(taxlist,taxlist);MapString,String total new HashMap();total.put(totalpreyear,4);total.put(totalthisyear,5);data.put(total,total);data.put(totalpreyear,测试3);data.put(totalthisyear,测试4);response.setContentType(application/vnd.openxmlformats-officedocument.wordprocessingml.document;charsetutf-8);response.setHeader(Content-Disposition, attachment;filename URLEncoder.encode(测试exportByTemplate, utf-8) .docx);//传入模板地址与模板变量进行填充try(XWPFDocument head WordExportUtil.exportWord07(templates/纳税信息.docx,data )){head.write(response.getOutputStream());}}catch (Exception e) {e.printStackTrace();}} }5.3.3 导出效果 浏览器访问 http://ip:port/word/exportByTemplate根据实际情况进行替换导出文件效果如下 注意通过模板导出可以用于订单填充、合同数据填充等应用场景能够较好的保留原格式结合笔者文章 “kkFileView二开之word转pdf接口”可以快速实现合同文件生成的需求 6 总结 工欲善其事必先利其器。在日常工作中需要多了解相关的三方组件以便于在将来遇到类似的需求的时候能够尽快的提出对应的解决方案以展现自己的专业能力。
http://www.hkea.cn/news/14327367/

相关文章:

  • 深圳营销型网站建设多少钱国外h5汇总网站
  • 内蒙古 网站建设甘肃城乡建设局安全质量网站
  • 胶东国际机场建设有限公司网站wordpress让nginx卡死
  • 如何做个盈利的网站福建省武夷山市城乡建设网站
  • 学到什么程度可以做网站深圳四站合一网站建设电话
  • 财政网站平台建设不足国有平台公司是什么意思
  • 弹幕网站开发设置网站404页面
  • 沈阳的网站制作公司哪家好北京轨道交通建设管理有限公司网站
  • 网站ftp密码怎么修改网络营销方式包括哪些
  • 建设局网站策划书网站营销推广有哪些
  • 深圳网站建设公司哪家好北京王府井大街
  • 手机如何制作网站源码网络推广有哪些常见的推广方法
  • 西安网络推广网站优化网站建设与网站开发
  • 河南定制网站建设报价专门做餐厅设计的网站
  • 网站追加备案工人找工作哪个网站好
  • 电商数据分析与数据化运营百度词条优化工作
  • 桥头镇网站建设公司专业网站建设的公司哪家好
  • wordpress 移动端网页广州网站优化地址
  • 做谷歌推广的网站如何引流logo设计网站国外
  • 网站如何加入流量统计医院网站建设系统
  • 局域网建站软件做外贸在哪个网站找客户
  • 荧光字网站wordpress登陆的插件
  • 上海学做网站北京网站网站建设
  • 某网站项目策划书学校网站策划书
  • 网站开发公司面试题seo搜索引擎优化人员
  • 网站都能做响应式seo网站推广经理招聘
  • 建大型网站公司简介软件培训
  • 甘肃做网站找谁html的基本结构
  • 哪个地区网站建设好开发app需要多少钱?
  • 腾讯云网站搭建php 遍历网站