# File lib/spreadsheet/format.rb, line 26
   def initialize(args={}, xf_index=0)
      defaults = {}

      defaults.update(:color     => 0x7FFF, :bold   => 0x0190)
      defaults.update(:fg_color  => 0x40, :pattern  => 0,  :size => 10)
      defaults.update(:bg_color  => 0x41, :rotation => 0,  :font => "Arial")
      defaults.update(:underline => 0,    :italic   => 0,  :top  => 0)
      defaults.update(:bottom    => 0,    :right    => 0,  :left => 0)

      defaults.update(:font_index     => 0, :font_family  => 0)
      defaults.update(:font_strikeout => 0, :font_script  => 0)
      defaults.update(:font_outline   => 0, :left_color   => 0)
      defaults.update(:font_charset   => 0, :right_color  => 0)
      defaults.update(:font_shadow    => 0, :top_color    => 0x40)
      defaults.update(:text_v_align   => 2, :bottom_color => 0x40)
      defaults.update(:text_h_align   => 0, :num_format   => 0)
      defaults.update(:text_justlast  => 0, :text_wrap    => 0)

      ## convenience methods
      defaults.update(:border => 0, :align => 'left')

      ########################################################################
      # We must manually create accessors for these so that they can handle
      # both 0/1 and true/false.
      ########################################################################
      no_acc = [:bold,:italic,:underline,:strikeout,:text_wrap,:text_justlast]
      no_acc.push(:fg_color,:bg_color,:color,:font_outline,:font_shadow)
      no_acc.push(:align,:border)

      args.each{|key,val|
         key = key.to_s.downcase.intern
         val = 1 if val == true
         val = 0 if val == false
         defaults.fetch(key)
         defaults.update(key=>val)
      }

      defaults.each{|key,val|
         unless no_acc.member?(key)
            self.class.send(:attr_accessor,"#{key}")
         end
         send("#{key}=",val)
      }

      @xf_index = xf_index

      yield self if block_given?
   end