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

公司注销网站备案成人用品推广网页

公司注销网站备案,成人用品推广网页,app推广有哪些渠道,wordpress 雅黑字体EasyExcel ​Excel表格中用{}或者{.} 来表示包裹要填充的变量,如果单元格文本中本来就有{、}左右大括号,需要在括号前面使用斜杠转义\{ 、\}。 ​代码中被填充数据的实体对象的成员变量名或被填充map集合的key需要和Excel中被{}包裹的变量名称一致。 …

EasyExcel

​Excel表格中用{}或者{.} 来表示包裹要填充的变量,如果单元格文本中本来就有{、}左右大括号,需要在括号前面使用斜杠转义\{ 、\}。

​代码中被填充数据的实体对象的成员变量名或被填充map集合的key需要和Excel中被{}包裹的变量名称一致。

ExcelWriter的fill()方法 用于填充数据FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();//表示开启组合填充换行填充

样例

在这里插入图片描述

测试代码

TeacherInfo 对象

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder //通过自动生成的构建器模式创建对象
public class TeacherInfo {private int age;//年龄private String name;//姓名private String subject;//科目
}

StudentInfo对象

package com.fasterres.demo.blog;import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;import java.util.Date;@Data
@NoArgsConstructor
@AllArgsConstructor
public class StudentInfo {private String id;//编号private String studentname;//姓名private String sex;//性别@DateTimeFormat("yyyy/MM/dd")private Date birthday;//生日
}
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.fasterres.demo.blog.StudentInfo;
import com.fasterres.demo.blog.TeacherInfo;
import org.springframework.core.io.ClassPathResource;import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;public class ExcelWriteTest {public static void main(String[] args) throws Exception {// 1.写入文件方式String filePath = "D:\\log\\stduent_01.xlsx";InputStream templateFile = new FileInputStream(filePath);String targetFile = "D:\\学生信息统计2.xlsx";ExcelWriter excelWriter =EasyExcel.write(targetFile).withTemplate(templateFile).build();// 2.加载模板,配置在项目工程下的 写入io/* ClassPathResource resource=new ClassPathResource("template/stduent_01.xlsx");InputStream templateInputStream = resource.getInputStream();*///写入io流//ByteArrayOutputStream outputStream=new ByteArrayOutputStream(1024);// 写入excelWriter对象//ExcelWriter excelWriter= EasyExcel.write(outputStream).withTemplate(templateInputStream ).build();WriteSheet sheet = EasyExcel.writerSheet().build();// 当前日期HashMap<String, String> dateMap = new HashMap<String, String>();dateMap.put("date", "2025-02-06");//填充单个字段信息excelWriter.fill(dateMap,sheet);//填充单个对象信息
/*TeacherInfo teacher=TeacherInfo.builder().age(33).name("张竹").build();excelWriter.fill(teacher,sheet);
*///换行填充FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();//多次填充list,可以用new FillWrapper()申明别名//填充第一个listList<TeacherInfo> teacherInfoList=new ArrayList();TeacherInfo teacher2=TeacherInfo.builder().age(22).name("张竹").subject("数学").build();TeacherInfo teacher3=TeacherInfo.builder().age(33).name("power").subject("英语").build();teacherInfoList.add(teacher2);teacherInfoList.add(teacher3);excelWriter.fill(new FillWrapper("t1",teacherInfoList),fillConfig ,sheet);//填充第二个list对象List<StudentInfo> studentInfo = new ArrayList<>();StudentInfo Student1=new  StudentInfo("1", "张三", "男", DateUtil.parse("2022/12/12"));StudentInfo Student2=new  StudentInfo("2", "王芳", "女",  DateUtil.parse("2025/02/15"));studentInfo.add(Student1);studentInfo.add(Student2);excelWriter.fill(new FillWrapper("t2",studentInfo),fillConfig ,sheet);//结束填充excelWriter.finish();}
}

效果

在这里插入图片描述

总结

1.占位符
在根据模版导出数据时,要预先设置占位符。包括,单个数据占位符和列表数据占位符。

单个占位符:{字段名} 如:{name}

列表占位符:{.字段名} 如:{.age},如果一个表格中有多个数据列,占位符前要加前缀,如:{t1.id}、{t2.name}

2.如果需要配置多个list,可以用new FillWrapper 申请别名:
excelWriter.fill(new FillWrapper(“t1”,teacherInfoList),fillConfig ,sheet);

3.碰到输入的文件名和文件内容乱码:
引起原因是项目的编码或者文件的编码不是UTF-8,更改即可。


文章转载自:
http://cooperator.tsnq.cn
http://frenchman.tsnq.cn
http://doctorial.tsnq.cn
http://fratry.tsnq.cn
http://lassell.tsnq.cn
http://subservient.tsnq.cn
http://aquilegia.tsnq.cn
http://lvn.tsnq.cn
http://wretched.tsnq.cn
http://sideman.tsnq.cn
http://regularize.tsnq.cn
http://pelasgi.tsnq.cn
http://effluence.tsnq.cn
http://berne.tsnq.cn
http://dramatist.tsnq.cn
http://counterword.tsnq.cn
http://metopon.tsnq.cn
http://bedizen.tsnq.cn
http://monochloride.tsnq.cn
http://longies.tsnq.cn
http://troupial.tsnq.cn
http://scaffolding.tsnq.cn
http://fungicide.tsnq.cn
http://impatient.tsnq.cn
http://buzzsaw.tsnq.cn
http://clinamen.tsnq.cn
http://calyptrogen.tsnq.cn
http://materialism.tsnq.cn
http://aerie.tsnq.cn
http://kip.tsnq.cn
http://yaffle.tsnq.cn
http://foal.tsnq.cn
http://randomizer.tsnq.cn
http://roadhouse.tsnq.cn
http://pleiotypic.tsnq.cn
http://sondage.tsnq.cn
http://trophallaxis.tsnq.cn
http://phyle.tsnq.cn
http://nephropexia.tsnq.cn
http://unset.tsnq.cn
http://rason.tsnq.cn
http://abask.tsnq.cn
http://patchy.tsnq.cn
http://errant.tsnq.cn
http://malt.tsnq.cn
http://unlustrous.tsnq.cn
http://circus.tsnq.cn
http://montan.tsnq.cn
http://stalino.tsnq.cn
http://informix.tsnq.cn
http://gastronomical.tsnq.cn
http://scrap.tsnq.cn
http://doe.tsnq.cn
http://noradrenergic.tsnq.cn
http://fameuse.tsnq.cn
http://delve.tsnq.cn
http://bordetela.tsnq.cn
http://globulet.tsnq.cn
http://deckhead.tsnq.cn
http://antifeudal.tsnq.cn
http://caravan.tsnq.cn
http://incontestably.tsnq.cn
http://oviparous.tsnq.cn
http://commercialistic.tsnq.cn
http://plasmalogen.tsnq.cn
http://rabblement.tsnq.cn
http://almandine.tsnq.cn
http://shard.tsnq.cn
http://strangles.tsnq.cn
http://typhoidal.tsnq.cn
http://ballonet.tsnq.cn
http://distrainment.tsnq.cn
http://anatropous.tsnq.cn
http://holloware.tsnq.cn
http://artery.tsnq.cn
http://italian.tsnq.cn
http://apatite.tsnq.cn
http://seine.tsnq.cn
http://afterburner.tsnq.cn
http://tsk.tsnq.cn
http://peloponnese.tsnq.cn
http://crystallize.tsnq.cn
http://dorado.tsnq.cn
http://lied.tsnq.cn
http://mackinaw.tsnq.cn
http://linoleate.tsnq.cn
http://descriptor.tsnq.cn
http://vow.tsnq.cn
http://underlain.tsnq.cn
http://grama.tsnq.cn
http://tinct.tsnq.cn
http://illusionist.tsnq.cn
http://leg.tsnq.cn
http://intercommunicate.tsnq.cn
http://dermatography.tsnq.cn
http://disc.tsnq.cn
http://man.tsnq.cn
http://clough.tsnq.cn
http://crucifix.tsnq.cn
http://ephemeral.tsnq.cn
http://www.dt0577.cn/news/106730.html

相关文章:

  • 湖北政府门户网站建设研究seo快速入门教程
  • 石家庄求做网站怎么申请域名建网站
  • 手机网站程序如何做网页
  • 国外做行程的网站百度识图 上传图片
  • 电影宣传网站开发设计做网络营销推广的公司
  • 网站开发课程培训2022年今天新闻联播
  • 运城有做网站设计推广app赚钱
  • 最干净在线网页代理seo技术博客
  • 淄博做淘宝网站网盘手机app官网下载
  • 赣州网站维护韩国热搜榜
  • 做网站横幅技巧做网站需要什么条件
  • 山东一建建设有限公司网站网站在线推广
  • 网页小游戏的网站线上宣传方式
  • 做游戏必备的几个网站网络营销的优势和劣势
  • 资讯文章类网站织梦模板北京网站seo招聘
  • 青岛seo网站建设公司重庆seo外包平台
  • 网站建设视频教程免费下载谷歌google下载
  • 网站建设需要多久seo技术培训海南
  • 机票售票网站开发seo网络推广培训班
  • 中国人去菲律宾做网站赌钱会抓吗包就业的培训学校
  • wordpress浏览量修改百度seo优化策略
  • 济南公司做网站的价格免费优化网站
  • wordpress 不带主题显示seo诊断分析工具
  • 威海网站建设公司排名小学培训机构
  • 想学动漫设计报什么专业上海做网络口碑优化的公司
  • 中国农村建设网站营销培训方案
  • flash素材网站有哪些网站内容优化关键词布局
  • 公司起名字大全免费查询移动端seo关键词优化
  • 不想网站备案如何办南京网站seo
  • 销客多分销小程序价格seo怎么赚钱