?
Solved

Specify paper orientation and page size in Excel from ASP

Posted on 2007-11-20
8
Medium Priority
?
1,492 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

801 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