easyexcel常见注解

easyexcel常见注解

一、依赖

 <!--阿里巴巴EasyExcel依赖-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>easyexcel</artifactId>
        <version>2.2.10</version>
    </dependency>

二、常见注解
@ExcelProperty
注解中有三个参数value,index,converter分别代表列明,列序号,数据转换方式

public class ExportModel {
   
    @ExcelProperty({
   "制造商"})
    private String manufacturer;

    @ExcelProperty({
   "型号"})
    private String model;
}

@ColumnWith(设置列宽)
设置列宽度的注解,注解中只有一个参数value,value的单位是字符长度,最大可以设置255个字符

public class ExportModel {
   
    @ColumnWidth(30)
    private String manufacturer;

    @ColumnWidth(30)
    private String model;
}

@ContentFontStyle(字体样式)
用于设置单元格内容字体格式的注解
在这里插入图片描述
@ContentLoopMerge(合并单元格)
设置合并单元格的注解
在这里插入图片描述
@ContentRowHeight(设置行高)
在这里插入图片描述
@ContentStyle(设置内容格式)
在这里插入图片描述
@HeadRowHeight(设置标题行行高)
在这里插入图片描述
@HeadStyle(设置标题样式)
在这里插入图片描述

  @HeadStyle(fillForegroundColor = 40)
  @ExcelProperty({
   "基础属性", "制造商(可输入数字0-9字母a-zA-Z,下划线_-以及汉字,最大长字符64位)(必填)"})
    private String manufacturer;

这里的fillForegroundColor = 40指的是SKY_BLUE

@ExcelIgnore
不将该字段转换成Excel

@ExcelIgnoreUnannotated
没有注解的字段都不转换

相关推荐

  1. springboot常见注解

    2023-12-20 10:40:01       62 阅读
  2. Spring boot 常见注解

    2023-12-20 10:40:01       50 阅读
  3. Spring常见注解

    2023-12-20 10:40:01       34 阅读
  4. SpringBoot常见注解

    2023-12-20 10:40:01       25 阅读
  5. Spring之常见注解

    2023-12-20 10:40:01       25 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-20 10:40:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-20 10:40:01       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-20 10:40:01       87 阅读
  4. Python语言-面向对象

    2023-12-20 10:40:01       96 阅读

热门阅读

  1. LINUX面试题4

    2023-12-20 10:40:01       53 阅读
  2. 173. Binary Search Tree Iterator

    2023-12-20 10:40:01       70 阅读
  3. ax650使用ax-pipeline进行推理

    2023-12-20 10:40:01       69 阅读
  4. #HarmonyOS:@ohos.promptAction (弹窗)---onProgressChange

    2023-12-20 10:40:01       53 阅读
  5. Collections.reverse对list进行反转

    2023-12-20 10:40:01       56 阅读
  6. Django忘记后台管理员密码怎么办

    2023-12-20 10:40:01       60 阅读