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 = ElementById('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 = ElementById('WebOffice').GetRevCount();
百度api接口alert("共有"+RevCount+"修订痕迹");
for(var i=1; i<= RevCount; i++){ chrOper = ElementById('WebOffice').GetRevInfo(i,2); if("1" == chrOper){ chrOper = "插⼊"; }else if("2" == chrOper){ chrOper = "删除"; }else{ chrOper = "设置格式"; } editDate = new 17.SetPageAs Word分页保存
SetPageAs(strLocalFile,lPageNum)
strLocalFile:本地路径
lPageNum:第⼏页页码
将当前打开的⽂件档的第1页以a.doc保存在C盘根⽬录下:
将当前打开的⽂件档的第2页以b.doc保存在C盘根⽬录下:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论