There is apparently a bug in the Open XML SDK 2.0 when trying to work with a document that contains a Ribbon extension using the namespace for Office 2010 <customUI xmlns=”http://schemas.microsoft.com/office/2009/07/customui“>
If the document contains a customUI12 part, you get the error ArgumentOutOfRangeException when using WordProcessingDocument.Open.
The problem appears to be fixed in Open XML SDK 2.5, which requires the .NET Framework 4.0.
As Open XML SDK 2.0 was developed for Office 2010 this is a major oversight. It means that any document with Ribbon XML extending the Backstage and Context Menus cannot be edited using the Open XML SDK 2.0. The problem is, at the time of this writing, undocumented by Microsoft. I’ve posted in the Open XML SDK forum and have received confirmation of the behavior.
From the fact that the problem is fixed in version 2.5, we can assume that this is another case where Microsoft has not been transparent about problems with its software. Publication of this limitation could have saved me and others hours of trying to track down the reason for the error.
In order to use the Open XML SDK 2.5 you’ll need to upgrade your project to the .NET Framework 4.0 (Visual Studio 2010 or later). You can download the Open XML SDK 2.5 here.