如何将WordprocessingML文件夹压缩成可读的docx [英] How to zip a WordprocessingML folder into readable docx

查看:421
本文介绍了如何将WordprocessingML文件夹压缩成可读的docx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图写一个简单的Markdown - > docx解析器/ writer,但是完全卡住最后一部分,这应该是最简单的:ie压缩文件夹到.docx的Word,或任何其他.docx读者,会认识到。

I have been trying to write a simple Markdown -> docx parser/writer, but am completely stuck with the last part, which should be the easiest: i.e. compressing the folder into a .docx that Word, or any other .docx reader, will recognize.

我的解析器写程序真的不相关:我有这个问题,如果我简单地解压缩任何旧的Word生产的* .docx,然后尝试重新压缩它与通常的压缩实用程序,给它文件结束docx。有没有一些神秘的头我应该添加,或者我需要一个特殊的OPC压缩实用程序,或什么?

My parser-writer is irrelevant really: I have this problem if I simply unzip any old Word-produced *.docx and then try to recompress it with the usual compression utilities, giving it the file-ending docx. Is there some mysterious header I should be adding, or do I need a special OPC compression utility, or what?

我不想要一个能够做到这一点的工具,以便弄清楚应该存在的是什么。它似乎独立于WordprocessingML规范。

I don't so much want a tool that will do this, as to figure out what is supposed to be there. It seems to be independent of the WordprocessingML specification.

不用说,我不知道压缩的什么。我可以通过谷歌找到的一切与可以在商业中使用的奇妙的实用程序,但我做一个小的可执行文件将是GPLd或东西,应该工作的任何东西。

Needless to say I don't know anything about compression. Everything I can find via Google has to do with fancy utilities you can use in business, but I'm making a little executable that would be GPLd or something, and should work on anything.

推荐答案

手动打包一起打开XML文档最常见的问题是,如果你压缩目录而不是内容。换句话说,[content_types] .xml文件以及word,docProps和_rels目录需要位于zip文件的根级别。

The most common problem around manually zipping together Open XML documents is that it will not work if you zip the directory instead of the contents. In other words, the[content_types].xml file, and the word, docProps, and _rels directories need to reside at the root level of the zip file.

这篇关于如何将WordprocessingML文件夹压缩成可读的docx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆