.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Export Listview data to excel

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :WPF

How can I export listview's data to excelsheet ?
Kindly help
- Thanks

View Complete Post

More Related Resource Links

Export Gridview data to Excel sheet


Hi ,

     I have a requirement where i need to export the gridview data to excel.My code export the data in excel that was fine.

But the enchancement needed now , I was exporting the 3 gridview in same excel sheet under the workbook.

Now i need to export the 3 grid view in 3 different sheet in the same workbook.

so can please tell or share the updated code in my below code ...

public void writeovrsummary()


        Response.Write("Overall Summary");
        //Response.Write("Report as of " + DateTime.Now.ToString("hh:mm ss tt"));

        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        SqlCommand com = MyConnection.CreateCommand();
        com.CommandText = "useroverall_Report";
        SqlParameter[] par = new SqlParameter[1];
        par[0] = new

String Data missing start from "+" When Export Data To Excel Using Gridview

Hi,I am exporting data from gridview to excel file.My problem is that for all the string which contain "+", the rest of data begining from it is missing in excel file.For example: PWE-WER+78, when exported it will become PWE-WER.Below is my code.                Response.ClearContent() Response.Buffer = True Response.AddHeader("Content-Disposition", "attachment;filename=" & "ExportedExcel.xls") Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" lobjStringWriter = New StringWriter lobjHtmlWriter = New HtmlTextWriter(lobjStringWriter) dgdResult.RenderControl(lobjHtmlWriter) Response.Write(lobjStringWriter.ToString()) Response.End() I  have search through online but no solution.Does anyone has idea on this?

Export Data From ListBox To Excel

I'm Using C#.NET Is there any examples of how to export data from a ListBox Control to an Excel Spreadsheet in C#.NET? Currently the list box only has 1 column of about 20 records in it.

How to export data from SQL 2008 R2 to excel 2010

Hi, I am using microsoft sql 2008 R2 express server and I have window 7 64 bit and office 2010.  I would like to export data form sql to excel using a query in sql.  I tried a few examples I found on the web, but they don't work.  Please help. Thanks

Export Data to Excel Based on Date Range

I have data from multiple tables that I would like to display in a gridview via a stored procedure.  I need to select the data based on a date range and display it.  Once displayed I need to include a button that would allow the user to export the gridview data to an excel spreadsheet.  Does anyone have an out of the box solution or know of a tutorial I can use to accomplish this feat?  I am currently using 2.0 for this project. I am newish to .net. Thanks in advance. Here is my stored procedure that calls the data from multiple tables.USE [DATABASENAME] GO /****** Object: StoredProcedure [dbo].[GetUsersAll] Script Date: 09/03/2010 08:20:23 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[GetUsersAll] AS SELECT aspnet_Users.UserName, aspnet_Membership.Email, Team.Name, MemberTeamRole.InsertDate, MemberTeamRole.ManagerApprovedDate, MemberTeamRole.RegistrarApprovedDate, MemberTeamRole.RoleName, MemberInfo.firstname, MemberInfo.lastname FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN MemberInfo ON aspnet_Users.UserId = MemberInfo.memberid LEFT OUTER JOIN MemberTeamRole ON aspnet_Membership.UserId = MemberTeamRole

Unable to export data to an excel file in grid format!!!

I'm exporting data to an excel sheet from the ojects list. The data is exporting to excel sheet well, but I'm unable to see the grid format for the data. The data is looking with out the rows and columns lines. I think I'm missing to set some property or somethnig ehwn exporting.   Any help would be really appriciated.

Create dynamic dropdown list when we export data to excel using SSRS.


Hi All,

I have assigned a work to create a report, that should render in excel with dropdown list. i.e. report should contain a input parameter as a table names, when user selects the table name, report should show only the field names of the selected table. Some of the field name have look up values that values should be displayed as dropdown when we export to excel.

Can any one have any idea how to proceed with this report?



Data Export to Excel file using "Response.ContentType = "application/csv"


I have developed code to export data to Excel using Response.ContentType = "application/csv". The output Data Excel file loaded with 65536 Rows only, this file is not loaded completely since the limitation of excel is 65536. My Recordcount is more than 700000.

Please any one let me know how I can Export Data to Excel file over than 65536 Rows.

Email: thamaraiselvann@ayso.org

Import and Export List data in excel sheet


Hi ,

I need to import based selective data from excel sheet and export data from sharepoint list, I'm new in Sharepoint.

can anybody guide me? What all possible ways are there and which would be the best.



export the gridview data to excel problem



i am using master page and child pages in the child page

i want to export the gridview data to excel sheet for this i use the following code


        Response.AddHeader("content-disposition", "attachment; filename=shedules.xls");

        Response.ContentType = "application/excel";

        StringWriter sw = new StringWriter();

        HtmlTextWriter htw = new HtmlTextWriter(sw);




but in the gridShedules.RenderControl(htw) i got the following error but the form tag with  runat= server is already in the master page how to solve this issue

error:Control 'ctl00_ContentPlaceHolder1_grdshedules' of type 'GridView' must be placed inside a form tag with runat=server.

Import and Export Data (32-bit) Wizard to Dump Data to Excel


I am trying to export some data from a simple three-column table on my SQL 2008 R2 instance to Excel 2007 (also happens in Excel 2003). Our data has a lot of foreign (Hebrew) characters on it and although the copy works ok, the data as it appears in Excel is gibberish.

The source table in SQL contains three columns:

  • smallint - numbers
  • varchar(30) - hebrew text
  • varchar(50) - hebrew text
  • varchar(15) - hebrew text

When I fire up the Import-Export wizard I see the following: http://img524.imageshack.us/img524/1830/sqltable.png. When I click on the yellow warning for a conversion problem, I see this: http://img375.imageshack.us/img375/4255/conversion.png.

Do I need to modify the core SQL or change the data type? I already tried modifying the destination datatype to be varchar instead of LongText but that didn't help.

Any assistance would be fantastic!


SSIS 2005 - Export Data into an Excel 2007 Table


Hello !

I have an excel file (xlsx) containing a table :

Excel Table

Once I launched my ssis task (successfully) to insert data in it, it is actually append after the table :

Excel Table after the SSIS task

So I am looking for a way to insert into the table and expand it with the data. I hope someone could help me.

Thank you !

Export SSRS report to excel with data of pie chart



I am new to SSRS. I have a report with a pie chart . When I export the report in excel format, pie chart is displayed as picture. I want it to be displayed as editable pie chart with data. 

The requirement is, if user want to change the data in excel sheet after exporting, changes should reflect in pie chart of that excel sheet.

Please suggest me the way of achieving it.


Trying to use xp command shell to export data out to Excel


I am trying to use xp_cmdshell, which I have used on th ejob all the time in this way, but for some reason is not working on my computer. Below is the error mesage that I am getting, but I am not understanding what it is telling me or what to do about it. I am using SQL Server Express 2008, and my machine is Windows 64 bit processing, is case this has something to do with it. I have enabled TCPIP and Pipes.

If you have any ideas what I can do to get this work I would appreaciate it.
Thank you

SQLState = 08001, NativeError = 126
Error = [Microsoft][SQL Native Client]VIA Provider: The specified module could not be found.
SQLState = 08001, NativeError = 126
Error = [Microsoft][SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connecti
SQLState = S1T00, NativeError = 0
Error = [Microsoft][SQL Native Client]Login timeout expired
NULLMy code:

my code:
This is using the the Northwind database

exec Master..xp_cmdshell 'bcp " Select * from dbo.Employees " queryout C:\TestEd.xls -T -c'


Export Data to Excel



Just starting to convert my large Access VBA application to asp.net vb. I have done classic asp in the past but been doing VBA for last 3 years.

Just trying to get pointed in the right direction. I am looking to export data to an excel file. I have searched a bit and got my page to export a data table to a tab delimted file and also used the HtmlTextWriter to take the data from a gridview. However I am trying to find something with a little more control I think without losing me : ). I would like to be able to export directly to excel with out displaying it on the page and also have a couple different datasets export to the same excel file with multiple worksheets.



SQL Data export to Excel problem with Microsoft.JET.OLEDB.4.0



I got a problem with datatransfer via Microsoft.JET.OLEDB.4.0.

As long as I use the following statement it's working but only 255 Characters will be transferred to Excel.

INSERT INTO OPENROWSET('Microsoft.JET.OLEDB.4.0','Excel 8.0;HDR=YES;Database=C:\xxxxxx.XLS','SELECT F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12 FROM [Tabelle1$]')SELECT TOP 65000 [Störungsnummer], CONVERT(varchar(50),[Annahmedatum],120) AS [Annahmedatum], CAST([Teilnehmernummer A] AS VARCHAR(255)) AS [Teilnehmernummer A], CAST([Annahmeperson] AS VARCHAR(255)) AS [Annahmeperson], [Annahmeplatz], CAST([Störungscode] AS VARCHAR(255)) AS [Störungscode], [Störungscode Nummer], CAST([Störungsmeldungstext] AS VARCHAR(255)) AS [Störungsmeldungstext], CAST([Wartungsvertrag] AS VARCHAR(255)) AS [Wartungsvertrag], CAST([SOSegment] AS VARCHAR(255)) AS [SOSegment], CAST([Kundensegment] AS VARCHAR(255)) AS [Kundensegment], CAST([TDV] AS VARCHAR(255)) AS [TDV] FROM [yyyyyyyyyyyy].

As soon as I try to extend the varchar over the limit of 255 the following error occurs:

String or binary data would be truncated. Export ERROR: XLS - Export in work.. (Microsoft.JET.OLEDB) The statement has been terminated.

Export SQL Data to Microsoft Excel (using Visual Studio 2008, c#) in asp.net

I have list of tables in my database.

how to retrieve list of tables including data into databound control and

how to export the tables data to excelsheet individually.. 

a)Gets the list of tables within the database 
b)Gets data 
c)Exports the data to excel worksheets (there are 2 methods defined (1) range method (2) cell by cell 
d.) Saves the excel sheet

plz provide the code for above requirements as soon as possible

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend