使用电子表格gem时出错

时间:2012-03-05 03:16:53

标签: ruby spreadsheet

使用电子表格gem打开电子表格时,出现以下错误:

/usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:73:in `block in encoding': Unknown Codepage 0xc24a (RuntimeError)
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:72:in `fetch'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:72:in `encoding'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:197:in `read_codepage'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:788:in `read_workbook'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/reader.rb:122:in `read'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet/excel/workbook.rb:32:in `open'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet.rb:62:in `open'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/spreadsheet-0.6.5.4/lib/spreadsheet.rb:68:in `open'
from worksheet_demo.rb:3:in `<main>'

1 个答案:

答案 0 :(得分:1)

这是尝试打开受密码保护的Excel电子表格的症状。您可以使用以下步骤删除密码来解决此问题:

  1. 打开工作簿。
  2. 在“文件”菜单上,单击“另存为”。
  3. 在“工具”菜单上,单击“常规选项”。
  4. 在“要打开的密码”或“要修改的密码”框中(或在两个框中),双击星号,然后按DELETE键。
  5. 单击“确定”,然后单击“保存”。
  6. 单击“是”以替换现有工作簿。