blob: 862d22aea95c16e7c3375f06469308d8f745ade7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# frozen_string_literal: true
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)
unless v.to_s.empty?
str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>'
end
end
end
end
|