DSOFramer原有的接口说明 联系客服

发布时间 : 星期四 文章DSOFramer原有的接口说明更新完毕开始阅读9e3e02cd33687e21af45a9f9

DSOFramer原有的接口说明

DSOFramer原有的接口说明

===================================================================

DSOFramer原有的接口说明

1.void CreateNew(BSTR ProgIdOrTemplate) 新建文档,

其中: ProgIdOrTemplate参数: Excel Spreadsheet \ Excel Chart \ PowerPoint Presentation \

owerPoint.Show\

Project Project \ Visio Drawing \ 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 用户名(访问网络的文件时候,有可能需要) WebPassword 密码 例子:

DsoFramer1.Open \

DsoFramer1.Open \用Word来打开c:\\plain.txt文件 DsoFramer1.Open \\

3.HRESULT Save([in, optional] VARIANT SaveAsDocument, [in, optional] VARIANT OverwriteExisting, [in, optional] VARIANT WebUsername, [in, optional] VARIANT WebPassword);

保存文件在本地

DsoFramer1.Save \

4.Activate

激活当前文档,没搞明白有什么用

5. HRESULT ActiveDocument([out,retval] IDispatch** ppdisp);

返回当前活动文档的Dispatch接口,这个接口很重要,可以通过这个接口,操作所有的文档接口。 如:下面 javascript 语句调用Office内置的对话框 var obj;

obj = new Object(document.all.FramerControl1.ActiveDocument); if(obj !=null){ var dd;

dd = obj.Application.Dialogs(84).Show();//弹出保存对话框 dd = obj.Application.Dialogs(80).Show();//弹出打开对话框 dd = obj.Application.Selection.EndKey(6);//光标移到行尾 dd = obj.Application.Selection.WholeStory();//文档全选

var str =obj.Application.ActiveDocument.Words(1);// 选择当前文档中的第一个词 var str =obj.Application.Selection.Sentences.Item(1); 所选区域中的第一句的内容

var str =obj.Application.ActiveDocument.Paragraphs(1).Range.Text;// 返回当前文档中第一段的内

obj.Application.Selection.InlineShapes.AddOLEObject(\插入公式对象

//... ... //delete it delete obj; }

6. HRESULT Close();

关闭当前文档,建议在页面关闭的时候调用。

MS的原来的版本,有时候关不掉Word,已经修复了。 7. HRESULT Caption([out,retval] BSTR* pbstr); 属性,获取|设置窗口标题

8. HRESULT Titlebar([in] boolean vbool); HRESULT Titlebar([out,retval] boolean* 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] dsoFileCommandType 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* pclr);

15. HRESULT BackColor([in] OLE_COLOR clr); HRESULT BackColor([out,retval] OLE_COLOR* pclr);

16.HRESULT ForeColor([in]OLE_COLOR clr); HRESULT ForeColor([out,retval]OLE_COLOR* pclr);

17.HRESULT TitlebarColor([in] OLE_COLOR clr); HRESULT TitlebarColor([out,retval] OLE_COLOR* pclr);

18.HRESULT TitlebarTextColor([in] 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.HRESULT 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 ToPage, [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 //文档已经保存,没有修改

新加的接口说明(开发接口)

当前版本:V2.2.0.8 2007-02-07 下载控件需要登录 说明:

控件未经大批量测试,难免有Bug,

发现 Bug,请及时发帖或者Mail:wanhhf@gmail.com 版本修改记录: V2.2.0.8修改:

增加了N多个事件,挺不错的东西

[id(DSOF_DISPID_WORD_DocumentChange), helpstring(\ HRESULT WORD_DocumentChange();

[id(DSOF_DISPID_WORD_DocumentBeforePrint), helpstring(\ HRESULT WORD_DocumentBeforePrint();