Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Page layout in excel
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01426679
Message ID:
01426682
Vues:
84
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all,
>
>I create reports in excel programitically and it works excelently. However I would like to change the default print layout for one of them so that it automatically prints in landscape.
>
>oleApp = CreateObject("Excel.Application")
>OleApp.Visible = .T.
>OleApp.WorkBooks.Add
>msheet = "Sheet1"
>OleApp.Sheets(msheet).Select
>OleApp.Sheets(msheet).PrintPreview
>
>This code will open excel, create a new sheet and also attempt to do a print preview and give me the lines on the screen to show the boundries of the print page, but it defaults to portrait.
>~M

See code from <B>Re: Printing smaller</B> Thread #597168 Message #597306 to change the PageSetup in Excel.

E.g.
*-- set pageSetup properties
WITH oXLS.Application.ActiveSheet.PageSetup
   *.LeftHeader  = ""
   .CenterHeader = lcTableName 
   *.RightHeader = ""
   .LeftFooter   = icMessageBoxCaption 
   .CenterFooter = "&P of &N"
   .RightFooter  = "&D - &T"
   .LeftMargin   = cnCentimetersToPoints * 1.9
   .RightMargin  = cnInchesToPoints * 0.27244094488189
   .TopMargin    = cnInchesToPoints * 0.47244094488189
   .BottomMargin = cnInchesToPoints * 0.47244094488189
   .HeaderMargin = cnInchesToPoints * 0.236220472440945
   .FooterMargin = cnInchesToPoints * 0.236220472440945
    *.PrintHeadings = .f.
    *.PrintGridlines = .f.
    *.PrintComments = xlPrintNoComments
    *.PrintQuality = 600
    *.CenterHorizontally = .t.
    *.CenterVertically = .t.
   .Orientation = xlLandscape
    *.Draft = .f.
    *.PaperSize = xlPaperA4
    *.FirstPageNumber = xlAutomatic
    *.Order = xlDownThenOver
    *.BlackAndWhite = .f.
   .Zoom           = .f.
   .FitToPagesWide = 1
   .FitToPagesTall = .f.
   .PrintTitleRows = "$1:$1"    && repeats header on each page
ENDWITH
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform