Table of Contents

Runnable samples

The repository ships a runnable, self-contained sample project for Bodu.Formats.Excel.Binary under samples/Formats.Excel/. It is offline and deterministic - every scenario reads the committed Data/sample-biff8.xls fixture (464 KB, a genuine two-sheet exchange-rates workbook with ~18,000 cells) - and is a member of bodu.slnx, built and executed by CI. The README documents every scenario individually: its intent, what the code does, the output to expect, and the APIs demonstrated.

Run it from the repository root:

dotnet run --project samples/Formats.Excel/Bodu.Formats.Excel.Binary.Samples.ExcelReading

The sample

Bodu.Formats.Excel.Binary.Samples.ExcelReading

The read-only BIFF5 and BIFF8 (.xls) workbook reader, layer by layer:

  • WorkbookAndSheets - the ExcelBinaryWorkbook session: the sheet directory (ExcelWorksheetInfo - name, type, visibility, declared used range in A1 notation), flattened document properties, and the workbook's declared ExcelDateSystem.
  • ForwardOnlyReader - the primary surface: ExcelWorksheetReader streams cells forward-only with constant memory (17,937 cells counted and classified without buffering), plus ReadRows grouping for row-shaped import pipelines.
  • MaterializedWorksheet - the convenience surface: ExcelWorksheet with coordinate lookup (TryGetCell), LINQ aggregation over the cell collection, and sparse-row semantics.
  • CellKindsAndDates - the five ExcelCellKinds and BIFF's classic importer trap: dates are Number cells classified by format. ExcelCell.IsDateFormatted plus ExcelSerialDate and the workbook's date system decode 887 serial dates; error cells surface as ExcelErrorCode values rather than exceptions.

Scope: Excel binary (.xls - BIFF8 from Excel 97-2003, BIFF5 from Excel 5.0/95) only, read-only; formula cells expose their cached results; encrypted workbooks throw. Package: Bodu.Formats.Excel.Binary.

Guarded documentation

The guides under docs/guides/excel/ carry compile-guarded snippets: examples marked with a <!-- compile --> sentinel are compiled against the current public API by DocumentationSnippetCompileTests in the library's test project (Regression tier).