mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
modify method name,update desc
This commit is contained in:
parent
f428120890
commit
5267a02467
@ -1092,7 +1092,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对数据行整行加自定义样式 write后调用
|
||||
* 对数据行整行加自定义样式 仅对数据单元格设置 write后调用
|
||||
*
|
||||
* {@link cn.hutool.poi.excel.ExcelWriter#setRowStyle(int, org.apache.poi.ss.usermodel.CellStyle)}
|
||||
* 这个方法加的样式会使整行没有数据的单元格也有样式
|
||||
@ -1127,7 +1127,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置整个列的样式 write后调用
|
||||
* 设置整个列的样式 仅对数据单元格设置 write后调用
|
||||
*
|
||||
* {@link cn.hutool.poi.excel.ExcelWriter#setColumnStyle(int, org.apache.poi.ss.usermodel.CellStyle)}
|
||||
* 这个方法加的样式会使整列没有数据的单元格也有样式
|
||||
@ -1138,7 +1138,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
* @return
|
||||
* @since
|
||||
*/
|
||||
public ExcelWriter setColumnStyleIfColumnDate(int x,int y, CellStyle style) {
|
||||
public ExcelWriter setColumnStyleIfColumnData(int x,int y, CellStyle style) {
|
||||
if(x < 0) {
|
||||
throw new IllegalArgumentException("Invalid column number (" + x + ")");
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import java.util.TreeMap;
|
||||
*/
|
||||
public class ExcelWriteTest {
|
||||
@Test
|
||||
@Ignore
|
||||
// @Ignore
|
||||
public void testRowOrColumnCellStyle(){
|
||||
List<?> row1 = CollUtil.newArrayList("aaaaa", "bb", "cc", "dd", DateUtil.date(), 3.22676575765);
|
||||
List<?> row2 = CollUtil.newArrayList("aa1", "bb1", "cc1", "dd1", DateUtil.date(), 250.7676);
|
||||
@ -60,10 +60,15 @@ public class ExcelWriteTest {
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
//原设置行、列样式的方法
|
||||
// overtimeWriter.setRowStyle(2,cellStyle);
|
||||
// overtimeWriter.setColumnStyle(1,cellStyle);
|
||||
|
||||
//现增加的设置行、列样式的方法
|
||||
//给第三行加背景色
|
||||
overtimeWriter.setRowStyleIfRowData(2,cellStyle);
|
||||
//给第二列加背景色 从第一行开始加(用于控制有表头时)
|
||||
overtimeWriter.setColumnStyleIfColumnDate(1,0,cellStyle);
|
||||
overtimeWriter.setColumnStyleIfColumnData(1,0,cellStyle);
|
||||
|
||||
CellStyle cellStyle1 = overtimeWriter.getWorkbook().createCellStyle();
|
||||
StyleUtil.setBorder(cellStyle1, BorderStyle.THIN, IndexedColors.BLACK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user