Sha256: 90dfd19516374be17816ab67a3839bf63d66b618583c89cc2f04ad6679420bd3

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

# 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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/drawing/num_val.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/drawing/num_val.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/drawing/num_val.rb
caxlsx-4.1.0 lib/axlsx/drawing/num_val.rb
caxlsx-4.0.0 lib/axlsx/drawing/num_val.rb