OpenMcdf 3.0.0-preview1

GitHub Actions NuGet Version NuGet Downloads

OpenMcdf

OpenMcdf is a fully .NET / C# library to manipulate Compound File Binary File Format files, also known as Structured Storage.

Compound files include multiple streams of information (document summary, user data) in a single container, and is used as the bases for many different file formats:

  • Microsoft Office (.doc, .xls, .ppt)
  • Windows thumbnails cache files (thumbs.db)
  • Outlook messages (.msg)
  • Visual Studio Solution Options (.suo)
  • Advanced Authoring Format (.aaf)

OpenMcdf v3 has a rewritten API and supports:

  • And idiomatic dotnet API and exception hierarchy
  • Fast and efficient enumeration and manipulation of storages and streams
  • Files sizes up to 16 TB (using major format version 4 with 4096 byte sectors)
  • Transactions (i.e. commit and/or revert)
  • Consolidation (i.e. reclamation of space by removing free sectors)
  • Nullable attributes

Limitations:

  • No support for red-black tree balancing (directory entries are stored in a tree, but are not balanced. i.e. trees are "all-black")
  • No support for single writer, multiple readers

Getting started

To create a new compound file:

byte[] b = new byte[10000];

using var root = RootStorage.Create("test.cfb");
using CfbStream stream = root.CreateStream("MyStream");
stream.Write(b, 0, b.Length);

To open an Excel workbook (.xls) and access its main data stream:

using var root = RootStorage.OpenRead("report.xls");
using CfbStream workbookStream = root.OpenStream("Workbook");

To create or delete storages and streams:

using var root = RootStorage.Create("test.cfb");
root.CreateStorage("MyStorage");
root.CreateStream("MyStream");
root.Delete("MyStream");

For transacted storages, changes can either be committed or reverted:

using var root = RootStorage.Create("test.cfb", StorageModeFlags.Transacted);
root.Commit();
//
root.Revert();

A root storage can be consolidated to reduce its on-disk size:

root.Flush(consolidate: true);

Object Linking and Embedding (OLE) Property Set Data Structures

Support for reading and writing OLE Properties is available via the OpenMcdf.Ole package. However, the API is experimental and subject to change

OlePropertiesContainer co = new(stream);
foreach (OleProperty prop in co.Properties)
{
  ...
}

OpenMcdf runs happily on the Mono platform and multi-targets netstandard2.0 and net8.0 to maximize client compatibility and support modern dotnet features.

Showing the top 20 packages that depend on OpenMcdf.

Packages Downloads
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
30
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
33
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
34
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
36
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
39
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
31
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
32
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
43
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
44
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
32
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
43
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
61
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
72
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
77
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
105
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
203
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
209
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
242
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
364
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
451

.NET 8.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
3.0.3 4 09/08/2025
3.0.2 4 09/01/2025
3.0.1 7 07/06/2025
3.0.0 10 06/06/2025
3.0.0-preview1 22 11/30/2024
3.0.0-preview.5 15 04/24/2025
3.0.0-preview.4 21 12/17/2024
3.0.0-preview.3 16 12/15/2024
3.0.0-preview.2 24 11/22/2024
2.4.1 20 12/31/2024
2.4.0 20 11/19/2024
2.3.1 33 03/16/2024
2.3.0 29 02/13/2024
2.2.1.12 27 05/19/2023
2.2.1.9 1,102 10/05/2020
2.2.1.6 42 09/11/2020
2.2.1.5 27 02/13/2024
2.2.1.4 28 02/13/2024
2.2.1.3 27 10/14/2020
2.2.1.2 29 02/13/2024
2.2.0.1 26 02/13/2024
2.1.6.28924 30 02/13/2024
2.1.5.22659 23 02/13/2024
2.1.4.23498 27 02/13/2024
2.1.3.34730 27 02/13/2024
2.1.3.34720 25 02/13/2024
2.1.2.1274 26 02/13/2024
2.1.0.33051 27 02/13/2024
2.0.5739.40493 27 02/13/2024
1.5.4.22637 25 02/13/2024