本文介绍了隐藏页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好





i打印发票时无法隐藏页眉和页脚。

i不想要在网页上显示网址和页码



以下是我的代码





hello


i am not able to hide header and footer while printing invoice.
i dont want to show url and page number in print

below is my code


Dim strScript As String = "<script language="JavaScript">"
            strScript += "window.print();"

推荐答案


<script type="text/vbscript" language="vbscript">
      Dim WSHShell
      Set WSHShell = CreateObject("WScript.Shell")
      WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\header", ""
      WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer", ""

       Sub ResetHeader()
           Dim WSHShell
           Set WSHShell = CreateObject("WScript.Shell")
           WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\header", "&w&bPage &p of &P"
           WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer", "&u&b&d"

       End Sub

</script>









然后在代码中调用ResetHeader函数





then Call ResetHeader Function in your code


这篇关于隐藏页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-08 01:20