当前位置:网站首页>EasyExcel-排除展示字段-02
EasyExcel-排除展示字段-02
2022-06-21 06:51:00 【敏姐儿】
测试实体类
package entry;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/** * Created by jdx on 2022/6/17 上午12:10 */
/*相当于实体类中的get set方法*/
@Data
/*相当于有参构造*/
@AllArgsConstructor
/*相当于无参构造*/
@NoArgsConstructor
public class Student {
/*@ExcelProperty * 1、详相当于表头定义 * 2、实体别名 * */
@ExcelProperty("姓名")
private String name;
@ExcelProperty("入学时间")
private String admissionATime;
@ExcelProperty("性别")
private Boolean sex;
@ExcelProperty("联系方式")
private String contactDetails;
@ExcelProperty("班级")
private String className;
@ExcelProperty("成绩")
private String score;
@ExcelProperty("邮箱")
private String e_mail;
}
测试实例
public void Test03() {
/*新建一个存放输出流对象的list*/
ArrayList<Student> students = new ArrayList<Student>();
/*新建一个Student对象*/
Student student01 = new Student("宫本武藏", "2016-03", true, "12345678911", "九年级十一班", "A", "[email protected]");
Student student02 = new Student("娜可露露", "2016-03", false, "12345678912", "九年级十一班", "A", "[email protected]");
Student student03 = new Student("不知火舞", "2016-03", false, "12345678913", "九年级十一班", "A", "[email protected]");
Student student04 = new Student("橘右京", "2016-03", true, "12345678914", "九年级十一班", "A", "[email protected]");
Student student05 = new Student("孙悟空", "2016-03", true, "12345678915", "九年级十一班", "A", "[email protected]");
Student student06 = new Student("三藏法师", "2016-03", true, "12345678916", "九年级十一班", "A", "[email protected]");
Student student07 = new Student("猪八戒", "2016-03", true, "12345678917", "九年级十一班", "A", "[email protected]");
Student student08 = new Student("耀", "2016-03", true, "12345678918", "九年级十一班", "A", "[email protected]");
Student student09 = new Student("李逍遥", "2016-03", true, "12345678919", "九年级十一班", "A", "[email protected]");
Student student10 = new Student("赵琳儿", "2016-03", false, "12345678910", "九年级十一班", "A", "[email protected]");
Student student11 = new Student("李白a", "2016-03", true, "12345678922", "九年级十一班", "A", "[email protected]");
/*添加数据*/
students.add(student01);
students.add(student02);
students.add(student03);
students.add(student04);
students.add(student05);
students.add(student06);
students.add(student07);
students.add(student08);
students.add(student09);
students.add(student10);
students.add(student11);
/*指定输出对象*/
HashSet<String> hashSet = new HashSet<String>();
hashSet.add("className");
hashSet.add("score");
/*excludeColumnFiledNames --> 输出指定字段*/
EasyExcel.write("筛选花名册.xlsx",Student.class).excludeColumnFiledNames(hashSet).sheet("筛选花名册").doWrite(students);
}
测试结果对比

边栏推荐
- Old users come back and have a look
- Work
- Configuring the eigen3 development environment for vs2017 on win10
- The database has the problem of user changing password
- x86 CPU访问DRAM和PCI
- 520 bubble source code
- 152-Solana入门(十六)- 创建MetaplexNFT
- 153-Solana创建PDA和存储
- Pyg tutorial (6): customizing the messaging network
- flutter jpush
猜你喜欢

Understand this point

win10上vs2017配置Eigen3开发环境

156-Rust和Solana环境配置

Pyg tutorial (3): neighbor sampling

Weather forecast applet source code / weather wechat applet source code

IDM mobile terminal function upgrade description

Modbus Poll v9.9.2 Build 1690 Modbus测试工具单文件版

动态规划习题(二)

Filtre Bloom

Two column set (map set)
随机推荐
建设数字化工厂的四个必要步骤
2022 运维故障案例经验
C language program design - Sanzi chess (semester homework)
Hamming code verification [simple and detailed]
【基于栈的二叉树中序遍历】二叉树的中序遍历+栈,O(h)的空间复杂度
Microphone loading animation
[GNN] Application of GNN neural network toolbox and MATLAB simulation
數據分析之:不同行業的常見指標
天气预报小程序源码/天气类微信小程序源码
使用cell ranger进行单细胞转录组定量分析
基于Flexsim的供应链建模与仿真课程设计
156 rust and Solana environment configuration
Pyg tutorial (2): graph data
Argo CD usage
微信小程序_5,全局配置
C skill tree evaluation
Lnc2meth: methylation sites on disease-related lncrna
使用Loupe Cell Browser查看10X单细胞转录组分析结果
Matplotlib subgraph beautification
Required Integer parameter ‘XXX‘ is not present