summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2011-12-20 19:49:29 +0900
committerRandy Morgan <[email protected]>2011-12-20 19:49:29 +0900
commit7c1d59de7098050a4dfe2f0a72ef8d6cb0f38e1a (patch)
treee7bd432cec258fae3bfa1e41221674c4bab8be06
parent663ca52a9e06017b75f094854a00ec4684e4078a (diff)
downloadcaxlsx-7c1d59de7098050a4dfe2f0a72ef8d6cb0f38e1a.tar.gz
caxlsx-7c1d59de7098050a4dfe2f0a72ef8d6cb0f38e1a.zip
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.
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb4
1 files changed, 3 insertions, 1 deletions
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.