NPOI在导入excel文件的时候,会出现如下错误:
NPOI.HSSF.Record.LeftoverDataException: Initialisation of record 0x31 left 4 bytes remaining still to be read.
但是用excel能够正常打开,并且在excel中保存后,可以正常的导入,找到原因和方法如下:
原因(链接地址)
解决方案:
代码如下图:
不再抛出异常,加了readToEndOfRecord();方法。
但是又抛出了异常:
System.InvalidOperationException: Found EOFRecord before Window