<SCRIPT LANGUAGE="javascript">
//指定页面区域内容导入Word
function AllAreaWord() {
var oWD = new ActiveXObject("Word.Application");
var oDC = oWD.Documents.Add("",0,1);
var oRange =oDC.Range(0,1);
var sel = document.body.createTextRange();
sel.moveToElementText(PrintA);
sel.select();
sel.execCommand("Copy");
oRange.Paste();
oWD.Application.Visible = true;
//window.close();
}
</SCRIPT>
应用举例:
<table width="100%" align=center border="0" cellpadding="0" cellspacing="0" id = "PrintA">
<tr><td>…</td></tr>
</table>
本文介绍了一种使用JavaScript和Microsoft Word ActiveX对象将网页指定区域的内容复制并粘贴到Word文档中的方法。通过创建文本范围并执行复制命令,可以轻松实现网页内容的导出。
7876

被折叠的 条评论
为什么被折叠?



