php怎么获取word文档

2025-11-11 12:02:00

1、打开dw或者记事本

2、<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">;

<html style='width:350px; Height: 140px;'>;

<head>;

<title>;Open A Word& Document</title>;

<style>; html, body, button, div, input, select{ font-family: MS Shell Dlg; font-size: 11px;}; </style>;

<SCRIPT DEFER>;

<!--

function _CloseOnEsc() {if (event.keyCode == 27) { window.close(); return; }} document.body.onkeypress = _CloseOnEsc;

//-->;

</SCRIPT>;

<SCRIPT>;

function openword (){

var pathlength = document.all.filepath.value.length - 4;

var pathisdoc = document.all.filepath.value.lastIndexOf(".doc"); if (pathlength !== pathisdoc){

alert ("您选择的不是一个 Microsoft Word 文档.\n 它的扩展名必须是 .doc");

}

else {

var file = unescape( document.set.filepath.value ) var word

try {

 

try {

 

try {

 

}

}

}

word=new ActiveXObject('Word.Application.9') // word 2k

} catch (e) {

word=new ActiveXObject('Word.Application.8') // word 97

} catch (e) {

word=new ActiveXObject('Word.Application.7') // word 95

} catch (e) {

//WordPad.Document

//word.Visible=true; word.Documents.Open(file); word.Documents(file).Range(0).Copy();

//word.ActiveDocument.SaveAs("H:\Mydoc.doc", 4);

//word.Options.PrintBackground = false;

//word.ActiveDocument.PrintOut(); word.Quit();

window.close();

}

}

</SCRIPT>;

</head>;

<body style="background: threedface; color: windowtext;" margin: 30px; >;

<FORM METHOD="post" NAME="set" ID="set">;

;&&<IMG SRC="../images/ed_word.gif" ALT="

ALIGN="absmiddle">;打开一个 Word& 文档

<DIV>;<INPUT TYPE="file" NAME="filepath" SIZE="30">;

;<INPUT TYPE="button" NAME="btnOK" VALUE="Open" onclick="openword();">;&&<INPUT TYPE="button" NAME="Cancel" VALUE="退出" onclick="window.close();">;</DIV>;

</FORM>;

</body>;

</html>;

3、运行保存网页查看即可

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢