OpenMcdf 2.2.1.12

.NET Standard 2.0 .NET Framework 4.0
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.
paket add OpenMcdf --version 2.2.1.12
#r "nuget: OpenMcdf, 2.2.1.12"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install OpenMcdf as a Cake Addin
#addin nuget:?package=OpenMcdf&version=2.2.1.12

// Install OpenMcdf as a Cake Tool
#tool nuget:?package=OpenMcdf&version=2.2.1.12

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

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (25)

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.

OpenMcdf.Extensions

Package Description

GitHub repositories (13)

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

Repository Stars
QL-Win/QuickLook
Bring macOS “Quick Look” feature to Windows
vivami/SauronEye
Search tool to find specific files containing specific words, i.e. files containing passwords..
michaelweber/Macrome
Excel Macro Document Reader/Writer for Red Teamers & Analysts
Sicos1977/MSGReader
C# Outlook MSG file reader without the need for Outlook
b4rtik/RedPeanut
RedPeanut is a small RAT developed in .Net Core 2 and its agent in .Net 3.5 / 4.0.
Version Downloads Last updated
2.2.1.12 28,178 8/30/2022
2.2.1.9 1,142,482 9/18/2020
2.2.1.6 47,548 7/22/2020
2.2.1.5 649 7/21/2020
2.2.1.4 322,731 12/7/2019
2.2.1.3 867,320 10/27/2018
2.2.1.2 2,713 10/6/2018
2.2.0.1 29,594 7/22/2018
2.1.6.28924 23,795 4/14/2018
2.1.5.22659 12,530 3/17/2018
2.1.4.23498 979 3/10/2018
2.1.3.34730 9,909 7/22/2017
2.1.3.34720 1,232 6/2/2017
2.1.2.1274 2,015 3/17/2017
2.1.0.33051 7,064 12/29/2016
2.0.5739.40493 287,899 9/18/2015
1.5.4.22637 13,381 1/24/2013

Bug fixing #88 and #90