[Ironpython-users] open xml sdk v2.0

Pawel Jasinski pawel.jasinski at gmail.com
Fri Oct 28 16:08:29 CEST 2011


I am trying to use openxml sdk v2.0 together with python 2.7.1 (was
2.7.0). I have managed to generate the mini document out of the csharp

However if I try to do it from python, the produced document is
corrupted. Word complains about 'parts missing or invalid'. Unzip
spits the following:

$ unzip -t ../foobar.docx
Archive:  ../foobar.docx
   testing: word/document.xml
 error:  invalid compressed data to inflate
   testing: _rels/.rels              OK
At least one error was detected in ../foobar.docx.

Is there some sort of fundamental incompatibility between openxml sdk
and ironpython? Mixed zip libraries?

The test code:

import clr
clr.AddReferenceToFileAndPath("C:\Program Files\Open XML
from DocumentFormat.OpenXml.Packaging import WordprocessingDocument
from DocumentFormat.OpenXml import WordprocessingDocumentType
from DocumentFormat.OpenXml.Wordprocessing import
Text,Paragraph,Run,Document, Body

package = WordprocessingDocument.Create(
package.MainDocumentPart.Document =


More information about the Ironpython-users mailing list