easyexcel中的常用注解

@ExcelProperty

@ColumnWith 列宽

@ContentFontStyle 文本字体样式

@ContentLoopMerge 文本合并

@ContentRowHeight 文本行高度

@ContentStyle 文本样式

@HeadFontStyle 标题字体样式

@HeadRowHeight 标题高度

@HeadStyle 标题样式

@ExcelIgnore 忽略项

@ExcelIgnoreUnannotated 忽略未注解

字段注解    类注解
@ColumnWith(列宽)    @ColumnWidth(全局列宽)
@ExcelProperty(字段配置)    @HeadFontStyle(头样式)
@HeadRowHeight(标题高度)
@ContentFontStyle(内容字体样式)
@ContentRowHeight(内容高度)
@ExcelProperty
必要的一个注解,注解中有三个参数value,index分别代表列明,列序号
value和index只能二选一,通常不用设置converter
1.value 通过标题文本对应
2.index 通过文本行号对应

@ExcelProperty(value = "人员姓名",index = 1)
    private String comparisonName;
1
2
@ColumnWith
设置列宽度,只有一个参数value,value的单位是字符长度,最大可以设置255个字符,因为一个excel单元格最大可以写入的字符个数就是255个字符

public class ImeiEncrypt {
    @ColumnWidth(value = 18)
    private String imei;
}
1
2
3
4
@ContentFontStyle
用于设置单元格内容字体格式的注解

参数    含义
fontName    字体名称
fontHeightInPoints    字体高度
italic    是否斜体
strikeout    是否设置删除水平线
color    字体颜色
typeOffset    偏移量
underline    下划线
bold    是否加粗
charset    编码格式
@ContentStyle
设置内容格式注解

参数    含义
dataFormat    日期格式
hidden    设置单元格使用此样式隐藏
locked    设置单元格使用此样式锁定
quotePrefix    在单元格前面增加`符号,数字或公式将以字符串形式展示
horizontalAlignment    设置是否水平居中
wrapped    设置文本是否应换行。将此标志设置为true通过在多行上显示使单元格中的所有内容可见
verticalAlignment    设置是否垂直居中
rotation    设置单元格中文本旋转角度。03版本的Excel旋转角度区间为-90°90°,07版本的Excel旋转角度区间为0°180°
indent    设置单元格中缩进文本的空格数
borderLeft    设置左边框的样式
borderRight    设置右边框样式
borderTop    设置上边框样式
borderBottom    设置下边框样式
leftBorderColor    设置左边框颜色
rightBorderColor    设置右边框颜色
topBorderColor    设置上边框颜色
bottomBorderColor    设置下边框颜色
fillPatternType    设置填充类型
fillBackgroundColor    设置背景色
fillForegroundColor    设置前景色
shrinkToFit    设置自动单元格自动大小
@HeadFontStyle
用于定制标题字体格式

参数    含义
fontName    设置字体名称
fontHeightInPoints    设置字体高度
italic    设置字体是否斜体
strikeout    是否设置删除线
color    设置字体颜色
typeOffset    设置偏移量
underline    设置下划线
charset    设置字体编码
bold    设置字体是否加粗
@ExcelIgnore
不将该字段转换成Excel
————————————————
版权声明:本文为CSDN博主「哈斗」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_45151960/article/details/109095332

  • 2
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值