views:

129

answers:

1

I develop a software that uses FlatOPC files. I need to manipulate several parts of the File. System.IO.Packaging offers the classes ZipPackage and ZipPackagePart for manipulation .docx files. There is no implementation for FlatOPC. So I've built my own. The Problem is, that using the FlatOPCPackage with a WordprocessingDocument causes a NullReferenceException to be thrown and I did not find the reason. Debugging shows that only one method of the FlatOPCPackage is called and this one works.

Has anyone encountered a similar problem?

A: 

I didn't use the contentType that is provided by an attribute in the FlatOPC on the part node. This code solved my problem.

XmlNode packageNode = nodeList[0];
string contentType = packageNode.Attributes["pkg:contentType"].Value;
crauscher