如何控制IE打印中页眉和页脚

< script language="VBScript">

dim path, reg

'path存放IE打印设置的注册表地址, reg存放WScript.Shell组件的对象

path = "HKEY_CURRENT_USER/Software/Micro-soft/Internet Explorer/PageSetup"

'通过注册表修改打印设置,只修改页眉、页脚和各边界的值

'参数说明:header--页眉,footer--页脚,margin_left--左边界

'margin_top--上边界,margin_right--右边界,margin_bottom--下边界

'页边距的设置中 1对应25.4mm,即margin_left=1表示实际值的25.4mm

function pagesetup(header, footer, margin_left, margin_top, margin_right, margin_bottom)

On Error Resume Next

Set reg = CreateObject("WScript.Shell")

if err.Number>0 then

MsgBox "不能创建WScript.Shell对象!"

exit function

end if

reg.RegWrite path+"/header", header'设置页眉

reg.RegWrite path+"/footer", footer '设置页脚

reg.RegWrite path+"/margin_left", margin_left'设置左边界

reg.RegWrite path+"/margin_top", margin_top'设置上边界

reg.RegWrite path+"/margin_right", margin_right'设置右边界

reg.RegWrite path+"/margin_bottom", margin_bottom'设置下边界

end function

< /script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值