html 导出 word (转)
下面是一段 把HTML 页面的内容导入到WOrd 的代码,在网上找的,谁能给解释一下。
<div id="Layer1">
<input type=button name='button_export' onclick=OpenWord() value=用word打开 id="Button1"></div>
<script language="javascript">
function OpenWord(){
Layer1.style.border=0
ExcelSheet = new ActiveXObject('Word.Application');
ExcelSheet.Application.Visible = true;
var mydoc=ExcelSheet.Documents.Add('',0,1);
myRange =mydoc.Range(0,1)
var sel=Layer1.document.body.createTextRange()
sel.select()
Layer1.document.execCommand('Copy')
sel.moveEnd('character')
myRange.Paste();
location.reload()
ExcelSheet.ActiveWindow.ActivePane.View.Type=9
}
</script>