Menu

#3 Patch to generate zip archives readable by MS Office 2007

open
nobody
None
5
2012-07-18
2007-08-31
No

This patch changes rubyzip so that it will generate zip archives that are readable by MS Office 2007. See bug #1614983.

I didn't do anything specific to OOXML. Because MS Office doesn't have any problems reading a zip archive generated from the command line, I just created a test that would let me mimic the zip command line utility, and then got that test to pass.

The biggest change is that it now uses an ordered hash-like structure to store ZipEntries. In addition, I fixed several problems with file attributes and Central Directory entries.

Everything is tested and all previous unit tests pass. See the test method "test_mimic_zip" in rubytest.rb.

This is the first time I am submitting a patch for ANY open source project, so if there is something else I should do, please let me know.

Discussion

  • Chris Garrett

    Chris Garrett - 2007-08-31
     
  • Carl Bourne

    Carl Bourne - 2008-10-22

    Hi, I tried to use this with a docx file created by Office 2008 on the Mac. However, Word generates an error when trying to open the file.

    "The file is corrupt and cannot be opened"

    I get a similar error if I try to open the document with Stuffit 12:

    "Archive was compressed with an unknown compression method (Error #17535)"

    and yet a similar error when I try to unzip on the command line:

    "invalid compressed data to inflate"

    Does anybody have any ideas on how this can be fixed. Without the fix this library is pretty useless.

     
  • Thomas Sondergaard

    It would be ideal if you could resubmit your patch as a diff against CVS HEAD.

     
  • Nobody/Anonymous

    With this patch, I was able to create a file (.xlsx) that Excel 2007 could read. (Thanks Chris!)

     

Anonymous
Anonymous

Add attachments
Cancel