Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I specify my font for Excel PageSetup
Message
From
28/02/2002 12:42:44
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00626485
Message ID:
00626544
Views:
57
This message has been marked as the solution to the initial question of the thread.
Nadya,
Formatting of headers and footers is a bit tricky. Anyway, I have added the following to the quickReport() method:
   *-------------------------------------------------------------------------------------------------- 
   *-- VBA Formatting Codes for Headers and Footers (from VBA help file)
   *-------------------------------------------------------------------------------------------------- 
   *-- The following special formatting codes can be included as a part of the header and footer 
   *-- properties (LeftHeader, CenterHeader, RightHeader, LeftFooter, CenterFooter, RightFooter).
   *-- 
   *-- Format code Description 
   *-- &L          Left aligns the characters that follow. 
   *-- &C          Centers the characters that follow. 
   *-- &R          Right aligns the characters that follow. 
   *-- &E          Turns double-underline printing on or off. 
   *-- &X          Turns superscript printing on or off. 
   *-- &Y          Turns subscript printing on or off. 
   *-- &B          Turns bold printing on or off. 
   *-- &I          Turns italic printing on or off. 
   *-- &U          Turns underline printing on or off. 
   *-- &S          Turns strikethrough printing on or off. 
   *-- &D          Prints the current date. 
   *-- &T          Prints the current time. 
   *-- &F          Prints the name of the document. 
   *-- &A          Prints the name of the workbook tab. 
   *-- &P          Prints the page number. 
   *-- &P+number   Prints the page number plus the specified number. 
   *-- &P-number   Prints the page number minus the specified number. 
   *-- &&          Prints a single ampersand. 
   *-- &"fontname" Prints the characters that follow in the specified font. 
   *--             Be sure to include the double quotation marks. 
   *-- &nn         Prints the characters that follow in the specified font size. 
   *--             Use a two-digit number to specify a size in points. 
   *-- &N          Prints the total number of pages in the document. 
      
   #DEFINE ccHeaderFont  [&"Tahoma,Regular"&14] && Tahoma, Regular, Size=14
   #DEFINE ccFooterFont  [&"Tahoma,Regular"&14] && Tahoma, Regular, Size=14

   *-- ...
   *-- set pageSetup properties
   WITH oXLS.Application.ActiveSheet.PageSetup
      *.LeftHeader  = ""
      .CenterHeader = ccHeaderFont + This.GetSourceType() + " - " + lcAlias && e.g. "Remote View - Customers"
      *.CenterHeader = This.GetSourceType() + " - " + lcAlias && e.g. "Remote View - Customers"
      *.RightHeader = ""
      .LeftFooter   = ccFooterFont + lcVersion 
      .CenterFooter = ccFooterFont + "&P of &N"
      .RightFooter  = ccFooterFont + "&D - &T"

      *-- etc.
As a general tip, the easiest way to find out about things like that is to record a macro, apply the formatting you want and then have a look at the generated VBA code.

HTH
>Hi everybody,
>
>How can I control font of CenterHeader, CenterFooter and content of the page.
>
>Here is the code from Daniel Gramunt, I enabled GridLines (as requested by user), but I also want to have different fonts:
>
>
>*-- set pageSetup properties
>with oXLS.application.ActiveSheet.PageSetup
>*.LeftHeader  = ""
>	.CenterHeader = m.lcTableName
>    .RightHeader = NiceFormatDate(date())
>	.LeftFooter   = icMessageBoxCaption
>	.RightFooter = "&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. && Don't want to print Excel Headings
>    .PrintGridlines = .t.
>*.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
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform