Solved

Specify paper orientation and page size in Excel from ASP

Posted on 2007-11-20
8
1,470 Views
Last Modified: 2012-05-05
I am creating an Excel page from ASP, using this line:

<% Response.ContentType = "application/vnd.ms-excel" %>

The rest of the page is HTML (created via ASP).

Is there any way I can tell the client that the Excel page-setup should be Landscape and using Legal Paper?  How about the "fit to page" option?  

Thanks!
0
Comment
Question by:quiTech
  • 4
  • 3
8 Comments
 
LVL 9

Expert Comment

by:CCongdon
ID: 20322050
You might try this CSS for the page. I'm not 100% sure what the commands for fit to page or page size are. However, you might just simply try adding width: 14in height: 8.5in to the @page for paper size. You might also poke around and look for the Microsoft Office XML reference. That might list out the mso's that are available.

@page
{
mso-page-orientation:landscape;
}
0
 
LVL 9

Accepted Solution

by:
CCongdon earned 500 total points
ID: 20322084
OK, looking a little further, this *should* be how you set page size of legal with a landscape orientaiton.


@page
{
size:14.0in 8.5in;
mso-page-orientation:landscape;
}
0
 

Author Comment

by:quiTech
ID: 20576537
thanks!
0
 

Expert Comment

by:paragp
ID: 20743621
does this solution work for IE?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:CCongdon
ID: 20743688
Yes and no. It is for Excel. Now, since IE can load Excel's DLLs and view Excel files, yes this works for IE insamuch that IE is just a shell for Excel when viewing the .xls stream from the web server.
0
 

Expert Comment

by:paragp
ID: 20743746
well I am actually doing an export to excel. So I have a datagrid on an aspx page which I export to excel.
I tried the above mentioned way but it does not seem to work. The excel spreadsheet just open up in portrait format.
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 20743784
Are you using Excel 2007 by any chance? I'm going to guess this won't work for the newest Excel since MS changed a lot in the new Office.
0
 

Expert Comment

by:paragp
ID: 20743799
no i am using excel 2002
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Reading Date Settings from Server 6 49
Syntax Help on SP 4 52
ASP Syntax for IF statement 21 51
Dreamweaver server behavior gone 6 73
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now