OpenMcdf 2.3.0

Build Status

openmcdf

Structured Storage .net component - pure C#

OpenMCDF is a 100% .net / C# component that allows developers to manipulate Microsoft Compound Document Files (also known as OLE structured storage).

Compound file includes multiple streams of information (document summary, user data) in a single container.

This file format is used under the hood by a lot of applications: all the documents created by Microsoft Office until the 2007 product release are structured storage files. Windows thumbnails cache files (thumbs.db) are compound documents as well as .msg Outlook messages. Visual Studio .suo files (solution options) are compound files and a lot of audio/video editing tools save project file in a compound container.

OpenMcdf supports read/write operations on streams and storages and traversal of structures tree. It supports version 3 and 4 of the specifications, uses lazy loading wherever possible to reduce memory usage and offer an intuitive API to work with structured files.

It's very easy to create a new compound file

byte[] b = new byte[10000];

CompoundFile cf = new CompoundFile();
CFStream myStream = cf.RootStorage.AddStream("MyStream");

myStream.SetData(b);
cf.Save("MyCompoundFile.cfs");
cf.Close();

You can open an existing one, an excel workbook (.xls) and use its main data stream

//A xls file should have a Workbook stream
String filename = "report.xls";
CompoundFile cf = new CompoundFile(filename);
CFStream foundStream = cf.RootStorage.GetStream("Workbook");
byte[] temp = foundStream.GetData();
//do something with temp
cf.Close();

Adding storage and stream items is just as easy...

CompoundFile cf = new CompoundFile();
CFStorage st = cf.RootStorage.AddStorage("MyStorage");
CFStream sm = st.AddStream("MyStream");

...as removing them

cf.RootStorage.Delete("AStream"); // AStream item is assumed to exist.

Call commit() method when you need to persist changes to the underlying stream

cf.RootStorage.AddStream("MyStream").SetData(buffer);
cf.Commit();

If you need to compress a compound file, you can purge its unused space

CompoundFile.ShrinkCompoundFile("MultipleStorage_Deleted_Compress.cfs"); 

OLE Properties handling for DocumentSummaryInfo and SummaryInfo streams
is now available via extension methods (experimental - api subjected to changes)

PropertySetStream mgr = ((CFStream)target).AsOLEProperties();
for (int i = 0; i < mgr.PropertySet0.NumProperties; i++)
{
  ITypedPropertyValue p = mgr.PropertySet0.Properties[i];
  ...

OpenMcdf runs happily on the Mono platform and targets netstandard 2.0 to allow maximum client compatibility AND .net framework 4 for legacy implementations.

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.
24
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
25
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
28
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
29
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
31
FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.
35
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
25
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
38
PommaLabs.MimeTypes
MIME content type definitions mapped with file extensions and file signatures.
39
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
26
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
38
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
56
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
66
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.
100
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
197
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.
236
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
360
PommaLabs.MimeTypes
Provides a library and registry for information about MIME content type definitions.
445

Bug fixing #75 #76 #84 #94 #96 Updated to .NET 6.0

.NET Framework 4.0

  • No dependencies.

.NET Standard 2.0

  • No dependencies.

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