MeshWeaver.DataSetReader.Excel.BinaryFormat 3.0.0-rc6

This is a prerelease version of MeshWeaver.DataSetReader.Excel.BinaryFormat.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MeshWeaver.DataSetReader.Excel.BinaryFormat --version 3.0.0-rc6
                    
NuGet\Install-Package MeshWeaver.DataSetReader.Excel.BinaryFormat -Version 3.0.0-rc6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeshWeaver.DataSetReader.Excel.BinaryFormat" Version="3.0.0-rc6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.DataSetReader.Excel.BinaryFormat" Version="3.0.0-rc6" />
                    
Directory.Packages.props
<PackageReference Include="MeshWeaver.DataSetReader.Excel.BinaryFormat" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.DataSetReader.Excel.BinaryFormat --version 3.0.0-rc6
                    
#r "nuget: MeshWeaver.DataSetReader.Excel.BinaryFormat, 3.0.0-rc6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MeshWeaver.DataSetReader.Excel.BinaryFormat@3.0.0-rc6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MeshWeaver.DataSetReader.Excel.BinaryFormat&version=3.0.0-rc6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MeshWeaver.DataSetReader.Excel.BinaryFormat&version=3.0.0-rc6&prerelease
                    
Install as a Cake Tool

MeshWeaver.DataSetReader.Excel.BinaryFormat

MeshWeaver.DataSetReader.Excel.BinaryFormat is a specialized implementation for reading legacy Excel (.xls) files in the BIFF (Binary Interchange File Format) format. It provides comprehensive support for reading Excel 97-2003 workbooks with their complex binary structure.

Overview

The library provides:

  • Complete BIFF format support
  • Excel 97-2003 workbook reading
  • Cell format handling
  • Shared string table support
  • Multi-sheet workbook handling
  • Formula cell support

Architecture

Core Components

ExcelBinaryReader

Main reader implementation providing:

  • Workbook structure parsing
  • Sheet content reading
  • Cell value extraction
  • Format conversion
BIFF Record Types

Specialized handlers for various BIFF records:

  • BOF (Beginning of File)
  • Worksheet data
  • Cell content
  • Formatting information
  • Shared strings
  • Formula cells

Binary Format Support

Workbook Structure
  • File header parsing
  • Workbook globals
  • Sheet information
  • Format definitions
  • Font tables
Cell Types
  • Label cells
  • Number cells
  • Formula cells
  • Blank cells
  • Error cells
  • Boolean cells

Usage Examples

Basic File Reading

public async Task<IDataSet> ReadXlsFile(Stream stream)
{
    var reader = new ExcelBinaryReader();
    reader.Initialize(stream);
    
    var dataSet = new DataSet();
    while (reader.Read())
    {
        // Process rows
        for (int i = 0; i < reader.FieldCount; i++)
        {
            var value = reader.GetValue(i);
            // Handle cell value
        }
    }
    
    return dataSet;
}

Configuring Reader Options

var reader = new ExcelBinaryReader(new ReadOption
{
    IsFirstRowAsColumnNames = true,
    ConvertOADates = true
});

Reading Multiple Sheets

public DataSet ReadAllSheets(Stream stream)
{
    using var reader = new ExcelBinaryReader();
    reader.Initialize(stream);
    
    var dataSet = new DataSet();
    do
    {
        var table = new DataTable(reader.Name);
        // Read sheet data into table
        dataSet.Tables.Add(table);
    } while (reader.NextResult());
    
    return dataSet;
}

Advanced Features

Shared String Handling

private void HandleSharedStrings(XlsBiffSST sst)
{
    // SST (Shared String Table) processing
    foreach (var str in sst.StringList)
    {
        // Process shared string
    }
}

Format Conversion

private object ConvertCellValue(XlsBiffRecord cell, ushort format)
{
    // Handle various Excel formats
    switch (format)
    {
        case FormatType.Date:
            return TryConvertOADateTime(cell.Value);
        case FormatType.Number:
            return ConvertNumber(cell.Value);
        // ... other formats
    }
}

BIFF Record Types

Core Records

  • BOF (Beginning of File)
  • EOF (End of File)
  • BOUNDSHEET (Worksheet Information)
  • SST (Shared String Table)
  • FORMAT (Number Format)
  • XF (Extended Format)

Cell Records

  • LABEL (String Cell)
  • NUMBER (Numeric Cell)
  • FORMULA (Formula Cell)
  • BLANK (Empty Cell)
  • MULBLANK (Multiple Empty Cells)
  • RK (RK Number Cell)

Best Practices

  1. Memory Management

    • Use streaming for large files
    • Dispose readers properly
    • Handle large string tables efficiently
  2. Format Handling

    • Validate cell formats
    • Handle date conversions properly
    • Support custom number formats
  3. Error Handling

    • Check file corruption
    • Handle formula errors
    • Validate record sequences
  4. Performance

    • Use appropriate buffer sizes
    • Cache shared strings
    • Optimize cell access

Integration

With Base Excel Reader

public class BinaryFormatReader : ExcelDataSetReaderBase
{
    protected override IExcelDataReader GetExcelDataReader(Stream stream)
    {
        var reader = new ExcelBinaryReader();
        reader.Initialize(stream);
        return reader;
    }
}

With Message Hub

services.AddMessageHub(hub => hub
    .ConfigureServices(services => services
        .AddSingleton<IExcelReaderFactory>(provider => 
            new ExcelReaderFactory())
        .AddTransient<IDataSetReader, BinaryFormatReader>()
    )
);

Error Handling

The library provides detailed error information for:

  • Invalid file formats
  • Corrupted records
  • Unsupported features
  • Formula errors
  • Format conversion issues
  • MeshWeaver.DataSetReader.Excel - Base Excel reader framework
  • MeshWeaver.DataSetReader.Excel.OpenXmlFormat - Modern Excel format implementation
  • MeshWeaver.DataStructures - Core data structures
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated