NPOI 导出excel时,使用AutoSizeColumn报如下错误:
System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at System.Drawing.Bitmap..ctor(Int32 width, Int32 height) at NPOI.SS.Util.SheetUtil.GetCellWidth(ICell cell, Int32 defaultCharWidth, DataFormatter formatter, Boolean useMergedCells) at NPOI.SS.Util.SheetUtil.GetColumnWidth(ISheet sheet, Int32 column, Boolean useMergedCells) at NPOI.HSSF.UserModel.HSSFSheet.AutoSizeColumn(Int32 column, Boolean useMergedCells)
解决办法:
将npoi的版本从2.1.3.1更换成 2.2.1.0,问题解决。
参考链接:https://stackoverflow.com/questions/19873803/npoi-auto-resize-column