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