Click here to Skip to main content
12,253,359 members (46,382 online)
Rate this:
 
Please Sign up or sign in to vote.
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 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  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Ariel Riyo 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. :)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 12 Mar 2012
Copyright © CodeProject, 1999-2016
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