easyexcel中的常用注解
生活随笔
收集整理的這篇文章主要介紹了
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 通過文本行號對應
@ColumnWith
設置列寬度,只有一個參數value,value的單位是字符長度,最大可以設置255個字符,因為一個excel單元格最大可以寫入的字符個數就是255個字符
public class ImeiEncrypt {@ColumnWidth(value = 18)private String imei; }@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
總結
以上是生活随笔為你收集整理的easyexcel中的常用注解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用Git命令时出现fatal: thi
- 下一篇: Java中读取本地图片并转为base64