Buffer size error

Feb 7, 2011 at 1:48 PM

Hi,

i´m getting this exception:

Buffer size is less than minimum BIFF record size.

What's this?
How can I avoid it?

Thank´s in advance.

Mar 30, 2011 at 6:12 PM
Edited Mar 30, 2011 at 6:18 PM

I'm getting this error too, when reading certain XLS files using ExcelBinaryReader. Seems like the number of bytes to be read in these files is not cleanly divisible by 4, so the XlsBiffRecord constructor throws this exception when it parses the last row.

I initially thought maybe it was just one bad file, but I've seen 3 of these now. The files open normally in Excel, but can't be opened using ExcelBinaryReader. Is there something I should be looking for in the files themselves? I assume it's not data -- I can copy/paste contents from a bad file into a new file and they can be read correctly, that's how we're working around the issue now.

Edit to put in a stack trace :)

System.ArgumentException was unhandled by user code
  Message="Error: Buffer size is less than minimum BIFF record size."
  Source="ExcelDataReader"
  StackTrace:
       at Excel.Core.BinaryFormat.XlsBiffRecord..ctor(Byte[] bytes, UInt32 offset) in C:\code\ExcelDataReader\Excel\Core\BinaryFormat\XlsBiffRecord.cs:line 28
       at Excel.Core.BinaryFormat.XlsBiffRecord.GetRecord(Byte[] bytes, UInt32 offset) in C:\code\ExcelDataReader\Excel\Core\BinaryFormat\XlsBiffRecord.cs:line 150
       at Excel.Core.BinaryFormat.XlsBiffStream.ReadAt(Int32 offset) in C:\code\ExcelDataReader\Excel\Core\BinaryFormat\XlsBiffStream.cs:line 98
       at Excel.ExcelBinaryReader.readWorkSheetRow() in C:\code\ExcelDataReader\Excel\ExcelBinaryReader.cs:line 306
       at Excel.ExcelBinaryReader.moveToNextRecord() in C:\code\ExcelDataReader\Excel\ExcelBinaryReader.cs:line 461
       at Excel.ExcelBinaryReader.Read() in C:\code\ExcelDataReader\Excel\ExcelBinaryReader.cs:line 669
      
    [... Client code details removed ...]

Apr 15, 2011 at 8:41 PM

Hi, has anyone found a solution to this issue?

Thanks.