diff options
| author | Randy Morgan <[email protected]> | 2012-06-02 23:52:32 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-06-02 23:52:32 +0900 |
| commit | 376d60eebeb0a48579862004d8a70b00fb39ee32 (patch) | |
| tree | 55cb871b87d6903819ab6a7ef56eaba02940d5c7 /lib | |
| parent | 2786ef5f7fc3a97403b69f530114860a19aa5fee (diff) | |
| download | caxlsx-376d60eebeb0a48579862004d8a70b00fb39ee32.tar.gz caxlsx-376d60eebeb0a48579862004d8a70b00fb39ee32.zip | |
more work on solidifying parsing of data caching for charts to eliminate formula strings.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/drawing/num_data.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/drawing/num_val.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 802a0216..ee6b145e 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -25,8 +25,8 @@ module Axlsx def data=(values=[]) @tag_name = values.first.is_a?(Cell) ? :numCache : :numLit values.each do |value| - v = value.is_a?(Cell) ? value.value : value - @pt << NumVal.new(:v => v) + value = value.is_formula? ? 0 : value.value if value.is_a?(Cell) + @pt << NumVal.new(:v => value) end end diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index 35dbdb83..ed655732 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -26,7 +26,7 @@ module Axlsx # serialize the object def to_xml_string(idx, str = "") Axlsx::validate_unsigned_int(idx) - str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s.to_i.to_s << '</c:v></c:pt>' + str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>' end end end diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 745809f9..e3e153e0 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -317,6 +317,10 @@ module Axlsx str << '</c>' end + def is_formula? + @type == :string && @value.start_with('=') + end + private # Utility method for setting inline style attributes |
