From 7c1d59de7098050a4dfe2f0a72ef8d6cb0f38e1a Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Tue, 20 Dec 2011 19:49:29 +0900 Subject: patch: If the type is specified before the value is set we try to cast nil, and force the type to be nil. We should only cast the value when type is being set against an established value attribute. --- lib/axlsx/workbook/worksheet/cell.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 0f06bd13..7289bf3b 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -48,7 +48,7 @@ module Axlsx def type=(v) RestrictionValidator.validate "Cell.type", [:time, :float, :integer, :string], v @type=v - self.value = @value + self.value = @value unless @value.nil? end @@ -182,8 +182,10 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end @style ||= 0 + puts @type @type ||= cell_type_from_value(value) @value = cast_value(value) + puts @type end # @return [Integer] The index of the cell in the containing row. -- cgit v1.2.3