function print(preview)
{
var content=window.document.body.innerHTML;
var oricontent=content;
while(content.indexOf("{$printhide}")>=0) content=content.replace("{$printhide}","style='display:none'");
if(content.indexOf("ID=/"PrintControl/"")<0) content=content+"<OBJECT ID=/"PrintControl/" WIDTH=0 HEIGHT=0 CLASSID=/"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2/"></OBJECT>";
window.document.body.innerHTML=content;
//PrintControl.ExecWB(7,1)preview,(1,1)open,(4,1)save,(17,1)select all,(10,1)property,(6,1)print,(6,6)print directly,(8,1)page setting
if(preview==null)
{
PrintControl.ExecWB(4,1);
}
else
{
}
if(preview==false)
{
PrintControl.ExecWB(6,1);
}
else
{
PrintControl.ExecWB(7,1); //OLECMDID_PRINT=7; OLECMDEXECOPT_DONTPROMPTUSER=6/OLECMDEXECOPT_PROMPTUSER=1
}
window.document.body.innerHTML=oricontent;
}
Print and Preview

最新推荐文章于 2021-09-02 15:19:04 发布