<head>
<script language=javascript>
function openwin()
{
OpenWindow=window.open('把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
}
function openDoc()
{
var wrd=new ActiveXObject("Word.Application");
wrd.visible=true;
alert("您的"+wrd.Application.Caption+"安装路径为:\n"+wrd.Application.Path+"\n版本号是:"+wrd.Application.version+"\n注册使用者是:"+wrd.Application.UserName);
var ODoc=wrd.Documents.Open("D:\May08_2006\把word文件转成html文件.doc");
ODoc.saveAs("D:\May08_2006\把word文件转成html文件11.html",8);
wrd.Application.Activate();
//wrd.ActiveDocument.SaveAs("d:\把word文件转成html文件.html");
wrd.Quit();
}
//wrd.DisplayFormulaBar = false;
//wrd.Selection.TypeText("This is some text.");
//wrd.Application.Activate();
</script>
</head>
<body onload="openDoc() ">
<p><a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口">
</p>
<p>
</p>
</body>
</HTML>
========================================
其中
var ODoc=wrd.Documents.Open("D:\May08_2006\把word文件转成html文件.doc");
ODoc.saveAs("D:\May08_2006\把word文件转成html文件11.html",8);
没有起作用,但如果 改成一下的
var ODoc=wrd.Documents.Open("D:\把word文件转成html文件.doc");
ODoc.saveAs("D:\把word文件转成html文件11.html",8);
就能把 word文档在D:下转换成html文档,为第一种方法不行呢???
还有
如果写如下的函数
OpenWindow=window.open('d:\把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
加了个“d:\”,windows就回提示找不到'd:\把word文件转成html文件11.html',百思不得其解,希望各路大侠赐教,小的我 在这里写过了
3 个解决方案
#1
<HTML>
<head>
<script language=javascript>
function openwin()
{
OpenWindow=window.open('把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
}
function openDoc()
{
var wrd=new ActiveXObject("Word.Application");
wrd.visible=true;
alert("您的"+wrd.Application.Caption+"安装路径为:\n"+wrd.Application.Path+"\n版本号是:"+wrd.Application.version+"\n注册使用者是:"+wrd.Application.UserName);
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
wrd.Application.Activate();
//wrd.ActiveDocument.SaveAs("d:\把word文件转成html文件.html");
wrd.Quit();
}
//wrd.DisplayFormulaBar = false;
//wrd.Selection.TypeText("This is some text.");
//wrd.Application.Activate();
</script>
</head>
<body onload="openDoc() ">
<p><a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口" ID=Button1>
</p>
<p>
</p>
</body>
</HTML>
<head>
<script language=javascript>
function openwin()
{
OpenWindow=window.open('把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
}
function openDoc()
{
var wrd=new ActiveXObject("Word.Application");
wrd.visible=true;
alert("您的"+wrd.Application.Caption+"安装路径为:\n"+wrd.Application.Path+"\n版本号是:"+wrd.Application.version+"\n注册使用者是:"+wrd.Application.UserName);
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
wrd.Application.Activate();
//wrd.ActiveDocument.SaveAs("d:\把word文件转成html文件.html");
wrd.Quit();
}
//wrd.DisplayFormulaBar = false;
//wrd.Selection.TypeText("This is some text.");
//wrd.Application.Activate();
</script>
</head>
<body onload="openDoc() ">
<p><a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口" ID=Button1>
</p>
<p>
</p>
</body>
</HTML>
#2
1:
window.open('index.html')//只能是相对路径不能是
d:\把word文件转成html文件11.html的绝对路径
2:在D盘下必须有May08_2006目录
存在文件把word文件转成html文件.doc
\改称\\不然会出错
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
window.open('index.html')//只能是相对路径不能是
d:\把word文件转成html文件11.html的绝对路径
2:在D盘下必须有May08_2006目录
存在文件把word文件转成html文件.doc
\改称\\不然会出错
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
#3
good
#1
<HTML>
<head>
<script language=javascript>
function openwin()
{
OpenWindow=window.open('把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
}
function openDoc()
{
var wrd=new ActiveXObject("Word.Application");
wrd.visible=true;
alert("您的"+wrd.Application.Caption+"安装路径为:\n"+wrd.Application.Path+"\n版本号是:"+wrd.Application.version+"\n注册使用者是:"+wrd.Application.UserName);
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
wrd.Application.Activate();
//wrd.ActiveDocument.SaveAs("d:\把word文件转成html文件.html");
wrd.Quit();
}
//wrd.DisplayFormulaBar = false;
//wrd.Selection.TypeText("This is some text.");
//wrd.Application.Activate();
</script>
</head>
<body onload="openDoc() ">
<p><a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口" ID=Button1>
</p>
<p>
</p>
</body>
</HTML>
<head>
<script language=javascript>
function openwin()
{
OpenWindow=window.open('把word文件转成html文件11.html',"newwindow","height=768,width=1024,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,stats=no") ;
}
function openDoc()
{
var wrd=new ActiveXObject("Word.Application");
wrd.visible=true;
alert("您的"+wrd.Application.Caption+"安装路径为:\n"+wrd.Application.Path+"\n版本号是:"+wrd.Application.version+"\n注册使用者是:"+wrd.Application.UserName);
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
wrd.Application.Activate();
//wrd.ActiveDocument.SaveAs("d:\把word文件转成html文件.html");
wrd.Quit();
}
//wrd.DisplayFormulaBar = false;
//wrd.Selection.TypeText("This is some text.");
//wrd.Application.Activate();
</script>
</head>
<body onload="openDoc() ">
<p><a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口" ID=Button1>
</p>
<p>
</p>
</body>
</HTML>
#2
1:
window.open('index.html')//只能是相对路径不能是
d:\把word文件转成html文件11.html的绝对路径
2:在D盘下必须有May08_2006目录
存在文件把word文件转成html文件.doc
\改称\\不然会出错
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
window.open('index.html')//只能是相对路径不能是
d:\把word文件转成html文件11.html的绝对路径
2:在D盘下必须有May08_2006目录
存在文件把word文件转成html文件.doc
\改称\\不然会出错
var ODoc=wrd.Documents.Open("D:\\May08_2006\\把word文件转成html文件.doc");
ODoc.saveAs("D:\\May08_2006\\把word文件转成html文件11.html",8);
#3
good