OpenMcdf 2.2.1.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package OpenMcdf --version 2.2.1.12
                    
NuGet\Install-Package OpenMcdf -Version 2.2.1.12
                    
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="OpenMcdf" Version="2.2.1.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenMcdf" Version="2.2.1.12" />
                    
Directory.Packages.props
<PackageReference Include="OpenMcdf" />
                    
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 OpenMcdf --version 2.2.1.12
                    
#r "nuget: OpenMcdf, 2.2.1.12"
                    
#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 OpenMcdf@2.2.1.12
                    
#: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=OpenMcdf&version=2.2.1.12
                    
Install as a Cake Addin
#tool nuget:?package=OpenMcdf&version=2.2.1.12
                    
Install as a Cake Tool

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 supports now .NET Standard 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (40)

Showing the top 5 NuGet packages that depend on OpenMcdf:

Package Downloads
MsgReader

Read Outlook MSG and EML files without using Outlook. The MSGReader supports MSG E-Mail (also signed), Contact, Appointment, Task, Sticky notes and Contact files. The EML reader supports MIME 1.0 encoded files.

FileSignatures

A small library for detecting the type of a file based on header signature (also known as magic number) rather than file extension.

MsgKit

MsgKit is a 100% managed C# .NET library (no PINVOKE or whatsoever) which may be used for the creation of messages (E-Mail, Appointments, Journals and Stickey Notes) that are Outlook compatible

mzLib

Library for mass spectrometry projects.

GdPicture

Intelligent PDF & document processing SDKs

GitHub repositories (18)

Showing the top 18 popular GitHub repositories that depend on OpenMcdf:

Repository Stars
vivami/SauronEye
Search tool to find specific files containing specific words, i.e. files containing passwords..
Sicos1977/MSGReader
C# Outlook MSG file reader without the need for Outlook
michaelweber/Macrome
Excel Macro Document Reader/Writer for Red Teamers & Analysts
freezy/VisualPinball.Engine
:video_game: Visual Pinball Engine for Unity
Inf0secRabbit/BadAssMacros
BadAssMacros - C# based automated Malicous Macro Generator.
EvotecIT/OfficeIMO
Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
b4rtik/RedPeanut
RedPeanut is a small RAT developed in .Net Core 2 and its agent in .Net 3.5 / 4.0.
neilharvey/FileSignatures
A small library for detecting the type of a file based on header signature (also known as magic number).
CnCNet/xna-cncnet-client
XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
CompOmics/ThermoRawFileParser
Thermo RAW file parser that runs on Linux/Mac and all other platforms that support Mono
Sicos1977/MsgKit
A .NET library to make MSG files without the need for Outlook
svrooij/WinTuner
Package any app from Winget to Intune - WinTuner
lindexi/lindexi_gd
博客用到的代码
chelh/VBASync
Cross-platform tool to synchronize macros from an Office VBA-enabled file with a version-controlled folder
sqrtZeroKnowledge/CVE-2023-23397_EXPLOIT_0DAY
Exploit for the CVE-2023-23397
CodeCavePro/revitless-toolkit
A cross-platform toolkit for reading metadata of .rfa, .rvt etc. Reading / writing hared sparameter and type catalog files WITHOUT Revit
ajryan/RptToXml
Crystal Reports to XML converter
moom825/visualstudio-suo-exploit
This repository is a tool to create a .suo that when run by visual studio's will achieve code execution
Version Downloads Last Updated
3.0.3 38,468 9/4/2025
3.0.2 58,905 8/26/2025
3.0.1 88,630 6/22/2025
3.0.0 34,953 6/3/2025
3.0.0-preview.5 329 4/22/2025
3.0.0-preview.4 943 11/29/2024
3.0.0-preview.3 146 11/28/2024
3.0.0-preview.2 195 11/21/2024
2.4.1 601,875 12/1/2024
2.4.0 35,680 11/14/2024
2.3.1 2,386,160 3/2/2024
2.3.0 1,242,649 4/22/2023
2.2.1.12 769,048 8/30/2022
2.2.1.9 4,136,982 9/18/2020
2.2.1.6 61,487 7/22/2020
2.2.1.5 1,622 7/21/2020
2.2.1.4 868,858 12/7/2019
2.2.1.3 1,315,918 10/27/2018
2.2.1.2 14,139 10/6/2018
2.2.0.1 39,599 7/22/2018
2.1.6.28924 59,195 4/14/2018
2.1.5.22659 17,820 3/17/2018
2.1.4.23498 2,221 3/10/2018
2.1.3.34730 14,254 7/22/2017
2.1.3.34720 2,702 6/2/2017
2.1.2.1274 3,246 3/17/2017
2.1.0.33051 8,871 12/29/2016
2.0.5739.40493 322,777 9/18/2015
1.5.4.22637 26,062 1/24/2013

Bug fixing #88 and #90