NPOI导出列宽最适应报错,超出255
来源:互联网 发布:物流软件大全 编辑:程序博客网 时间:2024/06/05 08:00
for (int colNum = 0; colNum <= 10; colNum++)
{
int columnWidth = sheet.GetColumnWidth(colNum) / 256;
for (int rowNum = 0; rowNum < sheet.LastRowNum; rowNum++)
{
IRow currentRow = sheet.GetRow(rowNum);
ICell currentCell = currentRow.GetCell(colNum);
if (currentCell != null)
{
int length = Encoding.UTF8.GetBytes(currentCell.ToString()).Length;
if (columnWidth < length + 1)
{
columnWidth = length + 1 > 254 ? 255 : length + 1;
}
currentRow.HeightInPoints = 20;
}
}
sheet.SetColumnWidth(colNum, columnWidth * 256);
}
{
int columnWidth = sheet.GetColumnWidth(colNum) / 256;
for (int rowNum = 0; rowNum < sheet.LastRowNum; rowNum++)
{
IRow currentRow = sheet.GetRow(rowNum);
ICell currentCell = currentRow.GetCell(colNum);
if (currentCell != null)
{
int length = Encoding.UTF8.GetBytes(currentCell.ToString()).Length;
if (columnWidth < length + 1)
{
columnWidth = length + 1 > 254 ? 255 : length + 1;
}
currentRow.HeightInPoints = 20;
}
}
sheet.SetColumnWidth(colNum, columnWidth * 256);
}
阅读全文
0 0
- NPOI导出列宽最适应报错,超出255
- NPOI导出Excel - 自动适应中文宽度
- NPOI导出Excel - 自动适应中文宽度(帮助类下载)
- NPOI导出Excel
- 利用npoi导出excel
- NPOI导出Excel
- 使用NPOI导入导出
- NPOI Excel导入导出
- 使用Npoi 导入导出
- 使用NPOI导出EXCEL
- NPOI导出excel
- 利用npoi导出excel
- NPOI导出Excel功能
- npoi导出到EXCEL
- NPOI导出Excel2007
- NPOI导出Excel
- Npoi导出word(Peanuts)
- NPOI导出问题
- FAT32文件系统小结
- openstack【Kilo】入门 【准备篇】二:NTP安装
- NOIP2017普及组复赛T2
- tcpdump 命令详解
- Caffe的Layer,Net,Solver概念--mnist例子
- NPOI导出列宽最适应报错,超出255
- 复选框全选和反选 还有批量删除
- Redis集群搭建
- sdnu1467.杨辉三角形
- C语言操作符
- 各类链接
- 入门80x86汇编
- 正则表达式
- 数据结构与算法分析(Java语言描述)(20)—— 二叉搜索树指定key的前驱、后继