DSOFramer原有的接口说明.doc

上传人:laozhun 文档编号:2883011 上传时间:2023-03-01 格式:DOC 页数:12 大小:46.50KB
返回 下载 相关 举报
DSOFramer原有的接口说明.doc_第1页
第1页 / 共12页
DSOFramer原有的接口说明.doc_第2页
第2页 / 共12页
DSOFramer原有的接口说明.doc_第3页
第3页 / 共12页
DSOFramer原有的接口说明.doc_第4页
第4页 / 共12页
DSOFramer原有的接口说明.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《DSOFramer原有的接口说明.doc》由会员分享,可在线阅读,更多相关《DSOFramer原有的接口说明.doc(12页珍藏版)》请在三一办公上搜索。

1、声明:本文档由山东电建(sddianjian)上传到豆丁网(),若有侵害您的权益,请发站内消息。DSOFramer原有的接口说明=DSOFramer原有的接口说明1.void CreateNew(BSTR ProgIdOrTemplate)新建文档,其中: ProgIdOrTemplate参数:Excel Spreadsheet Excel.Sheet Excel Chart Excel.Chart PowerPoint PresentationPowerPoint.Show Project Project MSProject.Project Visio Drawing Visio.Drawi

2、ng Word Document Word.Document 2.HRESULT Open(in VARIANT Document, in, optional VARIANT ReadOnly, in, optional VARIANT ProgId, in, optional VARIANT WebUsername, in, optional VARIANT WebPassword) 打开文档,可以是本地文件或者是服务器文件参数:Document文档路径ReadOnly是否已只读模式打开ProgId OLE类型WebUsername用户名(访问网络的文件时候,有可能需要)WebPasswor

3、d密码例子:DsoFramer1.Open C:TestBook.xlsDsoFramer1.Open C:Plain.txt, , Word.Document/用Word来打开c:plain.txt文件DsoFramer1.Open https:/secureserver/test/mytest.asp?id=123, True, Excel.Sheet, MyUserAccount, MyPassword3.HRESULT Save(in, optional VARIANT SaveAsDocument, in, optional VARIANT OverwriteExisting, in

4、, optional VARIANT WebUsername, in, optional VARIANT WebPassword);保存文件在本地DsoFramer1.Save c:1.doc4.Activate激活当前文档,没搞明白有什么用5.HRESULT ActiveDocument(out,retval IDispatch* ppdisp);返回当前活动文档的Dispatch接口,这个接口很重要,可以通过这个接口,操作所有的文档接口。如:下面 javascript 语句调用Office内置的对话框var obj;obj = new Object(document.all.FramerC

5、ontrol1.ActiveDocument);if(obj !=null)var dd;dd = obj.Application.Dialogs(84).Show();/. . /delete itdelete obj;6.HRESULT Close();关闭当前文档,建议在页面关闭的时候调用。MS的原来的版本,有时候关不掉Word,已经修复了。7.HRESULT Caption(out,retval BSTR* pbstr);属性,获取|设置窗口标题8.HRESULT Titlebar(in boolean vbool); HRESULT Titlebar(out,retval boole

6、an* pbool); 显示或者隐藏标题栏9. HRESULT Toolbars(in boolean vbool);HRESULT Toolbars(out,retval boolean* pbool); 显示或者隐藏工具栏10.HRESULT ModalState(in boolean vbool); HRESULT ModalState(out,retval boolean* pbool);11.HRESULT ShowDialog(in dsoShowDialogType DlgType);显示对话框12.HRESULT EnableFileCommand(in dsoFileComm

7、andType Item, in boolean vbool);HRESULT EnableFileCommand(in dsoFileCommandType Item, out,retval boolean* pbool);13.HRESULT BorderStyle(in dsoBorderStyle style);HRESULT BorderStyle(out, retval dsoBorderStyle* pstyle);14.HRESULT BorderColor(in OLE_COLOR clr);HRESULT BorderColor(out,retval OLE_COLOR*

8、pclr);15. HRESULT BackColor(in OLE_COLOR clr);HRESULT BackColor(out,retval OLE_COLOR* pclr);16.HRESULT ForeColor(inOLE_COLOR clr);HRESULT ForeColor(out,retvalOLE_COLOR* pclr);17.HRESULT TitlebarColor(in OLE_COLOR clr);HRESULT TitlebarColor(out,retval OLE_COLOR* pclr);18.HRESULT TitlebarTextColor(in

9、OLE_COLOR clr); HRESULT TitlebarTextColor(out,retval OLE_COLOR* pclr);19.HRESULT ExecOleCommand(in LONG OLECMDID, in, optional VARIANT Options, in, optional VARIANT* vInParam, in, out, optional VARIANT* vInOutParam);20.HRESULT Menubar(in boolean vbool);HRESULT Menubar(out,retval boolean* pbool);21.H

10、RESULT HostName(in BSTR bstr);HRESULT HostName(out,retval BSTR* pbstr);22. HRESULT DocumentFullName(out,retval BSTR* pbstr); 文档的路径23.HRESULT PrintOut(in, optional VARIANT PromptUser, in, optional VARIANT PrinterName, in, optional VARIANT Copies, in, optional VARIANT FromPage, in, optional VARIANT To

11、Page, in, optional VARIANT OutputFile);24.HRESULT PrintPreview(); 25.HRESULT PrintPreviewExit();26.HRESULT IsReadOnly(out,retval boolean* pbool); 是否为只读的。27.HRESULT IsDirty(out,retval boolean* pbool); 是否保存了,实际可以用来判读文档有没有修改 oframer.IsDirty = TRUE /文档没有保存,处于修改状态 oframer.IsDirty = FALSE /文档已经保存,没有修改新加的接

12、口说明(开发接口)color=redb当前版本:V2.2.0.8 2007-02-07/b/color下载控件需要登录说明:控件未经大批量测试,难免有Bug,发现 Bug,请及时发帖或者Mail:wanhhf版本修改记录:V2.2.0.8修改: 增加了N多个事件,挺不错的东西 id(DSOF_DISPID_WORD_DocumentChange), helpstring(DSOF_DISPID_WORD_DocumentChange) HRESULT WORD_DocumentChange(); id(DSOF_DISPID_WORD_DocumentBeforePrint), helpstr

13、ing(DSOF_DISPID_WORD_DocumentBeforePrint) HRESULT WORD_DocumentBeforePrint(); id(DSOF_DISPID_WORD_WindowActivate), helpstring(DSOF_DISPID_WORD_WindowActivate) HRESULT WORD_WindowActivate(); id(DSOF_DISPID_WORD_WindowSelectionChange), helpstring(DSOF_DISPID_WORD_WindowSelectionChange) HRESULT WORD_Wi

14、ndowSelectionChange(); id(DSOF_DISPID_WORD_WindowBeforeRightClick), helpstring(DSOF_DISPID_WORD_WindowBeforeRightClick) HRESULT WORD_WindowBeforeRightClick(); id(DSOF_DISPID_WORD_WindowBeforeDoubleClick), helpstring(DSOF_DISPID_WORD_WindowBeforeDoubleClick) HRESULT WORD_WindowBeforeDoubleClick();V2.

15、2.0.6修改: 修改Open,参数为空时候,一个小 Bug 修改了URL过长时候一个Bug 增加了一个替换文字的接口 long ReplaceText(BSTR strSearchText, BSTR strReplaceText,long lGradation);V2.2.0.2修改: 修改了HttpPost相对路径的一些问题。 V2.2.0.0增加: id(0x00010041), helpstring(Get Rev Index) HRESULT GetRevCount( out,retval long * pbool); id(0x00010042), helpstring(Get

16、Rev Index Info) HRESULT GetRevInfo(in long lIndex, inlong lType, out,retval BSTR* pbool); id(0x00010043), helpstring(Set Doc Prop) HRESULT SetValue(in BSTR strValue, inBSTR strName, out,retval long* pbool); id(0x00010044), helpstring(Set Doc Variable) HRESULT SetDocVariable(in BSTR strVarName, inBST

17、R strValue,in long lOpt, out,retval long* pbool); id(0x00010045), helpstring(Save page To Doc) HRESULT SetPageAs(in BSTR strLocalFile, inlong lPageNum, inlong lType,out,retval long* pbool);-LoadDso.jsvar s = s += s += document.write(s) -接口文档:/*1.新建*/新建Worddocument.all.FramerControl1.CreateNew(Word.D

18、ocument);/新建Exceldocument.all.FramerControl1.CreateNew(Excel.Sheet);/*2.打开文件*/打开制定的本地文件document.all.FramerControl1.Open(C:TestBook.xls);/制定用Word来打开c:plain.txt文件document.all.FramerControl1.Open(C:Plain.txt,false, Word.Document);/打开服务器的文件 document.all.FramerControl1.Open https:/secureserver/test/mytes

19、t.asp?id=123,true, Excel.Sheet, MyUserAccount, MyPassword);/打开服务器的文件 document.all.FramerControl1.Open(http:/localhost/1.doc, true);/*3.保存文件*/到本地document.all.FramerControl1.Save(c:1.doc,true);/服务器 /*增加Http协议Post上传接口,可以Post一个动态页面(jsp,asp,php.),由动态页面负责解析数据bool HttpInit();bool HttpAddPostString(BSTR str

20、Name, BSTR strValue);bool HttpAddPostCurrFile(BSTR strFileID, BSTR strFileName);BSTR HttpPost(BSTR bstr); */初始化Http引擎document.all.FramerControl1.HttpInit();/增加Post变量document.all.FramerControl1.HttpAddPostString(RecordID,20060102200);document.all.FramerControl1.HttpAddPostString(UserID,李局长);/上传打开的文件d

21、ocument.all.FramerControl1.HttpAddPostCurrFile(FileData, 文档名.doc);/执行上传动作document.all.FramerControl1.HttpPost( /*4.修订留痕*/进入留痕状态document.all.FramerControl1.SetTrackRevisions(1);/进入非留痕状态document.all.FramerControl1.SetTrackRevisions(0);/接受当前修订document.all.FramerControl1.SetTrackRevisions(4);/*5.设置当前用户*

22、/document.all.FramerControl1.SetCurrUserName(张三); /*6.设置当前时间(笔迹留痕会显示(Like 2006:02:07 11:11:11)*/document.all.FramerControl1.SetCurrTime(2006:02:07 11:11:11);/*7.设置和创建书签,此功能比较强大,设置书签数据、添加书签和添加红头文件就靠他了SetFieldValue(BSTR strFieldName, BSTR strValue, BSTR strCmdOrSheetName)strFieldName:书签名strValue:要设置的值

23、strCmdOrSheetName:命令 :ADDMARK: 添加BookMark:DELMARK: 删除这个BookMark:GETMARK: 定位到这个BookMark:FILE: 插入的是文件:JPG: 插入的是图片一般来说:WORD中书签是做好的,可以通过此接口把外界数据设置进书签中去。*/在当前WORD位置插入标签,标签名为book1,数值为testdocument.all.FramerControl1.SetFieldValue(book1,test,:ADDMARK:);/设置书签Time,数值为2006-03-16 22:22:22document.all.FramerCont

24、rol1.SetFieldValue(Time,2006-03-16 22:22:22,);/在书签位置hongtou,插入红头文件http:/222.222.222.222/hongtou1.doc 这样,红头就自动插进去了document.all.FramerControl1.SetFieldValue(hongtou,http:/222.222.222.222/hongtou1.doc,:FILE:);/*8.设置菜单显示情况BOOL SetMenuDisplay(long lMenuFlag)lMenuFlag为以下数值的组合#define MNU_NEW 0x01#define MN

25、U_OPEN 0x02#define MNU_CLOSE 0x04#define MNU_SAVE 0x08#define MNU_SAVEAS 0x16#define MNU_PGSETUP 0x64#define MNU_PRINT 0x256#define MNU_PROPS 0x32#define MNU_PRINTPV 0x126*/只有“新建”菜单可用 document.all.FramerControl1.SetMenuDisplay(1);/只有“打开”菜单可用 document.all.FramerControl1.SetMenuDisplay(2);/只有“打开”和“新建”

26、菜单可用 document.all.FramerControl1.SetMenuDisplay(3);/*9.保护文档和解保护文档lProOrUn:1:保护文档;0:解除保护lProType: wdNoProtection = -1, wdAllowOnlyRevisions = 0, wdAllowOnlyComments = 1, wdAllowOnlyFormFields = 2strProPWD:密码*/完全保护文档,密码为pwd document.all.FramerControl1.ProtectDoc(1,1,pwd);/解除文档保护 document.all.FramerCon

27、trol1.ProtectDoc(0,1,pwd);/*10.显示或隐藏修订内容ShowRevisions(long nNewValue)nNewValue = 0 则隐藏修订 = 1 则显示修订*/显示修订留痕document.all.FramerControl1.ShowRevisions(1);/隐藏修订留痕document.all.FramerControl1.ShowRevisions(0);/*11.插入合并文件,strFieldPath 文件路径,可以是http,ftp的路径pPos = 0 /当前鼠标位置1;文件开头2;文件末尾pPos的第4位为1的时候,代表插入的是图片InS

28、ertFile(BSTR strFieldPath, long lPos)*/文件头部插入文件document.all.FramerControl1.InSertFile(http:/XX.com/XX.doc,1);/文件尾部插入文件 document.all.FramerControl1.InSertFile(http:/XX.com/XX.doc,2);/当前光标位置插入文件document.all.FramerControl1.InSertFile(http:/XX.com/XX.doc,0);/文件头部插入图片document.all.FramerControl1.InSertFil

29、e(http:/XX.com/XX.jpg,9);/文件尾部插入图片document.all.FramerControl1.InSertFile(http:/XX.com/XX.jpg,10);/当前光标位置插入图片document.all.FramerControl1.InSertFile(http:/XX.com/XX.jpg,8);/*0x31. 文档另存为 HRESULT SaveAs(in VARIANT strFileName, in VARIANT dwFileFormat, out,retval long* pbool); 参数: strFileName:文件本地路径,如c:1

30、1.doc dwFileFormat: 文件格式dwFileFormat的数值为:Excel: Typeenum 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, xlExcel97

31、95 = 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, xlWK

32、4 = 38, xlWK3FM3 = 32, xlWKS = 4, xlWorks2FarEast = 28, xlWQ1 = 34, xlWJ3 = 40, xlWJ3FJ3 = 41, xlUnicodeText = 42, xlHtml = 44;Word: Typeenum WdSaveFormat wdFormatDocument = 0, wdFormatTemplate = 1, wdFormatText = 2, wdFormatTextLineBreaks = 3, wdFormatDOSText = 4, wdFormatDOSTextLineBreaks = 5, wdF

33、ormatRTF = 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, ppSaveAsPowerPoi

34、nt4FarEast = 10, ppSaveAsDefault = 11, ppSaveAsHTML = 12, ppSaveAsHTMLv3 = 13, ppSaveAsHTMLDual = 14, ppSaveAsMetaFile = 15, ppSaveAsGIF = 16, ppSaveAsJPG = 17, ppSaveAsPNG = 18, ppSaveAsBMP = 19;*/*0x32. 删除本地文件 HRESULT DeleteLocalFile(in BSTR strFilePath); 参数: strFileName:文件本地路径,如c:11.doc */ /*0x33

35、.创建临时文件 HRESULT GetTempFilePath(out,retval BSTR* strValue); 返回: 临时文件的路径地址。使用完后,用DeleteLocalFile 删除*/*0x34.设置文档显示模式 HRESULT ShowView(in long dwViewType, out,retval long * pbool); dwViewType的可取值为:enum WdViewType wdNormalView = 1, wdOutlineView = 2, wdPrintView = 3, wdPrintPreview = 4, wdMasterView = 5

36、, /这个是大纲 wdWebView = 6;*/ /大纲模式document.all.FramerControl1.ShowView(5);/*0x39:下载远程文件 HRESULT DownloadFile( in BSTR strRemoteFile, in BSTR strLocalFile, out,retvalBSTR* strValue); 参数: strRemoteFile:远程路径地址,http or Ftp strLocalFile: 本地保存地址,if strLocalFile = NULL then Create Temp File and return TempFil

37、es Path*/*0x40:增加Http上传时候的,附加其他文件 HRESULT HttpAddPostFile(in BSTR strFileID, inBSTR strFileName, out,retval long* pbool);参数: strFileID:文件的ID,供服务器端页面解析 strFileName: 本地文件地址 */*0x41,0x42.获取详细的修订信息。 GetRevCount( out,retval long * pbool); GetRevInfo(in long lIndex, inlong lType, out,retval BSTR* pbool);

38、例子如下*/var vCount;vCount = document.all.FramerControl1.GetRevCount();alert(vCount);var vOpt = 0;var vDate;for(var i=1; i= vCount; i+) vOpt = document.all.FramerControl1.GetRevInfo(i,2); if(1 = vOpt) vOpt = 插入; else if(2 = vOpt) vOpt = 删除; else vOpt = 未知操作; vDate = new String(document.all.FramerContro

39、l1.GetRevInfo(i,1); vDate = parseFloat(vDate); alert(vDate); dateObj = new Date(vDate);alert(dateObj.getYear() + 年 + dateObj.getMonth() + 1 + 月 + dateObj.getDate() +日 +dateObj.getHours() +时 +dateObj.getMinutes() +分 +dateObj.getSeconds() +秒 ); alert(用户:+document.all.FramerControl1.GetRevInfo(i,0) + rn操作: + vOpt + rn内容: + document.all.FramerControl1.GetRevInfo(i,3);/*0x43.设置基本信息: HRESULT SetValue(in BSTR strValue, inBSTR strName, out,retval long* pbool);1.设置文件只读密码 SetValue(password,:DOCPROP:Pas

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号