Go Back   Velocity Reviews > General Computer Discussion > Software
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
Old 01-12-2008, 05:39 AM   #1
Default Save an Excel file, created from a DataGrid, programmatically..


Hi,

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....

Thanks

Tapas Mahata

Code Sample :

public void ExportToSpreadsheet(DataGrid dg, string name)
{

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


}


tapasmahata
tapasmahata is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading 24,000 rows into C# .net Datagrid Kagu Software 0 03-10-2009 06:51 PM
ASP.NET VB Using ItemDataBound to create textbox in datagrid rows. smi59550 General Help Related Topics 0 01-18-2008 07:42 PM
How to run a Excel Macro from the Java application? Kiranu General Help Related Topics 0 09-12-2007 02:11 PM
Uploading Excel file into sql table shalim Software 1 10-31-2006 08:57 AM
Disable ASP Button in a Datagrid ChrisClayko General Help Related Topics 0 08-02-2006 03:08 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46