JSPまたはHTMLページをワードに変換
2614 ワード
1.<html>
2.<head>
3.<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
4.<title> word</title>
5.</head>
6.<body>
7.<div id="Layer1" >Happy New Year ! ! !
8.<input type=button name='button_export' title=' word' onclick=OpenWord() value= word></div>
9.</div>
10.
11.<p>this is a test!</p>
12.<table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
13.<Tr><Td>1</td><Td>2</td><Td>3</td></tr>
14.<Tr><Td>4</td><Td>5</td><Td>6</td></tr>
15.<Tr><Td>7</td><Td>8</td><Td>9</td></tr>
16.</table>
17.</body>
18.</html>
19.<script language="javascript">
20.function OpenWord(){
21.Layer1.style.border=0
22.ExcelSheet = new ActiveXObject('Word.Application');
23.ExcelSheet.Application.Visible = true;
24.var mydoc=ExcelSheet.Documents.Add('',0,1);
25.myRange =mydoc.Range(0,1)
26.var sel=Layer1.document.body.createTextRange()
27.sel.select()
28.Layer1.document.execCommand('Copy')
29.sel.moveEnd('character')
30.myRange.Paste();
31.location.reload()
32.ExcelSheet.ActiveWindow.ActivePane.View.Type=9
33.}
34.</script>
1.<script language="javascript">
2.function OpenWord(){
3.
4. ExcelSheet = new ActiveXObject('word.Application');
5. ExcelSheet.Application.Visible = true;
6. var orgNum=ExcelSheet.Documents.Add('',0,1);
7. myRange =orgNum.Range(0,1)
8. sel=parent.document.body.createTextRange();
9. oTblExport = parent.document.getElementById("Layer1");
10. if (oTblExport != null) {
11. sel.moveToElementText(oTblExport);
12. sel.execCommand('Copy');
13. parent.document.body.blur();
14. myRange.Paste();
15. }
16.
17. }
18.</SCRIPT>