简体   繁体   English

NPOI。 打开时扩展Excel文件的宽度

[英]NPOI. Expand width of excel file when it opens

Could you explain me, I make excel file from datatable using npoi. 您能解释一下吗,我使用npoi从datatable中制作了excel文件。 Could I expand columns when file opens to header content lengths. 当文件打开到标题内容长度时,我可以展开列吗?

 using (FileStream fs = System.IO.File.Create(FileName))
        {
            workbook.Write(fs);
 }

please try AutoSizeColumn to set Autosize to all columns. 请尝试使用AutoSizeColumn将“ 自动调整大小”设置为所有列。

mySheet.AutoSizeColumn(columnIndex)

please check 请检查

“AutoSize” to Excel sheet column? “自动调整大小”到Excel工作表列? (NPOI) (NPOI)

and

'autosize' in Excel documents created with NPOI? 使用NPOI创建的Excel文档中的“自动调整大小”?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM