class RubyXL::Stylesheet

www.datypic.com/sc/ooxml/e-ssml_styleSheet.html

Constants

CONTENT_TYPE
REL_TYPE

Public Class Methods

default() click to toggle source
# File lib/rubyXL/objects/stylesheet.rb, line 194
def self.default
  self.new(:fonts          => RubyXL::Fonts.default,
           :fills          => RubyXL::Fills.default,
           :borders        => RubyXL::Borders.default,
           :cell_xfs       => RubyXL::CellXFs.default,
           :cell_styles    => RubyXL::CellStyles.default,
           :cell_style_xfs => RubyXL::CellStyleXFs.default)
end
new(*args) click to toggle source
Calls superclass method RubyXL::OOXMLObjectInstanceMethods.new
# File lib/rubyXL/objects/stylesheet.rb, line 185
def initialize(*args)
  super
  @format_hash = nil
end

Public Instance Methods

get_number_format_by_id(format_id) click to toggle source
# File lib/rubyXL/objects/stylesheet.rb, line 203
def get_number_format_by_id(format_id)
  @format_hash ||= {}

  if @format_hash[format_id].nil? then
    @format_hash[format_id] = NumberFormats::DEFAULT_NUMBER_FORMATS.find_by_format_id(format_id) ||
                                (number_formats && number_formats.find_by_format_id(format_id))
  end

  @format_hash[format_id]
end
register_number_format(format_code) click to toggle source
# File lib/rubyXL/objects/stylesheet.rb, line 214
def register_number_format(format_code)
  self.number_formats ||= RubyXL::NumberFormats.new

  max_fmt_id = 163

  (NumberFormats::DEFAULT_NUMBER_FORMATS + number_formats).each { |fmt|
    return fmt.num_fmt_id if fmt.format_code == format_code
    max_fmt_id = fmt.num_fmt_id if fmt.num_fmt_id > max_fmt_id
  }

  max_fmt_id += 1
  number_formats << RubyXL::NumberFormat.new(:num_fmt_id => max_fmt_id, :format_code => format_code)

  return max_fmt_id
end
xlsx_path() click to toggle source
# File lib/rubyXL/objects/stylesheet.rb, line 190
def xlsx_path
  ROOT.join('xl', 'styles.xml')
end