翻譯|使用教程|編輯:楊鵬連|2020-10-15 14:03:37.810|閱讀 609 次
概述:本教程主要介紹WebOffice常用API接口的在線手冊。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
WebOffice控件是國內領先的在線編輯Office文檔軟件,軟件產品從1998年立項至今已有20多年歷史,期間服務了眾多大中小型企業、各級政府機關、科研機構和學校等事業單位。通過WebOffice軟件可以讓用戶方便從遠程直接打開Word,Excel,Ppt等文檔編輯后再次保存至服務器原位置,實現遠程編輯文檔、遠程保存,為用戶在線辦公開創新式、便捷的使用體驗。
WebOffice文檔控件(標準版永久授權)原價8000元,現活動優惠價只需7846元 >>查看其他版本
相關內容推薦:
WebOffice使用教程:WebOffice常用API接口在線參考手冊(一)>>>
WebOffice使用教程:WebOffice常用API接口在線參考手冊(二)>>
WebOffice使用教程:WebOffice常用API接口在線參考手冊(三)>>
12.SaveAs 文檔另存為
SaveAs( strFileName, dwFileFormat);
參數:
strFileName:文件本地路徑,如c:\\a.doc
dwFileFormat: 文件格式
對于Word,Excel,PPT文檔dwFileFormat的數值是不同的:
Excel: Type enum XlFileFormat { xlAddIn = 18, xlCSV = 6, xlCSVMac = 22, xlCSVMSDOS = 24, xlCSVWindows = 23, xlDBF2 = 7, xlDBF3 = 8, xlDBF4 = 11, xlDIF = 9, xlExcel2 = 16, xlExcel2FarEast = 27, xlExcel3 = 29, xlExcel4 = 33, xlExcel5 = 39, xlExcel7 = 39, xlExcel9795 = 43, xlExcel4Workbook = 35, xlIntlAddIn = 26, xlIntlMacro = 25, xlWorkbookNormal = -4143, xlSYLK = 2, xlTemplate = 17, xlCurrentPlatformText = -4158, xlTextMac = 19, xlTextMSDOS = 21, xlTextPrinter = 36, xlTextWindows = 20, xlWJ2WD1 = 14, xlWK1 = 5, xlWK1ALL = 31, xlWK1FMT = 30, xlWK3 = 15, xlWK4 = 38, xlWK3FM3 = 32, xlWKS = 4, xlWorks2FarEast = 28, xlWQ1 = 34, xlWJ3 = 40, xlWJ3FJ3 = 41, xlUnicodeText = 42, xlHtml = 44 }; Word: Type enum WdSaveFormat { wdFormatDocument = 0, wdFormatTemplate = 1, wdFormatText = 2, wdFormatTextLineBreaks = 3, wdFormatDOSText = 4, wdFormatDOSTextLineBreaks = 5, wdFormatRTF = 6, wdFormatUnicodeText = 7, wdFormatEncodedText = 7, wdFormatHTML = 8 }; PPT: enum PpSaveAsFileType { ppSaveAsPresentation = 1, ppSaveAsPowerPoint7 = 2, ppSaveAsPowerPoint4 = 3, ppSaveAsPowerPoint3 = 4, ppSaveAsTemplate = 5, ppSaveAsRTF = 6, ppSaveAsShow = 7, ppSaveAsAddIn = 8, ppSaveAsPowerPoint4FarEast = 10, ppSaveAsDefault = 11, ppSaveAsHTML = 12, ppSaveAsHTMLv3 = 13, ppSaveAsHTMLDual = 14, ppSaveAsMetaFile = 15, ppSaveAsGIF = 16, ppSaveAsJPG = 17, ppSaveAsPNG = 18, ppSaveAsBMP = 19 };13.GetTempFilePath 創建臨時文件
var strFile = document.getElementById('WebOffice').GetTempFilePath()
GetTempFilePath會返回本地電腦一個臨時文件存儲地址,使用后應用DeleteLocalFile刪除。
14.ShowView 設置文檔顯示模式
ShowView(dwViewType); dwViewType的可取值為: enum WdViewType { wdNormalView = 1, //正常模式 wdOutlineView = 2, wdPrintView = 3, wdPrintPreview = 4,打印預覽 wdMasterView = 5, //大綱模式 wdWebView = 6 //網頁方式 };//大綱模式
15.DownloadFile 下載遠程文件
DownloadFile( strRemoteFile, strLocalFile)
參數:
strRemoteFile:遠程路徑地址
strLocalFile: 本地保存地址
16.GetRevInfo 獲取詳細的留痕信息
GetRevCount();
GetRevInfo(lIndex,lType);
例子如下
var RevCount; RevCount = document.getElementById('WebOffice').GetRevCount(); alert("共有"+RevCount+"修訂痕跡"); for(var i=1; i<= RevCount; i++){ chrOper = document.getElementById('WebOffice').GetRevInfo(i,2); if("1" == chrOper){ chrOper = "插入"; }else if("2" == chrOper){ chrOper = "刪除"; }else{ chrOper = "設置格式"; } editDate = new String(document.getElementById('WebOffice').GetRevInfo(i,1)); alert(editDate + " 用戶:"+document.getElementById('WebOffice').GetRevInfo(i,0) + "\r\n操作:" + chrOper + "\r\n內容:" + document.getElementById('WebOffice').GetRevInfo(i,3)); }17.SetPageAs Word分頁保存
SetPageAs(strLocalFile,lPageNum)
strLocalFile:本地路徑
lPageNum:第幾頁頁碼
將當前打開的文件檔的第1頁以a.doc保存在C盤根目錄下:
document.getElementById('WebOffice').SetPageAs("c:\\a.doc",1);
將當前打開的文件檔的第2頁以b.doc保存在C盤根目錄下:
document.getElementById('WebOffice').SetPageAs("c:\\b.doc",2);
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: