使用NPOI读取这种格式的Excel文件时会报错:The supplied data appears to be in BIFF4 format. HSSF only supports the BIFF8 format, try OldExcelExtractor
如果使用OldExcelExtractor类的话,只能提取成文本,无法结构化读取。
使用ExcelDataRead库
https://github.com/ExcelDataReader/ExcelDataReader
The early XLS formats, used for Excel 2.0 (1987) through Excel 4.0 (1992), allowed only a single worksheet. The corresponding file formats were single BIFF streams.
- BIFF2 for Excel 2.0 (1987)
- BIFF3 for Excel 3.0 (1990)
- BIFF4 for Excel 4.0 (1992)
Note that the extension .xlw was used to support multi-sheet "workspaces" starting with Excel 3.0. However, the .xlw file did not contain user data; it was used to configure Excel's user interface presentation of the component sheets. See .xlw File Extension | ReviverSoft for more detail.
With BIFF5, a new structure was introduced; an XLS file now represented a single Workbook with one or many individual Worksheets. A number of streams, including BIFF streams for individual worksheets, are stored in a Microsoft Compound File Binary File container. The compilers of this resource have experimented with saving spreadsheets as XLS files in current versions of Excel. In all cases, the resulting file was in version 3 of CFB (MS-CFB3). Comments welcome. In BIFF7 and earlier, a record in a BIFF stream has a length limit of 2,084 bytes, including the record type and record length fields.
- BIFF5 for Excel 5.0 (1993) and Excel 95 (1995)
- BIFF7 was for an option available in Excel 97. Microsoft's 2007 Specification for Microsoft Office Excel 97-2007 Binary File Format (*.xls) states, "For improved backward compatibility, Excel 97 has a save file type option: Microsoft Excel 97 & 5.0/95 Workbook. When a workbook is saved using this file type, Excel writes two complete book streams. The first stream in the file is the Microsoft Excel 5.0/95 format (BIFF5/BIFF7), and the second one is the Microsoft Excel 97 format (BIFF8). The DSF record, which only appears in the BIFF8 stream, indicates the file is a double stream file. To distinguish the two streams, the BIFF5/BIFF7 stream is called Book, and the BIFF8 stream is called Workbook."
- BIFF8 for Excel 98 (1998) through Excel 2003. In BIFF8, a BIFF record has a length limit of 8,228 bytes, including the record type and record length fields. As noted above, Excel 97 introduced the BIFF8 format in its double-stream file option. This format description is primarily for the BIFF8 variant of the XLS format.
Note that BIFF12 is used in a different binary file format, using a different container file and the file extension .xlsb. It has been available as an alternative to the XML-based XLSX since Excel 2007. See MS-XLSB.
参考资料:
https://www.loc.gov/preservation/digital/formats/fdd/fdd000510.shtml
标签:BIFF4,stream,format,C#,Excel,BIFF8,file,record From: https://www.cnblogs.com/zhaotianff/p/18347277