Class: Spreadsheet::Excel::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/spreadsheet/excel/error.rb

Overview

This class encapsulates Excel Error-Codes

Constant Summary

ERROR_VALUES =
{
  0x00 => '#NULL!',  # Intersection of two cell ranges is empty
  0x07 => '#DIV/0!', # Division by zero
  0x0F => '#VALUE!', # Wrong type of operand
  0x17 => '#REF!',   # Illegal or deleted cell reference
  0x1D => '#NAME?',  # Wrong function or range name
  0x24 => '#NUM!',   # Value range overflow
  0x2A => '#N/A!',   # Argument or function not available
}

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Error) initialize(code)

Intersection of two cell ranges is empty Division by zero Wrong type of operand Illegal or deleted cell reference Wrong function or range name Value range overflow Argument or function not available



16
17
18
# File 'lib/spreadsheet/excel/error.rb', line 16

def initialize code
  @code = code
end

Instance Attribute Details

- (Object) code (readonly)

Returns the value of attribute code



6
7
8
# File 'lib/spreadsheet/excel/error.rb', line 6

def code
  @code
end

Instance Method Details

- (Object) value

The String value Excel associates with an Error code



21
22
23
# File 'lib/spreadsheet/excel/error.rb', line 21

def value
  ERROR_VALUES.fetch @code, '#UNKNOWN'
end