网页上内容导出到word里

来源:互联网 发布:淘宝美工每天工作内容 编辑:程序博客网 时间:2024/05/21 20:26
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页上内容导出到word</title>
</head>
<body>
<div id="Layer1" >Happy New Year ! ! !
<input type=button name='button_export' title='导出到word'  onclick=Openword() value=下载到word></div>
</div>

<p>this is a test!</p>
<table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
<Tr><Td>1</td><Td>2</td><Td>3</td></tr>
<Tr><Td>4</td><Td>5</td><Td>6</td></tr>
<Tr><Td>7</td><Td>8</td><Td>9</td></tr>
</table>
</body>
</html>
<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>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击