【问题标题】:Ruby zip cannot open docx fileRuby zip 无法打开 docx 文件
【发布时间】:2015-11-04 23:12:58
【问题描述】:

我正在尝试使用 ruby​​zip 打开一个空白 docx,但我不断收到错误消息:

Zip::Error: File /b;a/bla/bla/existing_file.docx not found

rubyzip 中是否有防止打开空 zipfile 的规则?

【问题讨论】:

    标签: ruby docx rubyzip


    【解决方案1】:

    rubyzip 仅支持压缩现有文件。你可以做的是使用touch创建一个空文件,然后压缩它。

    require "fileutils"
    FileUtils.touch '/b;a/bla/bla/existing_file.docx'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-21
      • 1970-01-01
      • 2018-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多