天天看點

WebOffice常用API接口線上參考手冊

WebOffice控件是國内領先的線上編輯Office文檔軟體,軟體産品從1998年立項至今已有20多年曆史,期間服務了衆多大中小型企業、各級政府機關、科研機構和學校等事業機關。通過WebOffice軟體可以讓使用者友善從遠端直接打開Word,Excel,Ppt等文檔編輯後再次儲存至伺服器原位置,實作遠端編輯文檔、遠端儲存,為使用者線上辦公開創新式、便捷的使用體驗。

12.SaveAs 文檔另存為

{
    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 //網頁方式
};
//大綱模式
document.getElementById('WebOffice').ShowView(5);

## 15.DownloadFile 下載下傳遠端檔案

DownloadFile( strRemoteFile, strLocalFile)
參數:
strRemoteFile:遠端路徑位址 
strLocalFile: 本地儲存位址

## 16.GetRevInfo 擷取詳細的留痕資訊

GetRevCount();
GetRevInfo(lIndex,lType);
例子如下

```java
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分頁儲存

繼續閱讀