新建一个 “打印” 热点或者按钮
<div id="Tab">你想打印的内容</div>
--------------------------热点内容如下-----------------------------
fso = new ActiveXObject("Scripting.FileSystemObject");
var TemporaryFolder = 2;
//得到系统临时文件夹
tfolder = fso.GetSpecialFolder(TemporaryFolder);
try{
tf = fso.CreateTextFile(tfolder+"\\临时打印文件.doc", true);
tf.WriteLine("<html>");
tf.WriteLine("<body>");
tf.WriteLine(document.all.Tab.innerHTML);
tf.WriteLine("</body>");
tf.WriteLine("</html>");
tf.Close();
var doc = new ActiveXObject("Word.Application");
doc.Visible = true;
doc.Documents.Open (tfolder+"\\临时打印文件.doc");
doc.ActiveWindow.View.Type = 3;
doc.ActiveDocument.PageSetup.Orientation=0;
}
catch(e)
{
alert("有表单正在打印,请关闭后再进行打印此表单");
}