Solved

Specify paper orientation and page size in Excel from ASP

Posted on 2007-11-20
8
1,486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:paragp
ID: 20743621
does this solution work for IE?
0
 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Display first 3 lines of text from database field, vbscript asp 4 62
Button to go back 3 39
VBScript on Html 15 58
Set time on Session (ASP) 14 31
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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