代码如下:
<HTML>
<HEAD>
<TITLE>WalkingPoison\'s Word-to-HTML sample</TITLE>
<script language=javascript>
function saveword() {
var oWordApp=new ActiveXObject("Word.Application");
var oDocument=oWordApp.Documents.Open("C:\\test.doc");
oDocument.SaveAs("C:\\test.htm", 8)
oWordApp.Quit();
}
</script>
</HEAD>
<BODY>
Click the "save" button to save the file "C:\test.doc" to "C:\test.htm":
<input type=button onclick="saveword()" value=save>
<P> </P>
</BODY>
</HTML>
实际使用的时候只要改变其中的test.doc和test.htm就可以了!但需要说明一点的是,该方法是在客户端实现的,它受实际用户浏览器安全级别的限制!各位网友赶快试试吧!
<HEAD>
<TITLE>WalkingPoison\'s Word-to-HTML sample</TITLE>
<script language=javascript>
function saveword() {
var oWordApp=new ActiveXObject("Word.Application");
var oDocument=oWordApp.Documents.Open("C:\\test.doc");
oDocument.SaveAs("C:\\test.htm", 8)
oWordApp.Quit();
}
</script>
</HEAD>
<BODY>
Click the "save" button to save the file "C:\test.doc" to "C:\test.htm":
<input type=button onclick="saveword()" value=save>
<P> </P>
</BODY>
</HTML>