def to_export(format, options={})
      export_data = get_export_data(options)
      # remove the auto-headers from the export_data (i.e. the first row)
      auto_headers = export_data.shift
      # Use auto-headers unless given alternates or false (use no headers)
      options[:headers] = auto_headers unless !options[:headers].blank? || options[:headers] === false
      export_string = create_report(format, export_data, :headers => options[:headers])
      return export_string
    end
def to_export(format, options={})
      export_data = get_export_data(options)
      # remove the auto-headers from the export_data (i.e. the first row)
      auto_headers = export_data.shift
      # Use auto-headers unless given alternates or false (use no headers)
      options[:headers] = auto_headers unless !options[:headers].blank? || options[:headers] === false
      export_string = create_report(format, export_data, :headers => options[:headers])
      return export_string
    end
<tt>to_export</tt> exports records from a class. It can be called
 directly on an ActiveRecord class, but it can also be called on an ActiveRelation scope.
 It takes two arguments: a format (required) and a hash of options (optional).

 The options include:
 * :only and :except - specify columns or methods to export
 * :scopes - specify scopes to be called on the class before exporting
 * find options - for Rails 2.3 and earlier compatibility, standard find options
     are supported (:conditions, :order, :limit, :offset, etc.). These will be deprecated
     and removed in future versions.
 * :headers - supply an array of custom headers for the columns of exported attributes,
     the sizes of the header array and the exported columns must be equal.

 Examples:

   User.to_export(:xml, :only => [:first_name, :last_name, :username],
      :order => 'users.last_name ASC')

   User.visible.sorted_by_username.to_export('csv',
      :only => [:first_name, :last_name, :username])