libOPC 0.0.2 released

The second major release of libOPC – and the first that is broadly feature-complete – was published on CodePlex this week by former Novell developer Florian Reuter.  libOPC is a platform-independent C library that provides read and write access to Open Packaging Conventions (OPC) files, the package format used by Open XML.  My colleague Doug Mahugh provided a great introduction to libOPC in a recent post on his blog.

This latest release of libOPC adds support for Markup Compatibility and Extensibility (MCE).  Florian added API for reading, writing and processing MCE, added more demo videos showing how MCE is used, updated and reorganized the information on the CodePlex site, added new code samples and updated the source code documentation.  Microsoft sponsored Florian’s initial work and we’re thrilled with how well libOPC has turned out so far – check it out!

First off, what is MCE?  It’s a standardized way to build backward compatibility for future features into a file format.  It’s Part 3 of the Office Open XML standard (ISO/IEC 29500-3) and is used by Microsoft Office to support new features in the same files that any implementation of Open XML supporting MCE can read and edit.  MCE allows implementers to continue innovating while maintaining conformance with a file format that was designed years before the new features were imagined.  Florian walks through a great introduction to MCE in this video using the mce_extract sample code provided with libOPC and example markup from Open XML Part 3 and Word 2010.

Of course, MCE is not a Microsoft-only feature – it’s part of the standard, so anyone can use it to support custom extensions.  In fact, it’s not even just an Open XML feature.  The OPC and MCE parts of the Office Open XML standard can be referenced from other standards that wish to use a common, flexible packaging format.  ECMA-388, the Open XML Paper Specification – or OpenXPS – does exactly that.

MCE makes Open XML (and OPC) a very flexible file format – lots of core capability with the means to store advanced content plus backward-compatible alternative representations of that content.  Storing alternative representations via MCE means that the file must be preprocessed based on namespaces the application understands to arrive at final, Open XML-compliant markup that the app will actually parse to load a document.  This latest release of libOPC provides the means to read and write MCE, as well as to preprocess the markup for handoff to the application.

Florian created a great demo video showing how MCE and libOPC can be integrated into LibreOffice to store a LibreOffice-specific feature in an Open XML file.  Using a small import/export filter he created for LibreOffice, section background coloring – a feature not supported in Open XML – can be stored in an Open XML file for full-fidelity editing in LibreOffice while Word shows the file without the coloring.

Interesting in trying libOPC?  Take a look at the videos showing how to use libOPC with iOS and WebKit, get the source code, build it for Windows, Linux, Mac OS X, iOS or Android and integrate it into your project!

– John

John Haug, Office Standards and Interoperability