DSOFramer使用
更新时间:2023-11-02 12:49:01 阅读量: 综合文库 文档下载
DSOFramer使用
1.void CreateNew(BSTR ProgIdOrTemplate)
新建文档,
其中: ProgIdOrTemplate参数: Excel Spreadsheet \ Excel Chart \
PowerPoint Presentation \ 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(); //... ... //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 //文档已经保存,没有修改 新加的接口说明(开发接口)
[color=red][b]当前版本:V2.2.0.8 2007-02-07[/b] [/color]下载控件需要登录 说明:
控件未经大批量测试,难免有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(); [id(DSOF_DISPID_WORD_WindowActivate), helpstring(\
HRESULT WORD_WindowActivate();
[id(DSOF_DISPID_WORD_WindowSelectionChange), helpstring(\
HRESULT WORD_WindowSelectionChange(); [id(DSOF_DISPID_WORD_WindowBeforeRightClick), helpstring(\
HRESULT WORD_WindowBeforeRightClick();
[id(DSOF_DISPID_WORD_WindowBeforeDoubleClick), helpstring(\
HRESULT WORD_WindowBeforeDoubleClick(); V2.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(\ HRESULT GetRevCount( [out,retval] long * pbool); [id(0x00010042), helpstring(\
HRESULT GetRevInfo([in] long lIndex, [in] long lType, [out,retval] BSTR* pbool);
[id(0x00010043), helpstring(\
HRESULT SetValue([in] BSTR strValue, [in] BSTR strName, [out,retval] long* pbool);
[id(0x00010044), helpstring(\
HRESULT SetDocVariable([in] BSTR strVarName, [in] BSTR strValue,[in] long lOpt, [out,retval] long* pbool);
[id(0x00010045), helpstring(\
HRESULT SetPageAs([in] BSTR strLocalFile, [in] long lPageNum, [in] long lType,[out,retval] long* pbool);
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
LoadDso.js var s = \
s += \TOP: 0px; HEIGHT: 100%'\
s += \codeBase=DSOFramer.ocx#Version=2,2,0,6' >\
s += \ document.write(s) 接口文档: /* 1.新建 */
//新建Word
document.all.FramerControl1.CreateNew(\ //新建Excel
document.all.FramerControl1.CreateNew(\ /*
2.打开文件 */
//打开制定的本地文件
document.all.FramerControl1.Open(\
//制定用Word来打开c:\\plain.txt文件
document.all.FramerControl1.Open(\ //打开服务器的文件
document.all.FramerControl1.Open
\\
//打开服务器的文件
document.all.FramerControl1.Open(\ /*
3.保存文件 */ //到本地
document.all.FramerControl1.Save(\ //服务器
/*增加Http协议Post上传接口,可以Post一个动态页面(jsp,asp,php...),由动态页面负责解析数据
bool HttpInit();
bool HttpAddPostString(BSTR strName, BSTR strValue); bool HttpAddPostCurrFile(BSTR strFileID, BSTR strFileName); BSTR HttpPost(BSTR bstr); */
//初始化Http引擎
document.all.FramerControl1.HttpInit(); //增加Post变量
document.all.FramerControl1.HttpAddPostString(\
document.all.FramerControl1.HttpAddPostString(\李局长\ //上传打开的文件
document.all.FramerControl1.HttpAddPostCurrFile(\文档名.doc\ //执行上传动作
document.all.FramerControl1.HttpPost(\ /*
4.修订留痕 */
//进入留痕状态
document.all.FramerControl1.SetTrackRevisions(1); //进入非留痕状态
document.all.FramerControl1.SetTrackRevisions(0); //接受当前修订
document.all.FramerControl1.SetTrackRevisions(4); /*
5.设置当前用户 */
document.all.FramerControl1.SetCurrUserName(\张三\ /*
6.设置当前时间(笔迹留痕会显示(\ */
document.all.FramerControl1.SetCurrTime(\ /*
7.设置和创建书签,此功能比较强大,设置书签数据、添加书签和添加红头文件就靠他了
SetFieldValue(BSTR strFieldName, BSTR strValue, BSTR strCmdOrSheetName)
strFieldName:书签名 strValue:要设置的值 strCmdOrSheetName: 命令
::ADDMARK:: 添加BookMark ::DELMARK:: 删除这个BookMark ::GETMARK:: 定位到这个BookMark ::FILE:: 插入的是文件 ::JPG:: 插入的是图片
一般来说:WORD中书签是做好的,可以通过此接口把外界数据设置进书签中去。 */
//在当前WORD位置插入标签,标签名为\数值为\
document.all.FramerControl1.SetFieldValue(\ //设置书签\数值为\
document.all.FramerControl1.SetFieldValue(\ //在书签位置\插入红头文件\这样,红头就自动插进去了
document.all.FramerControl1.SetFieldValue(\/hongtou1.doc\
/*
8.设置菜单显示情况
BOOL SetMenuDisplay(long lMenuFlag)
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 }; */ /*
0x32. 删除本地文件
HRESULT DeleteLocalFile([in] BSTR strFilePath); 参数:
strFileName:文件本地路径,如c:\\\\11.doc */ /*
0x33.创建临时文件
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, //这个是大纲 wdWebView = 6 }; */ //大纲模式
document.all.FramerControl1.ShowView(5); /*
0x39:下载远程文件
HRESULT DownloadFile( [in] BSTR strRemoteFile, [in] BSTR strLocalFile, [out,retval] BSTR* strValue);
参数:
strRemoteFile:远程路径地址,http or Ftp
strLocalFile: 本地保存地址,if strLocalFile == NULL then Create Temp File and return TempFile's Path
*/ /*
0x40:增加Http上传时候的,附加其他文件
HRESULT HttpAddPostFile([in] BSTR strFileID, [in] BSTR strFileName, [out,retval] long* pbool);
参数:
strFileID:文件的ID,供服务器端页面解析 strFileName: 本地文件地址 */ /*
0x41,0x42.获取详细的修订信息。
GetRevCount( [out,retval] long * pbool);
GetRevInfo([in] long lIndex, [in] long lType, [out,retval] BSTR* pbool); 例子如下 */
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(\ vOpt = \插入\ }else if(\ vOpt = \删除\
}else{
vOpt = \未知操作\ }
vDate = new String(document.all.FramerControl1.GetRevInfo(i,1)); vDate = parseFloat(vDate); alert(vDate);
dateObj = new Date(vDate);
alert(dateObj.getYear() + \年\月\
dateObj.getDate() +\日\时\分\+ dateObj.getSeconds() +\秒\
alert(\用户:\操作:\vOpt + \内容:\
} /*
0x43.设置基本信息:
HRESULT SetValue([in] BSTR strValue, [in] BSTR strName, [out,retval] long* pbool);
1.设置文件只读密码
SetValue(\ 2.设置文件修改密码
SetValue(\ 返回值: 0 正确
-1:不支持此命令,请确定您的第二个参数没有传错 -127:异常 */
正在阅读:
DSOFramer使用11-02
高精度数字温度传感器ds1624及其应用08-08
最新户外拓展训练心得体会范文11-21
(0685)《土地资源学》复习思考题答案07-21
新鲁教版(五四制)小学语文六年级上册《看云识天气》资料作者简06-06
地藏禅寺因果教育实录(圣云法师讲因果)01-15
2013年青岛市义务教育学校市级三好学生、优秀学生干部和先进班集05-16
给父母的感恩信300字04-29
电磁学有限元分析04-02
手工皂项目商业计划书05-05
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- DSOFramer
- 使用
- 体操实习教案(1)(1)x
- “两体系”培训考核试题答案docx
- 刑法学总论试题B
- 《史记》选修第一单元检测题
- 进口轴承前后置代码
- 初中数学北师大版《七年级下》《第一章 整式的运算》《1.9 整式的除法》精选专项试题练习含
- 世格人力资源模拟系统 撰写招聘广告 高分记录
- 同济大学电工学试题库及答案
- 《陋室铭》《爱莲说》比较阅读
- 大荒山风电场东部进场道路汇报材料10.08 - 图文
- 服务区突发事件应急预案
- 选择题重点1
- 高一物理--力学整理 - 经典练习题
- 八年级语文上册专项复习--文学常识与名著阅读(带答案新人教版)
- 博爱竹园路施工组织设计讲解 - 图文
- 小学新标准英语三起第七册教案
- 监理工程通知回复单
- 初中英语语法大全
- 公路工程路基路面试题及答案
- 结构化学课后答案