Page 1 of 1

Change header and footer of Internet Explorer for printing

Posted: Tue Sep 20, 2005 4:52 pm
by yabune
Code updated For 5.20+

Here's a way to change the header and footer of Internet Explorer printings:

- Install Droopy's Lib (for the Registry Functions)

and code like this:

Code: Select all

#REG_PAGE_SETUP = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup"

header_new.s = "New Header"
footer_new.s = "New Footer"

; do a backup of the current header and footer
header_old.s = RegGetValue(#REG_PAGE_SETUP,"header",".")
footer_old.s = RegGetValue(#REG_PAGE_SETUP,"footer",".")

; set the new header and footer
RegSetValue(#REG_PAGE_SETUP,"header",header_new,#REG_SZ,".")
RegSetValue(#REG_PAGE_SETUP,"footer",footer_new,#REG_SZ,".")

; ..
; Do your printings
; ..

; restore the old header and footer
RegSetValue(#REG_PAGE_SETUP,header_old,#REG_SZ,".")
RegSetValue(#REG_PAGE_SETUP,"footer",footer_old,#REG_SZ,".")
In the new header and footer strings you can include the following variables:
&w Window title
&u Page address (URL)
&d Date in short format
&D Date in long format
&t Time
&T Time in 24-hour format
&p Current page number
&P Total number of pages
&b Right-aligned text (following &b)
&b&b Centered text (between &b&b)
&& A single ampersand (&)

Yabune

Posted: Tue Sep 20, 2005 9:28 pm
by dell_jockey
Cool! thanks!