mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add methods
This commit is contained in:
parent
235d32043e
commit
c984f3555f
@ -9,8 +9,9 @@
|
||||
* 【http 】 HttpUtil增加closeCookie方法
|
||||
* 【core 】 NumberUtil增加方法decimalFormat重载(issue#I3OSA2@Gitee)
|
||||
* 【extra 】 Ftp的remoteVerificationEnabled改为false(issue#I3OSA2@Gitee)
|
||||
* 【core 】 MaskBit增加掩码反向转换的方法getMaskBit()(pr#1563@Github)
|
||||
* 【core 】 ReUtil等增加indexOf、delLast等方法(pr#1555@Github)
|
||||
* 【core 】 MaskBit增加掩码反向转换的方法getMaskBit()(pr#1563@Github)
|
||||
* 【core 】 ReUtil等增加indexOf、delLast等方法(pr#1555@Github)
|
||||
* 【poi 】 ExcelWriter增加writeSecHeadRow,增加合并单元格边框颜色样式(pr#318@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复createScheduledExecutor单位不是毫秒的问题(issue#I3OYIW@Gitee)
|
||||
|
@ -722,14 +722,8 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
if (null != this.styleSet) {
|
||||
style = (isSetHeaderStyle && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle;
|
||||
}
|
||||
CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style);
|
||||
|
||||
// 设置内容
|
||||
if (null != content) {
|
||||
final Cell cell = getOrCreateCell(firstColumn, firstRow);
|
||||
CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle);
|
||||
}
|
||||
return this;
|
||||
return merge(firstRow, lastRow, firstColumn, lastColumn, content, style);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -743,6 +737,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
* @param content 合并单元格后的内容
|
||||
* @param cellStyle 合并后单元格使用的样式,可以为null
|
||||
* @return this
|
||||
* @since 5.6.5
|
||||
*/
|
||||
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, CellStyle cellStyle) {
|
||||
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
|
||||
@ -877,6 +872,10 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
* 写出的起始行为当前行号,可使用{@link #getCurrentRow()}方法调用,根据写出的的行数,当前行号自动+1<br>
|
||||
* 样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式
|
||||
*
|
||||
* <p>
|
||||
* 此方法的逻辑是:将一行数据写出到当前行,遇到已存在的单元格跳过,不存在的创建并赋值。
|
||||
* </p>
|
||||
*
|
||||
* @param rowData 一行的数据
|
||||
* @return this
|
||||
*/
|
||||
|
@ -4,18 +4,19 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.style.StyleUtil;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@ -553,13 +554,15 @@ public class ExcelWriteTest {
|
||||
|
||||
// 合并单元格后的标题行,使用设置好的样式
|
||||
writer.merge(0,1,0,row1.size() - 1, "标题XXXXXXXX",cellStyle);
|
||||
System.out.println(writer.getCurrentRow());
|
||||
Console.log(writer.getCurrentRow());
|
||||
|
||||
//设置复杂表头
|
||||
writer.merge(2,3,0,0,"序号",true);
|
||||
writer.merge(2,2,1,2,"AABB",true);
|
||||
writer.merge(2,3,3,3,"CCCC",true);
|
||||
writer.merge(2,2,4,5,"DDEE",true);
|
||||
writer.setCurrentRow(3);
|
||||
|
||||
List<String> sechead = CollUtil.newArrayList("AA","BB","DD","EE");
|
||||
writer.writeSecHeadRow(sechead);
|
||||
// 一次性写出内容,使用默认样式
|
||||
|
Loading…
x
Reference in New Issue
Block a user