tags:

views:

40

answers:

2

I have tried to generate "Hello World" with openxml sdk. To my surprise when trying to open the xml document it was not purely text format but it contains some ugly binary stuff.

Is there any option to have text format when the content is only text ?

I can't see any rationale for the binary part if it is supposedly "open".

Update: my mistake I didn't know docx was just a zip file. If I unzip it I will get the open xml format. So Openxml is really open.

+1  A: 

OpenXML is not pure text. If your file is pure text, save it as a text file.

This can be done via System.IO.File.WriteAllText.

Oded
I want to create complex document with tables etc. I can't see any rationale for the binary part if it is supposedly "open".
"supposedly" is right.
Oded
+2  A: 

The OpenXML format is an archive file (ZIP to be exact) with XML metadata and XML as well as binary contents.

This makes sense since it is pretty inefficient to include binary data, such as images, sounds, embedded objects etc. in textual XML. The "open" in the name comes from MS marketing and because the format is standardized and well documented.

Have a look at the System.IO.Packaging namespace, you'll find everything you need to create, read and modify OpenXML packages.

Lucero
I didn't know it's a zip file so that's logical it is binary. I just to unzip thanks Microsoft :)