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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Have to open and set the range in excel sheet through C#.NET codings

Posted By: Savi3     Posted Date: September 04, 2008    Points:2   Category :C#
Any one help me plz,,,

Need to open an excel sheet for generating report in c#.net.

Tell me the steps plz..

Advance thanks

Responses
Author: Amit Mehra             
Posted Date: September 04, 2008     Points: 5   

Please refer this article this will be helpful to you

http://www.eggheadcafe.com/articles/20021012.asp

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Shashi Ray             
Posted Date: September 04, 2008     Points: 5   

use this code

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=\"school_report_1.xls\"");
Response.ContentType = "application/Microsoft Office Excel";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.Charset = "";
EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
tab1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
}

Shashi Kant Ray
Author: Athira Sreejith             
Posted Date: March 31, 2009     Points: 5   

Hi..

Filefullpath=server.Mappath("aa.xls");
OpenFiles(Filefullpath);

using System.IO;
private void OpenFiles(string Filepath)
{
FileInfo file = new System.IO.FileInfo(Filepath);
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.WriteFile(Filepath);
}



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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