mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-03 12:18:01 +08:00
!1002 添加writeCellValue的重载,以支持isHeader
Merge pull request !1002 from hower/v5-dev
This commit is contained in:
commit
6b824e2a86
@ -889,7 +889,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
public ExcelWriter writeImg(File imgFile, int imgType, int dx1, int dy1, int dx2,
|
public ExcelWriter writeImg(File imgFile, int imgType, int dx1, int dy1, int dx2,
|
||||||
int dy2, int col1, int row1, int col2, int row2) {
|
int dy2, int col1, int row1, int col2, int row2) {
|
||||||
return writeImg(FileUtil.readBytes(imgFile), imgType, dx1,
|
return writeImg(FileUtil.readBytes(imgFile), imgType, dx1,
|
||||||
dy1, dx2, dy2, col1, row1, col2, row2);
|
dy1, dx2, dy2, col1, row1, col2, row2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1097,7 +1097,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给指定单元格赋值,使用默认单元格样式
|
* 给指定单元格赋值,使用默认单元格样式,默认不是Header
|
||||||
*
|
*
|
||||||
* @param locationRef 单元格地址标识符,例如A11,B5
|
* @param locationRef 单元格地址标识符,例如A11,B5
|
||||||
* @param value 值
|
* @param value 值
|
||||||
@ -1105,13 +1105,26 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
* @since 5.1.4
|
* @since 5.1.4
|
||||||
*/
|
*/
|
||||||
public ExcelWriter writeCellValue(String locationRef, Object value) {
|
public ExcelWriter writeCellValue(String locationRef, Object value) {
|
||||||
final CellLocation cellLocation = ExcelUtil.toLocation(locationRef);
|
return writeCellValue(locationRef, value, false);
|
||||||
return writeCellValue(cellLocation.getX(), cellLocation.getY(), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给指定单元格赋值,使用默认单元格样式
|
* 给指定单元格赋值,使用默认单元格样式
|
||||||
*
|
*
|
||||||
|
* @param locationRef 单元格地址标识符,例如A11,B5
|
||||||
|
* @param value 值
|
||||||
|
* @param isHeader 是否为Header
|
||||||
|
* @return this
|
||||||
|
* @since 5.1.4
|
||||||
|
*/
|
||||||
|
public ExcelWriter writeCellValue(String locationRef, Object value, boolean isHeader) {
|
||||||
|
final CellLocation cellLocation = ExcelUtil.toLocation(locationRef);
|
||||||
|
return writeCellValue(cellLocation.getX(), cellLocation.getY(), value, isHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给指定单元格赋值,使用默认单元格样式,默认不是Header
|
||||||
|
*
|
||||||
* @param x X坐标,从0计数,即列号
|
* @param x X坐标,从0计数,即列号
|
||||||
* @param y Y坐标,从0计数,即行号
|
* @param y Y坐标,从0计数,即行号
|
||||||
* @param value 值
|
* @param value 值
|
||||||
@ -1119,8 +1132,22 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
* @since 4.0.2
|
* @since 4.0.2
|
||||||
*/
|
*/
|
||||||
public ExcelWriter writeCellValue(int x, int y, Object value) {
|
public ExcelWriter writeCellValue(int x, int y, Object value) {
|
||||||
|
return writeCellValue(x, y, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给指定单元格赋值,使用默认单元格样式
|
||||||
|
*
|
||||||
|
* @param x X坐标,从0计数,即列号
|
||||||
|
* @param y Y坐标,从0计数,即行号
|
||||||
|
* @param isHeader 是否为Header
|
||||||
|
* @param value 值
|
||||||
|
* @return this
|
||||||
|
* @since 4.0.2
|
||||||
|
*/
|
||||||
|
public ExcelWriter writeCellValue(int x, int y, Object value, boolean isHeader) {
|
||||||
final Cell cell = getOrCreateCell(x, y);
|
final Cell cell = getOrCreateCell(x, y);
|
||||||
CellUtil.setCellValue(cell, value, this.styleSet, false);
|
CellUtil.setCellValue(cell, value, this.styleSet, isHeader);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user