mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
ExcelWriter.autoSizeColumn增加可选widthRatio参数,可配置中文字符宽度倍数
This commit is contained in:
parent
0aaa9019ad
commit
a05fb1a000
@ -16,6 +16,7 @@
|
|||||||
* 【core 】 优化IndexedComparator性能(pr#1240@Gitee)
|
* 【core 】 优化IndexedComparator性能(pr#1240@Gitee)
|
||||||
* 【http 】 改进ContentType.get忽略空格(pr#3664@Github)
|
* 【http 】 改进ContentType.get忽略空格(pr#3664@Github)
|
||||||
* 【http 】 CompressUtil.createExtractor支持tgz自动识别(pr#3674@Github)
|
* 【http 】 CompressUtil.createExtractor支持tgz自动识别(pr#3674@Github)
|
||||||
|
* 【poi 】 ExcelWriter.autoSizeColumn增加可选widthRatio参数,可配置中文字符宽度倍数(pr#3689@Github)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复因RFC3986理解有误导致的UrlPath处理冒号转义问题(issue#IAAE88@Gitee)
|
* 【core 】 修复因RFC3986理解有误导致的UrlPath处理冒号转义问题(issue#IAAE88@Gitee)
|
||||||
|
@ -152,11 +152,7 @@ public class BigExcelWriter extends ExcelWriter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigExcelWriter autoSizeColumnAll() {
|
public BigExcelWriter autoSizeColumnAll() {
|
||||||
final SXSSFSheet sheet = (SXSSFSheet) this.sheet;
|
return autoSizeColumnAll(0);
|
||||||
sheet.trackAllColumnsForAutoSizing();
|
|
||||||
super.autoSizeColumnAll();
|
|
||||||
sheet.untrackAllColumnsForAutoSizing();
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -305,9 +305,10 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
* @since 5.8.30
|
* @since 5.8.30
|
||||||
*/
|
*/
|
||||||
public ExcelWriter autoSizeColumn(int columnIndex, boolean useMergedCells, float widthRatio) {
|
public ExcelWriter autoSizeColumn(int columnIndex, boolean useMergedCells, float widthRatio) {
|
||||||
sheet.autoSizeColumn(columnIndex, useMergedCells);
|
|
||||||
if (widthRatio > 0) {
|
if (widthRatio > 0) {
|
||||||
sheet.setColumnWidth(columnIndex, (int) (sheet.getColumnWidth(columnIndex) * widthRatio));
|
sheet.setColumnWidth(columnIndex, (int) (sheet.getColumnWidth(columnIndex) * widthRatio));
|
||||||
|
} else {
|
||||||
|
sheet.autoSizeColumn(columnIndex, useMergedCells);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user