I have tried to generate "Hello World" with openxm开发者_如何学运维l 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.
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.
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
.
精彩评论