Class: Axlsx::NumVal

Inherits:
StrVal show all
Defined in:
lib/axlsx/drawing/num_val.rb

Overview

This class specifies data for a particular data point.

Instance Attribute Summary collapse

Attributes inherited from StrVal

#v

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ NumVal

creates a new NumVal object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • formatCode (String)
  • v (Integer)


15
16
17
18
# File 'lib/axlsx/drawing/num_val.rb', line 15

def initialize(options={})
  @format_code = "General"
  super(options)
end

Instance Attribute Details

#format_codeString

A string representing the format code to apply. For more information see see the SpreadsheetML numFmt element's (ยง18.8.30) formatCode attribute.

Returns:

  • (String)


10
11
12
# File 'lib/axlsx/drawing/num_val.rb', line 10

def format_code
  @format_code
end

Instance Method Details

#to_xml_string(idx, str = "") ⇒ Object

serialize the object



27
28
29
30
# File 'lib/axlsx/drawing/num_val.rb', line 27

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