Sha256: 68b734f21429a68f3cae74f25c766226260c80591963b35a94e5445c102e8fdf

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

# -*- coding: utf-8 -*-
module Axlsx

  #This class specifies data for a particular data point. It is used for both numCache and numLit object
  class NumData < StrData

    def self.allowed_tag_names
      [:numCache, :numLit]
    end

    # 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 [Array] :data
    # @option options [Array] :data
    # @option options [String] :tag_name
    # @see StrData
    def initialize(options={})
      @tag_prefix = :num
      @type = NumVal
      @format_code = "General"
      @pt = SimpleTypedList.new @type
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end

    end

    # @see format_code
    def format_code=(v='General')
      Axlsx::validate_string(v)
      @format_code = v
    end

    # serialize the object
    def to_xml_string(idx, str = "")
      str << '<c:' << tag_name.to_s << '>'
      str << '<c:formatCode>' << format_code.to_s << '</c:formatCode>'
      str << '<c:ptCount val="' << @pt.size.to_s << '"/>'
      pt.each_with_index do |num_val, index|
        num_val.to_xml_string index, str
      end
      str << '</c:' << tag_name.to_s << '>'
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
axlsx-1.1.7 lib/axlsx/drawing/num_data.rb~
axlsx-1.1.6 lib/axlsx/drawing/num_data.rb~
axlsx-1.1.5 lib/axlsx/drawing/num_data.rb~
axlsx-1.1.4 lib/axlsx/drawing/num_data.rb~