Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP HTML Excel table export
Hello guy! good DAY!
 
Im having a problem in the Page setup when i export my table in excel. I need to automatically assign the paper layout to landscape when i click my export button.
 
I have no problem in exprting my html table to excel i need just to assign may paper to a landscape form when i hit the export. does anyone know the code how to do it? thanks guys!
 
Thank youvery much in advnace. im looking forward to you answers. thank you, God bless and have a great day forward. Smile | :)
Posted 11-Mar-12 19:21pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Ariel Riyo at 12-Mar-12 1:36am
   
hey thanks for your response. but im not having a problem anymore in exporting my html table to excel i just want to know the codes or resource on how to automtically assign the page layout of excel to landscape whenever i click my export button. thankyou. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Export HTML table to Excel with grid lines[^] and the discussion here[^] might help you out.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

send your HTML table id to the parameter 'ctl'
 

public void exportGridToExcel(Control ctl)
{
string attachment = "attachment; filename=etrack_excel_export.xls";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.ContentType = "application/ms-excel";
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
 
ctl.RenderControl(htextw);
HttpContext.Current.Response.Write(stw.ToString());
HttpContext.Current.Response.End();
}
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Richard MacCutchan 335
1 OriginalGriff 330
2 Sergey Alexandrovich Kryukov 259
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 5,969
1 OriginalGriff 5,005
2 CPallini 2,473
3 Richard MacCutchan 1,547
4 Abhinav S 1,507


Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 12 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100