首页 > 编程语言 >C#读取BIFF4格式的Excel文件

C#读取BIFF4格式的Excel文件

时间:2024-08-07 16:29:57浏览次数:18  
标签:BIFF4 stream format C# Excel BIFF8 file record

使用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

相关文章

  • Docker部署.netCore6
    Docker部署.netCore6第一步:在项目添加Docker支持第二步:选择Windows(如果是linx系统就选择linx)和Dockerfile第三步:生成Docker默认文件 把默认代码修改第四步:修改Dockerfile文件属性(如果不修改则会导致发布的时候Docker文件没有一起发布)第五步:把项目发布到文件夹在发......
  • jeecg-vue3, BasicTable与抽屉useDrawer()的简单使用
    需求:分屏情况下,根据传入参数不同查看申请材料1.实现效果点击申请材料弹出,点击取消或点击空白处,抽屉消失2.代码实现2.1files.vue实现<template><divclass="container"><a-button@click="click('sqcl')"style="margin-left:5px;">申请材料</a-b......
  • Visionpro二次开发学习笔记7-使用CogToolDisplay控件
    CogToolDisplay控件可显示与视觉工具记录相关的图像,图形和其他状态信息。它使用CogRecord和ICogTool接口将图像和图形连接到CogDisplay。图片清单控件的CogComboBox列出当前记录及其子记录中的图像和图形。您可以单击列表并选择要显示的图像或图形。如果记录层次结构仅包......
  • 石英 CMOS 振荡器 PF1612 系列(1 to 200MHz)介绍
    一、引言在现代电子技术的快速发展中,精确和稳定的时钟信号是各种电子设备正常运行的核心要素之一。石英CMOS振荡器作为一种关键的时钟源组件,以其出色的性能和可靠性在众多领域发挥着重要作用。本文将深入介绍石英CMOS振荡器PF1612系列(1to200MHz),探讨其独特的特点、......
  • Linux 利用 ftrace 分析内核调用
    目录一、概述二、ftrace的使用1、常用信息2、指定ftrace跟踪器3、设置要跟踪的函数4、ftrace的开关5、function跟踪程序6、function_graph跟踪程序7、函数过滤器8、跟踪事件三、trace-cmd的使用1、常见命令2、常用选项2.1列出可用的追踪器2.2跟踪特定进程的函......
  • C# 常用集合类型
     在C#中,常用的集合主要在:System.Collections和System.Collections.Generic命名空间中。一.System.Collections.GenericList<T>可以动态调整大小的数组,提供添加、插入、删除、搜索等方法的集合。LinkedList<T>  双向链表,允许在列表的任何位置高效地添加或删除元素。在Q......
  • Distance to Different
    最开始观察\(a\)没看出什么东西来,于是看\(b\),由于统计的是不同的\(b\)的数量,所以考虑一个\(b\)可以由什么\(a\)搞出来,然后就不难发现如果我们将\(a\)分段(相同的数放一段),那么对应的\(b\)在同一段就会从\(1\)开始增加,然后到达一个峰值之后再减小到\(1\)(开头和结尾的两段只有减少或增......
  • 题解:Codeforces Round 964 (Div. 4) C
    C.Showeringtimelimitpertest:2secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputAsacomputersciencestudent,Alexfacesahardchallenge —showering.Hetriestoshowerdaily,butdespitehisbestefforts......
  • EF Core连接PostgreSQL数据库
    PostgreSQL数据库介绍PostgreSQL是一个功能强大的开源对象关系型数据库管理系统(RDBMS)。最初于1986年在加州大学伯克利分校的POSTGRES项目中诞生,PostgreSQL以其稳定性、灵活性和扩展性而著称。它支持丰富的数据类型、复杂的查询、事务完整性、多版本并发控制(MVCC)、存储过程等高级......
  • Java的单例模式其实跟C的面向过程没什么区别
    这个我觉得倒也没有那么好笑,Java里面Singleton用的的确是有点多得离谱了,实际上把一个Singleton类的所有成员(包括字段和方法)都换成静态也没有什么不可以的,用Singleton主要是这样几个优点:1、Singleton类可以用接口和继承,static不行2、因此,Singleton类稍微保留了一点多态能力,例如可以......