OpenMcdf.Extensions 2.4.0

dotnet add package OpenMcdf.Extensions --version 2.4.0                
NuGet\Install-Package OpenMcdf.Extensions -Version 2.4.0                
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.Extensions" Version="2.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpenMcdf.Extensions --version 2.4.0                
#r "nuget: OpenMcdf.Extensions, 2.4.0"                
#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.
// Install OpenMcdf.Extensions as a Cake Addin
#addin nuget:?package=OpenMcdf.Extensions&version=2.4.0

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

Build Status Github workflow

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 (*.aaf files for example).

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.

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. 
.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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on OpenMcdf.Extensions:

Package Downloads
mzLib

Library for mass spectrometry projects.

ldy985.FileMagic.Core.Rules

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on OpenMcdf.Extensions:

Repository Stars
michaelweber/Macrome
Excel Macro Document Reader/Writer for Red Teamers & Analysts
compomics/ThermoRawFileParser
Thermo RAW file parser that runs on Linux/Mac and all other platforms that support Mono
Version Downloads Last updated
2.4.0 5,132 11/16/2024
2.3.1 36,522 3/2/2024
2.3.0.1 47,445 4/22/2023
2.3.0 420 4/22/2023
2.2.1.4 127,988 12/7/2019
2.2.1.3 50,799 11/21/2018
2.2.1.2 999 10/6/2018