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

Home Posts Topics Members FAQ

WTD: Simple Function to Export DataGridView to Excel

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 transposed onto the first Worksheet?

Many thanks in advance!

Mike

Apr 5 '07 #1
2 4971
On Apr 5, 6:04 pm, "Mike Wilson" <liddlefeeshSor ryNoS...@gmail. com>
wrote:
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 transposed onto the first Worksheet?

Many thanks in advance!

Mike
Check this article
http://www.codeguru.com/forum/archiv.../t-411456.html

--NA

Apr 5 '07 #2
<mn************ @gmail.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.com.. .
On Apr 5, 6:04 pm, "Mike Wilson" <liddlefeeshSor ryNoS...@gmail. com>
wrote:
>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 transposed onto the first Worksheet?

Many thanks in advance!

Mike

Check this article
http://www.codeguru.com/forum/archiv.../t-411456.html
Many thanks - helpful article.

M

Apr 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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) ; ...
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 = "";...
1
2110
by: jgabrielson | last post by:
Hello All, I have a windows application that exports data from a datagridview into excel. Now this data can change based on what a user does in the datagridview itself. An example would be out of 1,000 files the user can sort through using DataGridViewAutoFilter to search for a handful of rows, say 50 or 143 or whatever. The user then clicks...
1
2688
by: 127mohit | last post by:
Hi all, I have a simple code that exports an HTML table on an ASP page to excel. The code works fine, however if the original text in the HTML table had a particular colour, it is not exported in the same way.The resulting excel file has all text black only. Pls. suggest how to solve this problem. Any help would be greatly appreciated . ...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
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
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
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
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
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.