macospowerpoint

Error rezipping a powerpoint folder into a pptx on mac


I am attempting to manually edit an embedded powerpoint workbook on macOS Mojave 10.14.5 (as a test to later automate the process using STATA and/or Bash).

My process is this:

  1. Rename a completed powerpoint, PresentationName.pptx, to .zip
    1. unzip PresentationName.pptx.zip using Unarchiver (success!)
    2. Navigate folder structure to edit a few numbers in excel embedded workbook
    3. Attempt to rezip (using context menu "compress", or terminal)
    4. Attempt to open PresentationName.pptx (errors)

In terminal:

zip -r rezip1/PresentationName.pptx PresentationName.pptx -x "*.DS_Store"

The new .pptx file is created in the folder specified. From here, I am expecting the powerpoint to open up normally, with my new changes reflected in the embedded workbook.

Instead, I receive two errors:

PowerPoint found a problem with content in PresentationName.pptx. PowerPoint can attempt to repair the presentation.If you trust the source of this presentation, click Repair.

after clicking Repair,

Sorry, PowerPoint can't read PresentationName.pptx.

I'm guessing the terminal based zipper zips an incorrect file type/structure, but not sure if that is the case and was hoping someone had some success here.

Thank you for reading and apologies for any stupid questions/format mistakes I may be presenting.


Solution

  • Rezipping OOXML files is tricky. I've have success working on a external hard disk that doesn't create .DS_Store files to begin with. In Terminal:

    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
    

    In addition, the macOS Archive utility never produces a workable OOXML file either. Using zip in Terminal should get around that.

    For non-programmatic editing, BBEdit 11 or better can work directly on OOXML files without unzipping them. The OOXML Tools add-in for Chrome can also do this, and for free.