欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java导出合并单元格excel

程序员文章站 2022-06-14 09:07:54
...
package com.excel.demo.vo;

import com.alibaba.excel.annotation.ExcelProperty;

/**
 * @author :Hj
 * @date 2021/2/25
 */
public class StudentVo {
    @ExcelProperty(value = "编号")
    private long id;
    @ExcelProperty(value = "姓名")
    private String name;
    @ExcelProperty({"年度"})
    private String year;
    @ExcelProperty({"分数统计", "数学"})
    private int math ;
    @ExcelProperty({"分数统计", "英语"})
    private int english;
    @ExcelProperty({"分数统计", "语文"})
    private int  chinese;
    @ExcelProperty({"总计"})
    private int sum;


    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMath() {
        return math;
    }

    public void setMath(int math) {
        this.math = math;
    }

    public int getEnglish() {
        return english;
    }

    public void setEnglish(int english) {
        this.english = english;
    }

    public int getChinese() {
        return chinese;
    }

    public void setChinese(int chinese) {
        this.chinese = chinese;
    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

}
  EasyExcel.write(filename,StudentVo.class).sheet("数据").doWrite(studentVos);

java导出合并单元格excel