How to zip a WordprocessingML folder into readable docx

后端 未结 4 923
余生分开走
余生分开走 2020-12-13 02:25

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 int

相关标签:
4条回答
  • 2020-12-13 03:03

    Here are steps to unzip my.docx and re-zip:

    % mkdir unzipped
    % cd unzipped/
    % unzip ../my.docx    
    % zip -r ../rezipped.docx *
    % open ../rezipped.docx 
    
    0 讨论(0)
  • 2020-12-13 03:05

    Further to what Mica said, the contents of the ZIP file are organised according to the Open Packaging Convention; cf. Microsoft's Essentials of the Open Packaging Convention.

    You can use the .NET System.IO.Packaging to make and manipulate .docx files; this class is implemented in the Mono project.

    0 讨论(0)
  • 2020-12-13 03:19

    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.

    0 讨论(0)
  • 2020-12-13 03:24

    The compression algorithm used is "Zip" (Base 64) compression.

    7zip seems to offer this, though i have no tested it.

    0 讨论(0)
提交回复
热议问题