Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Save an Excel file, created from a DataGrid, programmatically..

Thread Tools

Save an Excel file, created from a DataGrid, programmatically..

tapasmahata tapasmahata is offline
Junior Member
Join Date: Jan 2008
Location: Kolkata
Posts: 7

I need to Save my Excel File which I created from a DataGrid to my Hard Drive(C:\) using the C#.NET codes. It can be saved by the dialog box but I don't need that....I need the prior..

SomeOne Please Help Me....


Tapas Mahata

Code Sample :

public void ExportToSpreadsheet(DataGrid dg, string name)

Response.AddHeader("content-disposition", "attachment; filename=" + name);
Response.ContentType = "application/excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
aspnet.mdf file still is created even though i created a custom provider? Sunfire ASP .Net 1 11-10-2007 04:30 AM
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
OleDbDataAdapter created in code behaves differently from one created by wizard. tom c ASP .Net 6 09-06-2006 04:46 PM
are the objects created in the stack guarranted to have been created? jimjim C++ 12 06-03-2005 12:57 PM
schemalocation entry in XML created by castor created sources? Ulf Heyder XML 0 10-16-2003 02:14 PM