lib/osheet/xmlss/style_cache.rb
def build_and_cache(key, styles, format)
      settings = StyleSettings.new(styles)
      @styles[key] = @xmlss_workbook.style(key) {
        settings.setting(:align) { @xmlss_workbook.alignment(settings[:align]) }
        settings.setting(:font) { @xmlss_workbook.font(settings[:font]) }
        settings.setting(:bg) { @xmlss_workbook.interior(settings[:bg]) }

        border_set = ::Osheet::Style::BORDERS.inject([]) do |set, bp|
          settings.setting(bp) { set << settings[bp] }
          set
        end
        if !border_set.empty?
          @xmlss_workbook.borders {
            border_set.each { |setting| @xmlss_workbook.border(setting) }
          }
        end

        @xmlss_workbook.number_format(format.style)
      }
    end
# build and cache an xmlss style
build and cache an xmlss style
build and cache an xmlss style
def build_and_cache(key, styles, format)
      settings = StyleSettings.new(styles)
      @styles[key] = @xmlss_workbook.style(key) {
        settings.setting(:align) { @xmlss_workbook.alignment(settings[:align]) }
        settings.setting(:font) { @xmlss_workbook.font(settings[:font]) }
        settings.setting(:bg) { @xmlss_workbook.interior(settings[:bg]) }
        border_set = ::Osheet::Style::BORDERS.inject([]) do |set, bp|
          settings.setting(bp) { set << settings[bp] }
          set
        end
        if !border_set.empty?
          @xmlss_workbook.borders {
            border_set.each { |setting| @xmlss_workbook.border(setting) }
          }
        end
        @xmlss_workbook.number_format(format.style)
      }
    end
def build_and_cache ( key , styles , format ) settings = StyleSettings . new ( styles ) @styles [ key ] = @xmlss_workbook . style ( key ) { settings . setting ( :align ) { @xmlss_workbook . alignment ( settings [ :align ] ) } settings . setting ( :font ) { @xmlss_workbook . font ( settings [ :font ] ) } settings . setting ( :bg ) { @xmlss_workbook . interior ( settings [ :bg ] ) } border_set = :: Osheet :: Style :: BORDERS . inject ( [ ] ) do | set , bp | settings . setting ( bp ) { set << settings [ bp ] } set end if ! border_set . empty? @xmlss_workbook . borders { border_set . each { | setting | @xmlss_workbook . border ( setting ) } } end @xmlss_workbook . number_format ( format . style ) } end
build and cache an xmlss style
build and cache an xmlss style
key
styles
format