Loading .xls file from a dataset.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

greetings people,

has anyone tried to load an excel file from a dataset? meaning the source of the .xls file comes from the dataset?
 
I use a DataTable, Bind it to a DataGrid but before that I set the
Response.ContextType. So the client views is in the native application
like Excel etc

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Here is the code

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
'Populate the dataTable/DataSet Here
dgFGI.DataSource = dtDataTable
dgFGI.DataBind()

I used the DataGrid 'cos I needed some nice formatting to be done.

If you need to let the users download the file then add
Response.AddHeader("content-disposition", "attachment; filename=" &
strFileName)

HTH

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top