Urgent - Asp.NET Datagrid export Excel - landscape Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would appreciate if some one could help me out with this problem.

I am trying to export the datagrid to an excel file in ASP.NET.
The functionality works fine.

But I would like to setup the excel file in a landscape oriented format with
predefined margins.
Aftre going through the internet, I found articles which are saying about
setting the styles for @page which should resolve the problem. But I am not
sure where should I place the style of @page. Event if I set it up for a
page, the excel file which opens, comes with its predefined margins and
orientation.

Can some body tell me -
How do add headers specific to excel landscape orientation to the Response
from ASP.NET?
If this is not possible how should I approach this problem. As I am not able
to find the exact place where my own @page style should go.

Any help would be appreciated.

Thanks,
Dinoo
 
dinoo said:
I would appreciate if some one could help me out with this problem.

I am trying to export the datagrid to an excel file in ASP.NET.
The functionality works fine.

But I would like to setup the excel file in a landscape oriented format
with
predefined margins.
Aftre going through the internet, I found articles which are saying about
setting the styles for @page which should resolve the problem. But I am
not
sure where should I place the style of @page. Event if I set it up for a
page, the excel file which opens, comes with its predefined margins and
orientation.

Can some body tell me -
How do add headers specific to excel landscape orientation to the Response
from ASP.NET?
If this is not possible how should I approach this problem. As I am not
able
to find the exact place where my own @page style should go.

Any help would be appreciated.

Thanks,
Dinoo

Not exactly what you asked for but an alternative might be to use an
excelwriter component.

Free:
http://www.carlosag.net/Tools/ExcelXmlWriter/Default.aspx

Commercial:
http://officewriter.softartisans.com/

These generate real excel files with margins etc etc.

Other options:
http://bloggingabout.net/blogs/mischa/archive/2006/05/30/12271.aspx
 
I appreciate your help Mischa,
But I would prefer not to go to any third party tools.

Thanks,
Dinoo
 
Try the second link then it has ways of doing what you want without any
third party tools.
 
The other link talk about working with Com object which may not be feasible
option on server side.

Is there any way I can select a Legal paper as default for the excel sheet
which has been rendered by ASP.NET?

dinoo
 
Back
Top