summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/num_val.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-03 09:10:23 +0900
committerRandy Morgan <[email protected]>2012-05-03 09:10:23 +0900
commite622dc54069074198990beb0462da630bad38dd0 (patch)
tree4065eb11cf4dcd68440bf8347af4509c130fb11e /lib/axlsx/drawing/num_val.rb
parent2dfdd1f26b1fc748da3b4edad9aeeaeae842aedb (diff)
downloadcaxlsx-e622dc54069074198990beb0462da630bad38dd0.tar.gz
caxlsx-e622dc54069074198990beb0462da630bad38dd0.zip
rebuild series data base objects with full implementation.
Address shape validation error.
Diffstat (limited to 'lib/axlsx/drawing/num_val.rb')
-rw-r--r--lib/axlsx/drawing/num_val.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb
new file mode 100644
index 00000000..ed655732
--- /dev/null
+++ b/lib/axlsx/drawing/num_val.rb
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+module Axlsx
+
+ #This class specifies data for a particular data point.
+ class NumVal < StrVal
+
+ # A string representing the format code to apply.
+ # For more information see see the SpreadsheetML numFmt element's (ยง18.8.30) formatCode attribute.
+ # @return [String]
+ attr_reader :format_code
+
+ # creates a new NumVal object
+ # @option options [String] formatCode
+ # @option options [Integer] v
+ def initialize(options={})
+ @format_code = "General"
+ super(options)
+ end
+
+ # @see format_code
+ def format_code=(v)
+ Axlsx::validate_string(v)
+ @format_code = v
+ end
+
+ # 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 << '</c:v></c:pt>'
+ end
+ end
+end