Reputation: 15
I've been reading "Open XML. The markup explained" by Wouter van Vugt.
Chapter "Wordprocessing ML" contains rather simple walkthrough of manual creating of a simple docx file by creating several xml part files, zipping it and renaming it to *.docx.
I've followed instructions precisely, but when I tried to open final *.zip-file with Open XML SDK Productivity Tool I've got an error: "Cannot open the file: The specified file type is not supported".
I tried to create a docx file with MS Word, rename it to *.zip and open it with Productivity Tool. It Worked. There are much more parts in this file then in such, created manually, but descriptive parts are practically the same.
What am I doing wrong?
P.S.: Yeah, I know that OOXML is supposed to be created via some .NET-compatible code, not by manual creating of XML contents. But I'm trying to understand it's structure, and I don't get it.
Contents of created files:
[Content-Types].xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
<Default Extension="xml" ContentType="application/xml" />
<Override PartName="/Document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.mainxml" />
</Types>
Document.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:t>Hello World!</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
.rels:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="Document.xml" />
</Relationships>
Upvotes: 0
Views: 1241
Reputation: 1663
Assuming the filestructure is like the following:
_rels
.rels
[Content_Types].xml
Document.xml
Then it's probably simply a missing '+' at the end of the the last 'ContentType' inside [Content_Types].xml:
<Override PartName="/Document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" />
(using 'main+xml' instead of 'mainxml').
Upvotes: 1