Link to home
Start Free TrialLog in
Avatar of chrisdtrinityphysicians
chrisdtrinityphysiciansFlag for India

asked on

Exporting asp:Repeater display contents to MS-EXCEL 2010

I am working with ASP.NET C# 3.5 web applications and the back-end is MS SQL 2008 R2. I am displaying arround 300 records in a asp:Repeater and this contains arround 10 fields. To display the records we are using the datasource, System.Collections.Generic.List<>. It is working fine.

The new requirment is, on a button click (say EXPORT button click) I need to export all the asp:Repeater contents with headings to a MS-EXCEL 2010 file. In the EXCEL SHEET I need to add dynamic images also. (i.e.) In the exel sheet on top IMAGE1, below that asp:Repeater contents and then below IMAGE2. Please give me a sample detailed code. I havn't any idea on this type of export area.

Note:- We are using the OS, Windows 7 for developement purpose and Windows Server R2 for live publish purpose. In my Windows 7 development machine I have Visual Studio 2008 and MS-Office 2010. But the live Windows Server R2 hasn't any visual studio or any ms-office. So, the code sample code should be flexible for both.
ASKER CERTIFIED SOLUTION
Avatar of Mark Franz
Mark Franz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I wanted to add 1 other link which has tons of good resources at it, http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c
 
Avatar of chrisdtrinityphysicians

ASKER

Hi,
   http://www.leniel.net/2009/07/creating-excel-spreadsheets-xls-xlsx-c.html  This link is my exact requirement. But by my bad luck, that example has been provided in C#.NET 4.0 Framework version and so I can't use that. I clearly mentioned, I need the solution in C#.NET 3.5 Framework version. So, can anybody give exact correct code without any errors or any compatibility errors.

Please help me...
What are you talking about?  What code samples?  The code shown on the page is said to be .NET framework 2.0.  

Are you getting compile errors?  Server-side errors?
Sorry!!! That is due to some improper download dll error. Now it is working in local development machine. I need to test in live server. I will test on Moday and let you know the status. Thanks
I created the excel import code with the help of the URLs http://www.leniel.net/2009/07/creating-excel-spreadsheets-xls-xlsx-c.html and http://npoi.codeplex.com/releases/view/19351. Everything is working fine in my local development machine and live server machine execpt a format issue. Please find the attachments.

 sample1.xlsx
 The above sample1.xlsx is the c# coding output. And this excel contains some fixed templates instead of blank cells. I want the blank normal cells only. How will I avoid the the fixed templates "Click to add data" from my c# coding?.

User generated image
Please anyone suggest some good idea.