lib/roo/excel.rb in roo-1.9.7 vs lib/roo/excel.rb in roo-1.10.0

- old
+ new

@@ -91,11 +91,11 @@ end # Class for handling Excel-Spreadsheets class Excel < GenericSpreadsheet - EXCEL_NO_FORMULAS = 'formulas are not supported for excel spreadsheets' + EXCEL_NO_FORMULAS = 'Formulas are not supported for excel spreadsheets.' # Creates a new Excel spreadsheet object. # Parameter packed: :zip - File is a zip-file def initialize(filename, packed = nil, file_warning = :error) super() @@ -189,21 +189,21 @@ end end # returns NO formula in excel spreadsheets def formula(row,col,sheet=nil) - raise EXCEL_NO_FORMULAS + wait_for_version_080 end # raises an exception because formulas are not supported for excel files def formula?(row,col,sheet=nil) - raise EXCEL_NO_FORMULAS + wait_for_version_080 end # returns NO formulas in excel spreadsheets def formulas(sheet=nil) - raise EXCEL_NO_FORMULAS + wait_for_version_080 end # Given a cell, return the cell's font def font(row, col, sheet=nil) sheet = @default_sheet unless sheet @@ -457,7 +457,16 @@ value = nil end # case return value_type, value end private :read_cell - + + def wait_for_version_080 + if Spreadsheet::VERSION<='0.8.0' + raise EXCEL_NO_FORMULAS+ + " We have to wait for the 0.8.0 version of the Spreadsheet gem (currently used version is #{Spreadsheet::VERSION})" + else + raise 'Thomas should implement formulas from Spreadsheet gem' + end + end + end