Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on 

Need to change the type of document in excel using C# to Landscape format.

I have to change the type  of document in excel using C# to Landscape format.

Any help would be great.
.NET ProgrammingMicrosoft ExcelC#

Avatar of undefined
Last Comment
mathieu_cupryk
Avatar of irudyk
irudyk
Flag of Canada image

How about trying something like:
Excel._Worksheet oSheet;
oSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape;
 
Avatar of mathieu_cupryk

ASKER

What I need to do is setup the ledger

excelWorkSheet.PageSetup.PaperSize = Excel.XlPaperSize.xlPaper11x17;

This bombs on me.
Avatar of irudyk
irudyk
Flag of Canada image

Try using:
excelWorkSheet.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperLedger;
Avatar of mathieu_cupryk

ASKER

still get an error.
see attached image.

7-21-2008-7-51-00-AM.gif
Avatar of irudyk
irudyk
Flag of Canada image

You are likely getting this error if the default printer you are attached to does not support Ledger size paper.  Try changing your defualt printer to on that supports ledger size paper and retry to see if you get the error again.
ASKER CERTIFIED SOLUTION
Avatar of irudyk
irudyk
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of mathieu_cupryk

ASKER

First thing it should be set to legal then to fit on 1 page by 2 tall.
It needs a page break as well but crashes.

Avatar of irudyk
irudyk
Flag of Canada image

It needs to be set to "legal"?  Do you mean landscape (per your orignal question)?  You also list some more requirements, so for clarity, please completely outline exactly what you need done and include the portion of code your are using that is causing the errors.
Avatar of mathieu_cupryk

ASKER

I made a mistake it seems ok with the legal.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo