<HTML>
<HTML XMLNS:IE>
<title>将浏览器文本导入到word</title>
<SCRIPT>
function onDownloadDone(s) {
content.value=s;
}
</SCRIPT>
<textarea name="content" cols=30 rows=20>
点击Text2Word,可以把这里的数据转成为Word.
也可先导入文本件.
点击浏览选择文本文件.
再点击Text2Word,把文本文件的数据转成为Word.
</textarea>
<IE
ownload ID="oDownload" STYLE="behavior:url(#default#download)" />
<input type=file name='p' onchange="oDownload.startDownload(p.value,
onDownloadDone)" size="20">
<input type="button" onclick="Text2Word(document.all.content.value)"
value="Text2Word">
<input type="button" onclick="Text2Word(document.documentElement.innerHTML)"
value="导出该页源代码到Word">
<script>
function Text2Word(str)
{
var wrd=new ActiveXObject("Word.Application")
wrd.visible=true
wrd.Documents.Open("c:\\word.doc")
wrd.Selection.TypeText(str)
wrd.Application.Activate()
wrd.ActiveDocument.SaveAs("c:\\word2.doc")
//wrd.quit();
wrd=null
}
</script>
</HTML>