WebOffice常用API接口在线参考手册

WebOffice控件是国内领先的在线编辑Office文档软件,软件产品从1998年立项至今已有20多年历史,期间服务了众多大中小型企业、各级政府机关、科研机构和学校等事业单位。通过WebOffice软件可以让用户方便从远程直接打开Word,Excel,Ppt等文档编辑后再次保存至服务器原位置,实现远程编辑文档、远程保存,为用户在线办公开创新式、便捷的使用体验。

WebOffice文档控件(标准版永久授权)原价8000元,现活动优惠价只需7846元 

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 //网页方式
};

//大纲模式
document.getElementById('WebOffice').ShowView(5);

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);

posted @ 2020-10-21 13:21  roffey  阅读(1441)  评论(0编辑  收藏  举报