mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add setFreezePane
This commit is contained in:
parent
3eaf4702f5
commit
2783f17472
@ -48,6 +48,17 @@ public final class JSONUtil {
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建JSONObject
|
||||
*
|
||||
* @param config JSON配置
|
||||
* @return JSONObject
|
||||
* @since 5.2.5
|
||||
*/
|
||||
public static JSONObject createObj(JSONConfig config) {
|
||||
return new JSONObject(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 JSONArray
|
||||
*
|
||||
@ -57,6 +68,17 @@ public final class JSONUtil {
|
||||
return new JSONArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 JSONArray
|
||||
*
|
||||
* @param config JSON配置
|
||||
* @return JSONArray
|
||||
* @since 5.2.5
|
||||
*/
|
||||
public static JSONArray createArray(JSONConfig config) {
|
||||
return new JSONArray(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON字符串转JSONObject对象
|
||||
*
|
||||
|
@ -470,6 +470,30 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置窗口冻结,之前冻结的窗口会被覆盖,如果rowSplit为0表示取消冻结
|
||||
*
|
||||
* @param rowSplit 冻结的行及行数,2表示前两行
|
||||
* @return this
|
||||
* @since 5.2.5
|
||||
*/
|
||||
public ExcelWriter setFreezePane(int rowSplit){
|
||||
return setFreezePane(0, rowSplit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置窗口冻结,之前冻结的窗口会被覆盖,如果colSplit和rowSplit为0表示取消冻结
|
||||
*
|
||||
* @param colSplit 冻结的列及列数,2表示前两列
|
||||
* @param rowSplit 冻结的行及行数,2表示前两行
|
||||
* @return this
|
||||
* @since 5.2.5
|
||||
*/
|
||||
public ExcelWriter setFreezePane(int colSplit, int rowSplit){
|
||||
getSheet().createFreezePane(colSplit, rowSplit);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置列宽(单位为一个字符的宽度,例如传入width为10,表示10个字符的宽度)
|
||||
*
|
||||
|
@ -90,6 +90,8 @@ public class ExcelWriteTest {
|
||||
// 一次性写出内容,使用默认样式
|
||||
writer.write(rows);
|
||||
writer.autoSizeColumn(0, true);
|
||||
//冻结前两行
|
||||
writer.setFreezePane(0, 2);
|
||||
// 关闭writer,释放内存
|
||||
writer.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user