dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersPhagu Mahato
Rakesh Chaubey
srirama
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

Display multiple datatable in single excel sheet asp.net


Posted Date: 14 Jun 2012      Posted By:: Rajasekar.K     Member Level: Silver    Member Rank: 419     Points: 4   Responses: 2



Hi ALL,



I want to display multiple datatable in single excel sheet asp.net

($sheet1)

Like,


1.First table with Header and Rows & Cols Of correspanding table.

2. second table with Header and Rows & Cols Of correspanding table.


Like wise i want to view,

Not like ,

Sheet1- For First Table

Sheet2- For Second Table

Both Table in single work sheet...

Sheet1 - First table & Second Table





Ragards
Rajasekar.K
9710638424





Responses

#675591    Author: Ajesh Madhukar Dalvi      Member Level: Silver      Member Rank: 760     Date: 15/Jun/2012   Rating: 2 out of 52 out of 5     Points: 4

string attachment = "attachment; filename=Test.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/vnd.ms-excel";
string tab = "";
foreach(DataTable dt in ds.Tables)
{
foreach (DataColumn dc in dt.Columns)
{
Response.Write(tab + dc.ColumnName);
tab = "\t";
}
Response.Write("\n");
int i;
foreach (DataRow dr in dt.Rows)
{
tab = "";
for (i = 0; i < dt.Columns.Count; i++)
{
Response.Write(tab + dr[i].ToString());
tab = "\t";
}
Response.Write("\n");
}
Response.Write("\n");
}
Response.End();



 
#677250    Author: Rajasekar.K      Member Level: Silver      Member Rank: 419     Date: 25/Jun/2012   Rating: 2 out of 52 out of 5     Points: 1

Thanks for replay ...

i got it...



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : What programming used ?
Previous : Restrict the folder access from being access
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.