- <div id="fckeditor" style="POSITION: relative;width:100%;height:460px;OVERFLOW:hidden;display:block"><!-- 正文 -->
- <script type="text/javascript">
- var oFCKeditor = new FCKeditor('content');
- oFCKeditor.BasePath = "fckeditor/";
- oFCKeditor.Value ='';
-
-
-
-
-
- oFCKeditor.Height = 450 ;
- oFCKeditor.Width = '100%' ;
- oFCKeditor.Create();
- </script>
- </div>
-
- <div id="iWebOffice" style="POSITION: relative;width:100%;height:460px;OVERFLOW:hidden;display:none">
- <object id="WebOffice" style="POSITION: relative;top:-20" width="100%" height="450px" classid="clsid:8B23EA28-723C-402F-92C4-59BE0E063499" codebase="/vplugin/iWebOffice2006.cab#version=7,5,4,0">
- <param name="WebUrl" value="<%=mServerUrl %>">
- <param name="RecordID" value="">
- <param name="Template" value="">
- <param name="FileName" value="">
- <param name="FileType" value="">
- <param name="UserName" value="">
- <param name="ExtParam" value="">
- <param name="EditType" value="1,1">
- <param name="PenColor" value="#FF0000">
- <param name="PenWidth" value="1">
- <param name="Print" value="1">
- <param name="ShowToolBar" value="0">
- <param name="ShowMenu" value="0">
- </object>
- </div>
-
- function onChangeDocType(docType){
- var iWebOffice = document.getElementById("iWebOffice");
- var fckeditor = document.getElementById("fckeditor");
- switch(docType) {
- case 2:
- iWebOffice.style.display='none';
- fckeditor.style.display='none';
- break;
- case 3:
- iWebOffice.style.display='none';
- fckeditor.style.display='';
- break;
- case 4:
- initObject('4',true);
- iWebOffice.style.display='';
- fckeditor.style.display='none';
- break;
- case 5:
- initObject('5',true);
- iWebOffice.style.display='';
- fckeditor.style.display='none';
- break;
- case 7:
- initObject('7',true);
- iWebOffice.style.display='';
- fckeditor.style.display='none';
- break;
- default:
- break;
- }
- }
-
-
-
- function initObject(fileType,bCreate){
- if (fileType=="5"){
- document.WebOffice.FileType = ".xls";
- }else if(fileType=="4"){
- document.WebOffice.FileType = ".doc";
- }else if(fileType=="7"){
- document.WebOffice.FileType = ".ppt";
- }
- try{
- document.WebOffice.CreateFile();
-
- }catch(e){
- }
-
- }
-
-
- function LoadDocument(){
- frm.WebOffice.FileName = "Test";
-
- frm.WebOffice.EditType = "0,1";
- if (!frm.WebOffice.WebOpen()){
- alert(frm.WebOffice.Status);
- }else{
- alert(frm.WebOffice.Status);
- }
- }
-
- function SaveDocument(){
- document.WebOffice.FileName = "Test"+document.WebOffice.FileType;
- document.WebOffice.WebSave();
- }
-
- function WebOpenPrint(){
- try{
- VelcroForm.WebOffice.WebOpenPrint();
- StatusMsg(VelcroForm.WebOffice.Status);
- }catch(e){}
- }
-
- function WebOpenPageSetup(){
- try{
- if (VelcroForm.WebOffice.FileType==".doc"){
- VelcroForm.WebOffice.WebObject.Application.Dialogs(178).Show();
- }
- if(VelcroForm.WebOffice.FileType==".xls"){
- VelcroForm.WebOffice.WebObject.Application.Dialogs(7).Show();
- }
- }catch(e){}
- }
-
- function savelocalFile(){
- try{
- document.WebOffice.WebSaveLocalFile();
- }catch(e){}
- }
-
- function openLocalFile(){
- try{
- document.WebOffice.WebOpenLocalFile();
- }catch(e){}
- }
-
- 屬性[Office公共]
- Caption 軟件編號(hào)
- WebUrl 提交服務(wù)器程序路徑
- RecordID 需要打開(kāi)的記錄號(hào)
- Template 需要使用的模版名
- FileName 需要打開(kāi)的文件名
- FileType 需要打開(kāi)的文件類(lèi)型
- EditType 需要使用的方式
- UserName 用戶名
- Status 當(dāng)前插件狀態(tài)
- Error 錯(cuò)誤信息狀態(tài)
- ActiveDocument 文檔對(duì)象接口
- MsgFilepath 當(dāng)前文件目錄
-
- 其中:RecordID,Template,FileName,FileType,EditType,UserName是全局參數(shù)??晒┖笈_(tái)服務(wù)器程序使用。
-
- 語(yǔ)法: WebUrl
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置服務(wù)器應(yīng)用程序Url路徑
- 調(diào)用: WebOffice.WebUrl="http://www./WebEditor/OfficeServer.asp"
- 說(shuō)明: OfficeServer.asp是一個(gè)服務(wù)器應(yīng)用服務(wù),用戶可以根據(jù)自己的情況指定自己的應(yīng)用程序名
-
- 語(yǔ)法: RecordId
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置文檔的紀(jì)錄號(hào)
- 調(diào)用: WebOffice.RecordId="324923100"
- 說(shuō)明: RecordId是一個(gè)文檔的唯一標(biāo)識(shí),通過(guò)這個(gè)編號(hào),可以在服務(wù)器上找到該文檔,這個(gè)值也可以是其他字符如: "辦公系統(tǒng)解決方案"
-
- 語(yǔ)法: Template
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置模板編號(hào)
- 調(diào)用: WebOffice.Template="10214563698"
- 說(shuō)明: Template是一個(gè)模板文檔的唯一標(biāo)識(shí),通過(guò)這個(gè)模板編號(hào),可以在服務(wù)器上找到該模板文檔,這個(gè)值也可以是其他字符如: "辦公系統(tǒng)解決方案模板"
-
- 語(yǔ)法: FileName
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置文檔名稱(chēng)
- 調(diào)用: WebOffice.FileName="辦公系統(tǒng)解決方案.doc"
- 說(shuō)明: FileName是一個(gè)文檔的擴(kuò)展屬性,通過(guò)這個(gè)擴(kuò)展屬性,可以在服務(wù)器上找到該模板文檔,這個(gè)值也可以是其他字符如: "辦公系統(tǒng)解決方案模板"
-
-
- 語(yǔ)法: FileType
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置文檔類(lèi)型
- 調(diào)用: WebOffice.FileType=".doc"
- 說(shuō)明: FileType是一個(gè)文檔的類(lèi)型,通過(guò)這個(gè)類(lèi)型,決定打開(kāi)的文檔是Word還是Excel
- FileType 為 “.doc” 或 “.xls”
-
- 語(yǔ)法: EditType
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置文檔打開(kāi)方式 有兩種付值方式:
- WebOffice.EditType=”X” ;
- X 的含義如下:
- “0” 只讀、且不能拷貝,
- “1” 起草編輯[可寫(xiě)無(wú)痕跡保留] ,
- “2” 編輯[有痕跡保留]
- 如果需要有痕跡保留功能,就可以設(shè)置為 WebOffice.EditType=”2”;
-
- 語(yǔ)法: UserName
- 特性: 只寫(xiě)
- 類(lèi)型: String
- 功能: 設(shè)置操作文檔用戶名
- 調(diào)用: WebOffice.UserName="張三"
- 說(shuō)明: UserName是一個(gè)編輯文檔的用戶名
-
- 語(yǔ)法: Status
- 特性: 只讀
- 類(lèi)型: String
- 功能: 返回當(dāng)前狀態(tài)
- 調(diào)用: alert(WebOffice.Status);
-
- 語(yǔ)法: Error
- 特性: 只讀
- 類(lèi)型: String
- 功能: 返回當(dāng)前錯(cuò)誤信息
- 調(diào)用: alert(WebOffice.Error);
-
- 語(yǔ)法: ActiveDocument
- 特性: 讀寫(xiě)
- 類(lèi)型: Object
- 功能: 返回Word或Excel對(duì)象,可用javascript腳本調(diào)用VBA對(duì)Word,Excel編程
- 調(diào)用: alert(WebOffice.ActiveDocument.Application.UserName) 返回用戶名,該用法請(qǐng)參考VBA
- 如果是Word 文件,ActiveDocument 是Word 的 ActiveDocument對(duì)象
- 如果是Excel 文件,ActiveDocument 是Excel 的ActiveSheet對(duì)象
- 可以通過(guò)ActiveDocument.Application得到VBA的Application對(duì)象
-
- 方法:
-
-
- LoadFile() 打開(kāi)網(wǎng)絡(luò)文檔
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù) 返回成功或失敗
- 特別說(shuō)明 Office公共
-
- SaveFile() 保存網(wǎng)絡(luò)文檔
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù) 返回成功或失敗
- 特別說(shuō)明 Office公共
-
- Close() 關(guān)閉所有文檔
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù) 返回成功或失敗
- 特別說(shuō)明 Office公共
-
-
- LoadTemplate() 調(diào)入網(wǎng)絡(luò)模板
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù)返回設(shè)置成功或失敗。
- 特別說(shuō)明 Office公共
-
- SaveTemplate() 保存網(wǎng)絡(luò)模板
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù)返回設(shè)置成功或失敗。
- 特別說(shuō)明 Office公共
-
- UpdateFile() 保存定稿的文檔
- 輸入?yún)?shù) 無(wú)。
-
- 輸出參數(shù) 返回設(shè)置成功或失敗。
- 特別說(shuō)明 Office公共
-
- GetMsgByName(FieldName) 取得服務(wù)器返回信息的值
- 輸入?yún)?shù):
- FieldName 字段域名稱(chēng)
- 輸出參數(shù) 返回成功或失敗。
- 特別說(shuō)明 Office公共
-
- SetMsgByName(FieldName, FieldValue) 設(shè)置相應(yīng)值,等待發(fā)送給服務(wù)器
- 輸入?yún)?shù):
- FieldName 字段域名稱(chēng)
- FieldValue 字段域值
- 輸出參數(shù) 無(wú)
- 特別說(shuō)明 Office公共
-
- MsgTextClear () 清除由SetMsgByName設(shè)置的變量
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù) 無(wú)。
- 特別說(shuō)明 Office公共
- MsgFileClear(FileName) 清除通過(guò)MsgFileLoad調(diào)入或服務(wù)器返回的文件
- 輸入?yún)?shù):
- FileName 文件名稱(chēng)
- 輸出參數(shù) 無(wú)
- 特別說(shuō)明 Office公共
-
- MsgFileLoad(FileName) 調(diào)入FileName所指定的文件
- 輸入?yún)?shù):
- FileName 文件名稱(chēng)
- 輸出參數(shù) 無(wú)
- 特別說(shuō)明 Office公共
-
- MsgFileSave(FileName) 保存FileName所指定的文件
- 輸入?yún)?shù):
- FileName 文件名稱(chēng)
- 輸出參數(shù) 無(wú)
- 特別說(shuō)明 Office公共
-
- SendToServer() 發(fā)送由SetMsgByName設(shè)置的值給服務(wù)器
- 輸入?yún)?shù) 無(wú)。
- 輸出參數(shù) 成功或失敗。
- 特別說(shuō)明 Office公共
-
- Open(FileName,true) 打開(kāi)由FileName指定的文件
- Save(FileName,true) 保存由FileName指定的文件
|