Class: Roo::Excelx

Inherits:
Object
  • Object
show all
Defined in:
lib/spread2rdf/extensions/roo_xlsm_fix.rb

Overview

Easy access to xlsm files through the roo gem, version 1.10.0. The error that led me to write this is in the file below for google fodder. Not exactly sure what was causing the problem, so I’m not sure that this change won’t break everything on your computer or summon zombies.

Be sure to tell roo that you don’t care about the extension mismatch: xl = Roo::Excelx.new(“C:/path/to/spreadsheet_with_macro.xlsm”, :zip, :warning)

Instance Method Summary collapse

Constructor Details

#initialize(filename, options = {}) ⇒ Excelx

, packed=nil, file_warning = :error)



15
16
17
18
# File 'lib/spread2rdf/extensions/roo_xlsm_fix.rb', line 15

def initialize(filename, options = {}) # , packed=nil, file_warning = :error)
  @original_file = filename
  old_initialize(filename, options)
end

Instance Method Details

#extract_content(tmpdir, zipfilename_unused) ⇒ Object

extract files from the zip file, rewrites a method of the same name in lib/roo/excelx.rb



21
22
23
24
25
26
# File 'lib/spread2rdf/extensions/roo_xlsm_fix.rb', line 21

def extract_content(tmpdir, zipfilename_unused)
  #Zip::ZipFile.open(@original_file) do |zip|
  Zip::File.open(@original_file) do |zip|
    process_zipfile(tmpdir, @original_file, zip)
  end
end

#old_initializeObject



14
# File 'lib/spread2rdf/extensions/roo_xlsm_fix.rb', line 14

alias :old_initialize :initialize