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

it2024-06-21  41

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

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

点击下载WebOffice正式版

12.SaveAs 文档另存为

SaveAs( strFileName, dwFileFormat); 参数: strFileName:文件本地路径,如c:\a.doc dwFileFormat: 文件格式 对于Word,Excel,PPT文档dwFileFormat的数值是不同的:

```java 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); 例子如下 ```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分页保存

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

想要购买WebOffice正版授权,或了解更多产品信息请点击【咨询在线客服】 APS帮助提升企业生产效率,真正实现生产计划可视化呈现与控制,快速有效响应不同场景的生产计划,提高准时交货能力,提高产能和资源利用率 想要了解甘特图或慧都APS系统,请登录慧都网咨询在线客服,解决您的问题! 本文章转载自【慧都科技】evget欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,尊重他人劳动成果 原文链接:https://www.evget.com/article/2020/10/15/38657.html

最新回复(0)