473,569 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to export datagridview to excel?

10 New Member
Hi, anyone know how can i export the information in the datagridview to an Excel file?

i understand that the crystal report tool has such a build in function for importing to pdf or execl, then how can i convert the information in datagrid to a crystral report?
May 3 '07 #1
7 14581
dip_developer
648 Recognized Expert Contributor
Hi, anyone know how can i export the information in the datagridview to an Excel file?

i understand that the crystal report tool has such a build in function for importing to pdf or execl, then how can i convert the information in datagrid to a crystral report?
Dont you know how to create a Crystal report......by which means data are binded to report......Let us know how much do u know about crystal report....other wise you have to learn about Push and Pull methods of crystal report.......wh ich cant be explained in short...
May 3 '07 #2
ashasprabhu
52 New Member
hai,
below is the link to Export ASP.NET DataGrid to Excel
link
and hope this helps you
May 3 '07 #3
saqibahmed84
1 New Member
i think this can help you
protected void Exl_Click(objec t sender, EventArgs e)
{
Exl.Visible = false;
Wrd.Visible = false;
TextBox1.Visibl e = false;
srh.Visible = false;//GridView2.Font. Size = 15;
//GridView1.Pager Settings.Visibl e = true;
//Image2.Visible = true;
Response.Clear( );

Response.AddHea der("content-disposition", "attachment;fil ename=FileName. xls");

Response.Charse t = "";

// If you want the option to open the Excel file without saving than

// comment out the line below

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);

Response.Conten tType = "applicatio n/vnd.xls";

System.IO.Strin gWriter stringWrite = new System.IO.Strin gWriter();

System.Web.UI.H tmlTextWriter htmlWrite =
new HtmlTextWriter( stringWrite);

// turn off paging
GridView2.Allow Paging = false;

DataSet myDAtaset1 = dataset1();



GridView2.DataS ource = myDAtaset1;
GridView2.DataB ind();



GridView2.Rende rControl(htmlWr ite);

Response.Write( stringWrite.ToS tring());

Response.End();
Response.Redire ct(@"Default.as px");


}
May 3 '07 #4
ashasprabhu
52 New Member
you can try this link
http://www.thescripts. com/forum/thread637955.ht ml
May 3 '07 #5
RafaulWolf
10 New Member
Dont you know how to create a Crystal report......by which means data are binded to report......Let us know how much do u know about crystal report....other wise you have to learn about Push and Pull methods of crystal report.......wh ich cant be explained in short...

I'm just a beginner in VB and i'm doing a project for my attractment company. Basically, my understanding of crystal report is that i can drag the Report viewer from the toolbox and create a new report by binding it to my data source.BUT this will show all the data in the database

However, my application require me to export the excat information from the datagridview as i have insert Sql statement to query my seach result.

Do you know of link to example in VB.net or VB. Cos the other rely i received are all examples in Visual C# which i'm not familiar with.
May 8 '07 #6
aalexandrov
3 New Member
hai,
below is the link to Export ASP.NET DataGrid to Excel
link
and hope this helps you
Hi folks - the post is usefull. If you want to export an DataGridView control's data and visualization to excel or html you can use DataGridView Extension ...
see http://www.completit.c om/Products/DGVE/Overview.aspx
it is free. Also it gives an additional functionality of the basic control for searching for text, theme management and many more. Hope it will help you.
Aug 20 '07 #7
aalexandrov
3 New Member
There is a free component doing exporting to excel, html and pdf ... see http://www.completit.c om/Products/DGVE/Overview.aspx for more information ... i thing the component is great and the most important - it's free.

Hi, anyone know how can i export the information in the datagridview to an Excel file?

i understand that the crystal report tool has such a build in function for importing to pdf or execl, then how can i convert the information in datagrid to a crystral report?
Nov 30 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5016
by: Matt | last post by:
I have an ASP page that calls ASP routines that I created that execute a database query and return the results to a recordset. I then iterate through the recordset and display the data in a table. Before I iterate through the recordset I instruct the browser that the content type is Excel using the following line: (Response.ContentType =...
13
13193
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=ABC.xls") HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.End() However when the user tries to...
0
2313
by: artteam | last post by:
Hi All, I try to export the table in DataGridView control on my form to MS excel with the following code. private void fnExtractToExcel() { Microsoft.Office.Interop.Excel.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass(); excel.Application.Workbooks.Add(true) ; ...
2
4971
by: Mike Wilson | last post by:
Dear all, I'm sure someone has already done this, so as not to wish to re-invent the wheel - and Google not turning up anything I can use, does anyone have a suitable function into which I can pass a DataGridView - and have all the columns and rows parsed and an Excel Workbook created with the DataGridView contents and column headers...
5
34044
by: Mike Wilson | last post by:
Hello all, I'd like to export a DataGridView to Excel. I am using .NET 2.0 and VB.NET. But I don't know if the user has Excel on their machines, so can't use COM Excel object. Any ideas please? How is an Excel file put together? Many thanks,
0
1452
by: nitin005 | last post by:
I have to export the data present in the datagridview to Microsoft Excel. It is a window application using c#. Does anyone know how to do it. Please help. Thanks
19
11215
by: cj2 | last post by:
#1 Is there a quick way to export a datatable to an excel file? Or delimited file? #2 Where is the appropriate Microsoft monitored group to ask about writing reports in SQL Reporting services or SQL Server Business Intelligence Development Studio or whatever it's called?
2
2854
by: ISATownsME | last post by:
Hello, I have a program that loads a datagridview from excel to visual studio. Can anyone tell me how to export the cell values of the datagridview to my access database?
2
2348
by: Narz1986 | last post by:
hi...i m trying to export data from the datagrid to excel...here is my code HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + exportfile.FileName + ""); HttpContext.Current.Response.Charset = "";...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.