mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add setRowStyle
This commit is contained in:
parent
97d48dde0b
commit
3237df0855
@ -18,6 +18,7 @@
|
||||
* 【core 】 完善注释(pr#193@Gitee)
|
||||
* 【core 】 优化Combination.countAll(pr#1159@Github)
|
||||
* 【core 】 优化针对list的split方法(pr#194@Gitee)
|
||||
* 【poi 】 ExcelWriter增加setRowStyle方法
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 解决农历判断节日未判断大小月导致的问题(issue#I1XHSF@Gitee)
|
||||
|
@ -55,22 +55,37 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
|
||||
/** 目标文件 */
|
||||
/**
|
||||
* 目标文件
|
||||
*/
|
||||
protected File destFile;
|
||||
/** 当前行 */
|
||||
/**
|
||||
* 当前行
|
||||
*/
|
||||
private AtomicInteger currentRow = new AtomicInteger(0);
|
||||
/** 标题行别名 */
|
||||
/**
|
||||
* 标题行别名
|
||||
*/
|
||||
private Map<String, String> headerAlias;
|
||||
/** 是否只保留别名对应的字段 */
|
||||
/**
|
||||
* 是否只保留别名对应的字段
|
||||
*/
|
||||
private boolean onlyAlias;
|
||||
/** 标题顺序比较器 */
|
||||
/**
|
||||
* 标题顺序比较器
|
||||
*/
|
||||
private Comparator<String> aliasComparator;
|
||||
/** 样式集,定义不同类型数据样式 */
|
||||
/**
|
||||
* 样式集,定义不同类型数据样式
|
||||
*/
|
||||
private StyleSet styleSet;
|
||||
/** 标题项对应列号缓存,每次写标题更新此缓存 */
|
||||
/**
|
||||
* 标题项对应列号缓存,每次写标题更新此缓存
|
||||
*/
|
||||
private Map<String, Integer> headLocationCache;
|
||||
|
||||
// -------------------------------------------------------------------------- Constructor start
|
||||
|
||||
/**
|
||||
* 构造,默认生成xls格式的Excel文件<br>
|
||||
* 此构造不传入写出的Excel文件路径,只能调用{@link #flush(OutputStream)}方法写出到流<br>
|
||||
@ -995,6 +1010,20 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置行样式
|
||||
*
|
||||
* @param y Y坐标,从0计数,即行号
|
||||
* @param style 样式
|
||||
* @return this
|
||||
* @see Row#setRowStyle(CellStyle)
|
||||
* @since 5.4.5
|
||||
*/
|
||||
public ExcelWriter setRowStyle(int y, CellStyle style) {
|
||||
getOrCreateRow(y).setRowStyle(style);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建字体
|
||||
*
|
||||
@ -1090,6 +1119,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------- Private method start
|
||||
|
||||
/**
|
||||
* 为指定的key列表添加标题别名,如果没有定义key的别名,在onlyAlias为false时使用原key
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user