GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - workgroupengineering/openmcdf: Microsoft Compound File .net component - pure C# - netstandard 2.0

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,005 Commits
1,005 Commits

Folders and files

NameName
Last commit message
Last commit date
.config
.config
 
 
.github
.github
 
 
.vscode
.vscode
 
 
OpenMcdf.Benchmarks
OpenMcdf.Benchmarks
 
 
OpenMcdf.Explorer.Android
OpenMcdf.Explorer.Android
 
 
OpenMcdf.Explorer.Desktop
OpenMcdf.Explorer.Desktop
 
 
OpenMcdf.Explorer.iOS
OpenMcdf.Explorer.iOS
 
 
OpenMcdf.Explorer
OpenMcdf.Explorer
 
 
OpenMcdf.Ole.Benchmarks
OpenMcdf.Ole.Benchmarks
 
 
OpenMcdf.Ole.Tests
OpenMcdf.Ole.Tests
 
 
OpenMcdf.Ole
OpenMcdf.Ole
 
 
OpenMcdf.Perf
OpenMcdf.Perf
 
 
OpenMcdf.Tests
OpenMcdf.Tests
 
 
OpenMcdf
OpenMcdf
 
 
StructuredStorage
StructuredStorage
 
 
StructuredStorageExplorer
StructuredStorageExplorer
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Build.targets
Directory.Build.targets
 
 
Directory.Packages.props
Directory.Packages.props
 
 
Directory.csproj.props
Directory.csproj.props
 
 
Directory.csproj.targets
Directory.csproj.targets
 
 
License.txt
License.txt
 
 
OpenMcdf.CrossPlatform.slnf
OpenMcdf.CrossPlatform.slnf
 
 
OpenMcdf.slnx
OpenMcdf.slnx
 
 
OpenMcdf.snk
OpenMcdf.snk
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
cspell.json
cspell.json
 
 
docfx.json
docfx.json
 
 
exclusion.dic
exclusion.dic
 
 
global.json
global.json
 
 
icon.png
icon.png
 
 
index.md
index.md
 
 
stylecop.json
stylecop.json
 
 
toc.yml
toc.yml
 
 

Repository files navigation

OpenMcdf

GitHub Actions CodeQL OpenMcdf NuGet OpenMcdf.Ole NuGet NuGet Downloads

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:

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

OpenMcdf v3 has a rewritten API and supports:

  • An idiomatic dotnet API and exception hierarchy
  • Fast and efficient enumeration and manipulation of storages and streams
  • File 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

  • Limited error tolerance/recovery
  • No support for single writer, multiple readers
  • No support for red-black tree balancing

Directory entries are stored in a binary search tree where the entries are sorted but the tree is not balanced. i.e. the tree is "all-black", which is a valid red-black tree but has suboptimal performance for traversing large trees (though still considerably faster than some other clients).

Clients such as LibreOffice create trees with red-violations, which OpenMcdf is tolerant to reading and writing. Files with balanced red-black trees such as those created by Microsoft implementations will currently become unbalanced upon adding or removing directory entries. Fortunately, since other clients are also tolerant of trees that are either unbalanced or have red-violations, this should not be a major issue. The Wine implementation also has the same limitation.

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, net8.0, and net10.0 to maximize client compatibility and support modern dotnet features.

About

Microsoft Compound File .net component - pure C# - netstandard 2.0

Resources

Readme
MPL-2.0 license

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.