怎样调用word?

我有一页面,里面有一部分文字是静态写上的,又一部分是读数据库读出来的。
现在我想把页面的文字打印出来,想调用word进行排版,怎样调用。
除了Ctrl C 和Ctrl V, 还有什么办法吗?
请各位高手帮忙!
---------------------------------------------------------------

 1<html>
 2<html xmlns:ie="">
 3<title>将浏览器文本导入到word</title>
 4<script>   
 5function onDownloadDone(s) {   
 6content.value=s;   
 7}   
 8</script>
 9<textarea cols="30" name="content" rows="20">   
10点击Text2Word,可以把这里的数据转成为Word.   
11  
12也可先导入文本件.   
13点击浏览选择文本文件.   
14再点击Text2Word,把文本文件的数据转成为Word.   
15</textarea>
16<ie:download id="oDownload" style="behavior:url(#default#download)"></ie:download>
17<input name="p" onchange="oDownload.startDownload(p.value,   
18onDownloadDone)" size="20" type="file"/>
19<input onclick="Text2Word(document.all.content.value)" type="button" value="Text2Word"/>
20<input onclick="Text2Word(document.documentElement.innerHTML)" type="button" value="导出该页源代码到Word"/>
21<script>   
22function Text2Word(str)   
23{   
24var wrd=new ActiveXObject("Word.Application")   
25wrd.visible=true   
26wrd.Documents.Open("c:\\\word.doc")   
27wrd.Selection.TypeText(str)   
28wrd.Application.Activate()   
29wrd.ActiveDocument.SaveAs("c:\\\word2.doc")   
30//wrd.quit();   
31wrd=null   
32}   
33  
34</script>
35</html>   
36\---------------------------------------------------------------   
37  
38Dim objWD objDOC   
39set objWD=creatobject("word.application")   
40objWD.visible=true   
41  
42objWD.document.add   
43set objDOC=objWD.activeDocument   
44objDOC.typetext="word"   
45objDOC.saveas "word.doc"   
46  
47objWD.quit   
48set objDOC=nothing   
49set objWD=nothing</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus