473,396 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datagrid to Excel

1
I am trying to export a datagrid to Excel. Via web help, I'm 90% there. My
only problem is that I would like to remove one column from the export. I've been successful at removing the data portion of the column, but I can't get rid of the heading. Any help would be appreciated.
Jun 5 '06 #1
4 1667
hi thr,i can help u this extent that you can remove the data waht eveer in column but even i am unable to completely remove column.try this or if you got any idea please forward to me also.but this is for the fields like buttonfields or linkfields.

private void PrepareGridViewForExport(Control gv)
{

Button lb = new Button();

Literal l = new Literal();

string name = String.Empty;

for (int i = 0; i < gv.Controls.Count; i++)
{

if (gv.Controls[i].GetType() == typeof(Button))
{

l.Text = (gv.Controls[i] as Button).Text;

gv.Controls.Remove(gv.Controls[i]);

}
else
if (gv.Controls[i].HasControls())
{

PrepareGridViewForExport(gv.Controls[i]);

}
}




I am trying to export a datagrid to Excel. Via web help, I'm 90% there. My
only problem is that I would like to remove one column from the export. I've been successful at removing the data portion of the column, but I can't get rid of the heading. Any help would be appreciated.
Sep 11 '07 #2
r035198x
13,262 8TB
Again moved to .NET forum.
And guys let's make sure we all use code tags when posting code in the forums.
Sep 11 '07 #3
But how do you export it at first place to Excel??

I tried all the methods (codings) available online and none worked since I can't refrence to the PIA's (Interop) related to Microsoft Office.

Is there any other way around it?

Thanks,
Sep 11 '07 #4
Shashi Sadasivan
1,435 Expert 1GB
Please see the thread,
This question was asked before
http://www.thescripts.com/forum/thread378185.html

Hope this also deletes the header

cheers
Sep 11 '07 #5

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

Similar topics

1
by: Ugo | last post by:
Hi, I am having a problem exporting a Datagrid to excel in asp.net. For some reason I am getting a blank excel page. I set up in IIS the Mime for ..xls. My code is below any help would be...
3
by: Syd | last post by:
Hi all, Is there a way to get data from a datagrid and send to an excel table?And if it is possible how can arranged the excel table... Thanks
2
by: Steve Chatham | last post by:
I use the following code: Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged Dim sFile As String =...
1
by: Ed Chiu | last post by:
Hi, I copied the following codes from Internet to export datagrid to Excel, it works with datagrid not supporting sorting or paging. Response.ContentType = "application/vnd.ms-excel"...
2
by: TM | last post by:
I have an Excel sheet where I setup my needed formatting, page settings, ect, and would like to take my data from a datagrid and paste it into the excel file and print the excel file. Any idea...
5
by: Dave | last post by:
In a VB.NET application, I have a datagrid that I export to an Excel spreadsheet like this: ' Set the content type to Excel Response.ContentType = "application/vnd.ms-excel" Dim tw As New...
1
by: steve | last post by:
Hi, I have generated a datagrid with the following columns: | Date-Time | Station ID | Parameter1 | .... | Parameter 2| I would like to: Create an Excel file and preferably give the user...
4
by: Frank | last post by:
Hello All, I ham using VS.NET 2003. Have followed instructions from http://gridviewguy.com/ArticleDetails.aspx?articleID=26 along with several other articles to no avail. I am pulling my hair...
0
by: letsgetsilly | last post by:
I am populating a datagrid and outputting it to excel. Everything worked well last night, but today excel only displays the content in font color white, which is impossible to see. The data is all...
6
by: slinky | last post by:
I found the following code to transfer datagrid data to an Excel file. Is this written in C#?... I'm a vb.netter. I'm just not sure where to place the code to experiment on it. Should I place it in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.