molten-trunk/molten5_withgrid/vendor/plugins/excel/lib/excel.rb
# renders an Excel worksheet.
# Paramters:
#
# * sheetname is the name for the worksheet
# * objectType is a string for the model type that you're exporting.  For example: if you have a collection of Author objects, "author" would be your type.
# * objects is a collection of ActiveRecord objects

renders an Excel worksheet.
Paramters.

sheetname is the name for the worksheet
objectType is a string for the model type that you're exporting.  For example: if you have a collection of Author objects, "author" would be your type.
objects is a collection of ActiveRecord objects
renders an Excel worksheet . Paramters . sheetname is the name for the worksheet objectType is a string for the model type that you ' re exporting . For example : if you have a collection of Author objects " author " would be your type . objects is a collection of ActiveRecord objects
def worksheet (sheetname, objectType,objects)
	      buffer =""
	      xm = Builder::XmlMarkup.new(buffer) 
	      type = ActiveRecord::Base.const_get(objectType.classify)
	            xm.Worksheet 'ss:Name' => sheetname do
    	            xm.Table do
    	              xm.Row do
    	                for column in type.columns do
    	                  xm.Cell do
    	                    xm.Data column.human_name, 'ss:Type' => 'String'
    	                  end
    	                end
    	              end
    	              for record in objects
    	                xm.Row do
    	                  for column in type.columns do
    	                    xm.Cell do
    	                     xm.Data record.send(column.name), 'ss:Type' => 'String'
    	                    end
    	                  end
    	                end
    	              end 
    	            end 
	          end 
	      return xm.target!  
	  end
def worksheet ( sheetname , objectType , objects ) buffer = "" xm = Builder :: XmlMarkup . new ( buffer ) type = ActiveRecord :: Base . const_get ( objectType . classify ) xm . Worksheet 'ss:Name' => sheetname do xm . Table do xm . Row do for column in type . columns do xm . Cell do xm . Data column . human_name , 'ss:Type' => 'String' end end end for record in objects xm . Row do for column in type . columns do xm . Cell do xm . Data record . send ( column . name ) , 'ss:Type' => 'String' end end end end end end return xm . target! end
renders an Excel worksheet.
renders an Excel worksheet .
# stream to the text buffer
 # Header
 # Rows
 # for
 # table
 #worksheet
 # retrieves the buffer

sheetname
objectType
objects