首页 LotusDomino学习笔记

LotusDomino学习笔记

举报
开通vip

LotusDomino学习笔记Lotus Domino WEB 开发技术积累 Lotus Domino WEB 开发技术积累 目录: 1.​  TOC \o "1-3" \h \z \u 选取视图的列的内容 @Trim @DbColumn 6 2.​ 隐藏判断常用的命令 6 3.​ 判断当前用户是否是“某个组”的成员,然后来显示和隐藏 6 4.​ 在Lotus Domino 中显示图 6 5.​ 链接JS文件 6 6.​ 删除文档的方法 7 7.​ $$return 域的使用 8 8.​ 将表单设计为视图或导航器模板 9 9.​ 为 Web 定...

LotusDomino学习笔记
Lotus Domino WEB 开发技术积累 Lotus Domino WEB 开发技术积累 目录: 1.​  TOC \o "1-3" \h \z \u 选取视图的列的内容 @Trim @DbColumn 6 2.​ 隐藏判断常用的命令 6 3.​ 判断当前用户是否是“某个组”的成员,然后来显示和隐藏 6 4.​ 在Lotus Domino 中显示图 6 5.​ 链接JS文件 6 6.​ 删除文档的 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 7 7.​ $$return 域的使用 8 8.​ 将表单 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 为视图或导航器模板 9 9.​ 为 Web 定制“表单已处理”确认信息 10 10.​ 定制出错信息 11 11.​ $$HtmlHead几种常用的技巧 11 12.​ Domino Designer 模板表 12 13.​ 角色判断 13 14.​ 判断文档是否正在被修改 13 15.​ 在只读的方式下返回($$return 13 16.​ 刷新表单 14 17.​ 怎样在文档里存照片? 14 18.​ 后台lotusscript如何取得前台表单中复选框所选择的项目列表(b/s结构) 15 19.​ 试图的列公式:附件下载 15 20.​ 有没有好一点的分页处理代码 16 21.​ 同一用户重复登录 18 22.​ Return to sender 19 23.​ Agent to copy values from 1 form to another 在同一个数据库中进行 22 24.​ 超越OLE – 通过COM结合MS Office与Notes应用 23 25.​ 读写关系数据库资料 28 26.​ 视图---excel,表单---word 32 27.​ 关于Web上的检索问 快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题 35 28.​ 如何使用Notes与关系数据库进行信息交互? 37 29.​ 如何在IE里面实现notes中的 对话框列表? 39 30.​ LotusDomino环境下编写Web浏览器多数据库检索程序 40 31.​ WINAPI函数 44 32.​ 用PowerBuilder访问Lotus Notes数据库 55 33.​ 如何在表单中加入计数器 58 34.​ 实现两个数据库间的数据追加 C/S 结构 60 35.​ 如何防止他人使用旧id和旧口令访问Domino服务器? 61 36.​ 在你的WEB站点上使用DOMINO群集 62 37.​ 在你的DOMINO WEB站点中插入.SWF文件 73 38.​ DOMINO R5的域搜索功能在WEB上的实现 77 39.​ Display Rich Text fields in a view 86 40.​ Auto-Launch a file attachment 87 41.​ Showing a response count without showing the responses 89 42.​ 常用的几个按钮收集 91 43.​ 在WEB上从视图删除文档技巧 93 44.​ 在Domino Designer中使用XML数据 96 45.​ 在Domino Designer上执行XML 100 46.​ Show single category view, the next stage 107 47.​ Checkboxes in a list box 108 48.​ Formatting a Notes view in HTML table for WEB 109 49.​ Jump to the end of a view (web agent) 111 50.​ Disabling actions until a page finishes loading 114 51.​ Web-based, fully customizable search 115 52.​ 从复选框中删除文档Deleting selected docs on Web 120 53.​ Debugging LotusScript Agents 121 54.​ Displays the contents of the Subject field in the first document in theExamples view. 124 55.​ Example: GetLastDocument method 125 56.​ Examples: GetNextDocument method 125 57.​ Example: GetFirstDocument method 126 58.​ Examples: FTSearch method 127 59.​ Examples: DeleteDocument method 128 60.​ Example: Deleting a document 129 61.​ Example: Creating a document 129 62.​ Examples: Locating documents within a view or folder 130 63.​ Example: Adding a document 135 64.​ Export to Excel 136 65.​ 连接ODBC 138 66.​ 特效 140 67.​ notes和Excel交换数据 141 68.​ NOTES的ODBC:(LS:DO) 142 69.​ Managing JavaScript "popup" windows 第一稿 144 70.​ HEAD元素使用集锦 147 71.​ 主页javascript特效19则 148 72.​ 关于创建、删除、编辑、打开和保存文档的 URL 命令 156 73.​ Domino URL 命令 158 74.​ 在打开有下面这段代码的页面时将会跳出一个468x60大小的小窗口 160 75.​ javascript的容错脚本 161 76.​ Web search with JavaScript 162 77.​ 如何防止他人使用旧id和旧口令访问Domino服务器 164 78.​ Fixing the Domino CheckBox Bug 165 79.​ Managing JavaScript "popup" windows 172 80.​ Quick, easy, foolproof field level help 175 81.​ Quick edit document link 176 82.​ Managing JavaScript "popup" windows 178 83.​ Svg: Pie-Eyed 181 84.​ Recebt Entries 182 85.​ Xin Calendar Mods 183 86.​ 答复文档 186 87.​ 公式语言 187 88.​ Resuable way to get URL parameters into fields 199 89.​ JSHeader 使用 201 90.​ JavaScript 帮助 201 91.​ Examples: Collecting documents by searching 207 92.​ 关于DOcumentContext 的属性 209 93.​ About data types 关于lotus Domino 的数据类型 210 94.​ CLng function 212 95.​ Using the DOM to replace "No documents found" 213 96.​ What you need and want to know about errors 217 97.​ Processing multiple documents from a view 221 98.​ Forcing attachments to always download 225 99.​ ODBCExample: GetValue method 247 100.​ ODBCResultSet class 248 101.​ Create a "Login" anchor link 251 102.​ 分类视图的开发技巧 253 103.​ 公式语言 255 104.​ Copy documents from one database to another 267 105.​ 定制搜索表单 268 106.​ UserName的属性及使用 275 107.​ Dynamic Content for Popup Windows 277 108.​ Shortcut when printing from a Java Agent 278 109.​ Lotus Script: Write # statement 279 110.​ Lotus Script: Input # statement 280 111.​ 使用代理生成 XML 284 112.​ 使用视图生成 XML 286 113.​ 执行算术运算 288 114.​ Keep URLs simple by making them relative 292 115.​ Quick, easy, foolproof field level help 294 116.​ Hiding attachments (without noscript tag!) 295 117.​ Listing search results in groups 296 118.​ 如何在表单中加入计数器? 300 119.​ 怎样限制一个WEB用户只有登陆才能使用数据库 302 120.​ Complete control when printing HTML from an agent 304 121.​ Simple multi-lingual forms using Domino 306 122.​ Stop double form submissions 308 1.​  选取视图的列的内容 @Trim @DbColumn 备注 程序代码 @Trim(@DbColumn("":"nocache";@DbName;"bjialist";1)) 2.​  隐藏判断常用的命令 备注 程序代码 @IsDocBeingEdited|!@IsMember("[admin]";@UserRoles) 3.​  判断当前用户是否是“某个组”的成员,然后来显示和隐藏 备注 程序代码 @IsMember("names.nsf中的用户组";@UserNamesList) 4.​  在Lotus Domino 中显示图 备注 程序代码 img:="

"; @If(@AttachmentNames!="";img;" ") 5.​  链接JS文件 备注 程序代码 "" 6.​  删除文档的方法 备注 程序代码 REM "Do not show delete link on a new document"; @If(@IsNewDoc; ""; "Delete Document...") REM "Do not show delete link on a new document"; @If(@IsNewDoc; ""; "") 7.​  $$return 域的使用 备注 程序代码 返回到另外的一个页面 "[http://www.lotus.com]" 增加到另外页面的链接 "Lotus" 个人化信息 "

谢谢您的文档,"+@name{[cn];@userName}+"!


" 返回到文档,查询刚才输入的信息 Rem "Anchors to document view" " " + "查询输入的内容"+"" 在$$Return域中使用JavaScript : back2:=”” back3:=”” @if(@IsNewdoc;back2;back3) Create a view (All) with all documents of your db.In your form create a computed field called Doc_ID with formula @Text(@DocumentUniqueId) and a $$Return field with: dominoserver:=@Name([CN];@Subset(@DbName;1)); filename:=@Subset(@DbName;-1); Doc_Id:=Doc_Id; "[http://"+dominoserver+"/"+filename+"/All/"+Doc_Id+"?opendocument]". 8.​  将表单设计为视图或导航器模板 备注 程序代码 在 Web 应用程序中,要创建表单与视图或导航器之间的关联,可为表单指派一个保留名称。用户打开视图或导航器时 Domino 将表单用作模板。这对于在站点上创建视图和导航器的 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 显示来说是一种好方法。 使用以下保留表单名称创建表单与视图或导航器之间的关联。 请注意 Domino 要求表单上必须有嵌入视图或 $$ViewBody 域,但可以不考虑其值。 表单名称 必需的设计元素 注释 $$ViewTemplate for viewname 嵌入视图或 $$ViewBody 域 将表单与特定视图关联。表单名包括 viewname,即视图的别名,如果没有别名,就包括视图的名称。 $$NavigatorTemplate for navigatorname 嵌入导航器或 $$NavigatorBody 域 将表单与特定导航器关联。表单名包括 navigatorname,即导航器名称。例如:被命名为 "$$NavigatorTemplate for World Map" 的表单将与 World Map 导航器关联。 Domino 忽略在表单上创建和读取存取列表。 $$ViewTemplateDefault 嵌入视图或 $$ViewBody 域 使该表单成为所有与另一表单不关联的 Web 视图的模板。 $$NavigatorTemplateDefault 嵌入导航器或 $$NavigatorBody 域 使该表单成为所有与另一表单不关联的 Web 导航器的模板。 9.​  为 Web 定制“表单已处理”确认信息 备注 程序代码 Web 用户提交文档后,Domino 使用缺省的“表单已处理”的确认信息回应用户。要重新设置缺省答复,可将计算文本域添加到表单中,给此域命名为 $$Return,并使用 HTML 作为计算值来创建定制的批准。 显示个人化答复 下面的 $$Return 公式返回答复“Thank you”,并附加上用户姓名: who:= @If(@Left(From; " ") = ""; From; @Left(From; " ")); @Return("

Thank you, " + who + "


Main View"); 显示定制的错误消息 要定制显示给 Web 用户的错误消息外观,向数据库中添加定制的错误消息表单。如果发生错误条件,且其定制表单存在,则 Domino 使用定制表单来显示错误消息。否则,Domino 使用缺省错误消息表单。添加到数据库的消息表单将覆盖由管理员设置的服务器范围内的消息。 要在表单和错误条件之间创建关联,创建拥有下列名称之一的表单。然后创建名为 MessageString 的可编辑的文本域来保存错误消息。添加要与错误消息一起显示的其他文本、链接以及其他表单对象。 表单名称 条件 $$ReturnAuthenticationFailure 不能校验用户名称和口令。 $$ReturnAuthorizationFailure 用户对该数据库没有足够的存取级别。 $$ReturnDocumentDeleted 成功删除文档。 $$ReturnGeneralError 出现了其他错误条件。 链接到另一页面 根据提交文档中的域值,在 HTML 中包括链接到另一页面的 URL。下面的 $$Return 公式根据用户选择的范围返回答复。例如:如果用户选择欧洲,则消息“在意大利访问我们的站点”将显示一个链接,可链接到意大利的 Web 站点(假定公式中的“stdAnswer”和“stdFooter”已预先定义。)。 @If(Region="Asia"; stdAnswer + "

Visit our site in Japan

" + stdFooter; Region="Europe"; stdAnswer + "

Visit our site in Italy

" + stdFooter; stdAnswer + stdFooter); 返回另一页面 要跳转到不同的 Web 页面,可将页面的 URL 用括号括起来放入页面。当用户提交文档时,Web 客户机将显示引用的文档。例如:下面的 $$Return 公式显示 Lotus 日本站点的主页。 "[http://www.japan.lotus.com]" 10.​  定制出错信息 备注 程序代码 要想在发生一个错误之后,向用户返回定制的出错信息,可以使用如下的表单: 表单名称 描述 $$ReturnDocumentDeleted 用户成功删除了文档 $$ReturnAuthenticationFailure 用户的名称和密码无法验证 $$ReturnAuthorizationFailure 用户没有足够高的权限来访问数据库 $$ReturnGeneralError 发生了任何其他类型的错误 11.​  $$HtmlHead几种常用的技巧 备注 程序代码 自动刷新WEB页面: a http-equiv=\”refresh\” content=2>” 自动链接到另外的页面: URL:=”http://www.lotus.com”; “” 例子: url:="http://190.2.40.220/jjxmxx.nsf/jjxmxx_view?OpenForm"; "" 12.​  Domino Designer 模板表 备注 程序代码 模板在开发流程的后期被更新。当 Domino Designer 可以使用时,下表列出的模板可能已经改变,或者附加了一些可用模板。 如果使用 Domino Designer 安装模板,则可以在 Notes 程序目录下找到它们。 数据库标题 文件名及设计模板名 面向对象 描述 讨论- Notes & Web (R5.0) (*) discsw50.ntf StdR50Disc Notes 的一般用户和 Web 浏览器用户 电子会议室。 特性: 具有内置用户简要表来自动邮寄感兴趣的项目链接的线程化讨论。 匿名答复、归档和创建公用/私有线程。Web 浏览器用户的多导航器、备用视图模板和热点操作。 文档集-Notes & Web (R5.0) (*) doclbw50.ntf StdR50WebDocLib Notes 的一般用户和 Web 浏览器用户 文档存储。 特性:评阅工作流程(串行和并行)和归档。 Microsoft Office 文档集 (R5.0) doclbm50.ntf StdR50DocLibMS Notes 的一般用户 为此应用程序套件开发的文档集的特殊版本。 自动装载 OLE 对象并将 OLE 对象放大到窗口大小;并存储和支持文档(由套件创建)的评阅流程。 个人日志 (R4) journal4.ntf StdR4Journal Notes 的一般用户 电子日记,用户可使用它来记录个人想法和个人文档。其中包括定制设计的指令。 站点注册 5.0 siregw50.ntf StdSite50Reg Web 浏览器用户 一个样例,演示如何为基于 Domino 的应用程序注册 Web 用户。不用手动干涉用户即可自动创建帐号。 工作室 (R5.0) (*) teamrm50.ntf StdR50TeamRoom Notes 的一般用户和 Web 浏览器用户 工作组协同工作的模型。 维护若干文档交流类型来提交会议、讨论和操作项目。功能并行, 评阅进程、归档和新闻简报。 13.​  角色判断 备注 程序代码 !@IsMember("admin"; @UserRoles) 14.​  判断文档是否正在被修改 备注 程序代码 @Isdocbeingedited 15.​  在只读的方式下返回($$return 备注 程序代码 比如修改$$return 再比如在按钮里面写公式: jspath:="/"+@ReplaceSubstring(@Subset(@DbName;-1);"\\";"/"); @Command([FileSave]);@URLOpen(jspath+"/0/"+docid+"?opendocument") 16.​  刷新表单 备注 程序代码 calling _doClick('$Refresh', this, '_self') through javacript will refresh the form and reloads the tables 17.​  怎样在文档里存照片? 备注 程序代码 建一个域(RTF),将该域设置成热点,然后对其click编写如下公式: @command([FileImport];"文件类型";"所在目录") 其中文件类型对于图片可以是gif/jpeg格式的,可以省略 所在目录,可选 18.​  后台lotusscript如何取得前台表单中复选框所选择的项目列表(b/s结构) 备注 程序代码 Dim DQsessionnew As New notessession Dim workspace As New NotesUIWorkspace Dim DQdocument As Notesdocument Dim DQdatabase As Notesdatabase Dim Dqitem As NotesItem Dim DQuid Set DQdatabase = DQsessionnew.CURRENTDATABASE Set DQuid = workspace.CurrentDocument Set DQdocument=DQuid.document Set DQitem = DQdocument.GetFirstItem("A") Forall v In DQitem.Values Messagebox( v ) End Forall A为复选域名 同意 gwmdj(gw) ; 最好将 A为复选域名 改为$$SelectDoc 19.​  试图的列公式:附件下载 备注 程序代码 _docRef := "0/" + @Text(@DocumentUniqueID); _attachRef := @ReplaceSubstring(@AttachmentNames; " "; "+"); _href := _docRef + "/$File/" + _attachRef + "?OpenElement"; _aTag := "" +"  "+ title + ""; _html := "[" + @Implode(_aTag; ", ") + "]"; @If(@Attachments = 0; title; _html) 20.​  有没有好一点的分页处理代码 备注 程序代码 在clpclub上看到的 该代理在webqueryopen里面打开 文章主题:RE: 有没有好一点的分页处理代码?呵呵 :) 狂雷天牢 2002-03-15 11:43:26 -------------------------------------------------------------------------------- Sub Initialize Dim s As New NotesSession Dim doc As NotesDocument Set doc=s.DocumentContext Dim db As NotesDatabase Set db=s.CurrentDatabase Dim view As NotesView Set view=db.GetView(doc.v_view(0)) If view Is Nothing Then Msgbox "view is Nothing!" Goto bz End If Dim viewdc As NotesViewEntryCollection If doc.v_keysort(0)<>"" Then Set viewdc=view.GetAllEntriesBykey(doc.v_keysort(0)) Else Set viewdc=view.AllEntries End If Dim numdoc,rowsperpage As Integer numdoc=viewdc.count rowsperpage=Val(doc.v_rowsperpage(0)) If (numdoc Mod rowsperpage)=0 Then doc.v_pagenum=numdoc/rowsperpage Else doc.v_pagenum=Int(numdoc/rowsperpage)+1 End If Dim start As Variant start=Evaluate({@middle(query_string;"start=";"&")},doc) If start(0)<>"" Then doc.v_currentpage=Int(Val(start(0))/rowsperpage)+1 Else doc.v_currentpage="1" start(0)="1" End If Dim item As NotesItem Set item=doc.GetFirstItem("v_dispage") If Cstr(doc.v_gopage(0))<>"" Then start(0)=(doc.v_gopage(0)-1)*rowsperpage+1 End If For i=Int(Val(start(0))/rowsperpage)-4 To Int(Val(start(0))/rowsperpage)+4 If i>=0 Then If i>=doc.v_pagenum(0) Then Exit For End If If i=Int(Val(start(0))/rowsperpage) Then Call item.AppendToTextList("当前第"+Cstr(i+1)+"页") Else Call item.AppendToTextList("[["+Cstr(i+1)+"]]") End If End If Next bz: Print {} Print {} End Sub 21.​  同一用户重复登录 备注 程序代码 var ConflictResult=document.forms[0].ConflictResult.value; if ((ConflictResult.indexOf("同一用户重复登录!")!=-1) || (ConflictResult.indexOf("文档锁定!")!=-1)){ while(ConflictResult.indexOf("\\n")!=-1) ConflictResult=ConflictResult.replace("\\n","\n"); alert(ConflictResult); } document.forms[0].ConflictResult.value=""; 就是用户对于同一份文档重复登录时,提示此文档已被锁定,由某用户正在编辑。仅供参考。 Remind:此消息由justle在08-15 14:50:08做过手脚,呵呵…… 22.​  Return to sender 备注 This Lotus developer was trying to come up with a clever solution to forward incoming emails to recipients' text enabled mobile phones. Instead he ended up setting off a mail bomb on himself and his ASP. The following story is a good example of how a clever idea can blow up in your face, or your inbox. 程序代码 This Lotus developer was trying to come up with a clever solution to forward incoming emails to recipients' text enabled mobile phones. Instead he ended up setting off a mail bomb on himself and his ASP. The following story is a good example of how a clever idea can blow up in your face, or your inbox. I was doing some development work to create an agent that would run when a new mail arrives and send a summary to the mobile phone text service (SMS). I had set the agent to run on new mail received but for each mail received it sent summaries of all e-mails in my DB! Anyway the poor ASP that was forwarding my sms's had a limit of 100 per day so any subsequent sms was rejected with an e-mail, which in turn triggered another flood of emails which in turn resulted in a stream of rejections which in turn... well you get the picture. I left this running overnight!!!! The result: Some 40,000 e-mails outbound with a similar number inbound and a very cranky ASP. I was very red-faced then next morning to return to the office with a lot of phone messages from ASP. It was an easy fix though, but now I have lifetime ban from the ASP, I have now fixed the agent (below) which looks in the calendar profile for details of SMS email address the Agent is set to run 'AfterNew mail Has Arrived' on Newly Received Mail Documents. Code: 'Options Option Public Option Declare Sub Initialize Dim session As New NotesSession Dim dbCurrent As NotesDatabase Dim collUnprocessed As NotesDocumentCollection Dim docCurrent As NotesDocument Dim itemBody As NotesItem Dim strPriority As String, strImportance As String Dim varBody As Variant Dim strSendTo As String Dim m_calprofile As notesdocument Dim sendsms As String Set dbCurrent = session.CurrentDatabase Set m_calprofile = dbCurrent.GetProfileDocument("CalendarProfile") strSendTo = M_calprofile.SMSAddress(0) 'Celluar pager address sendsms = M_calprofile.SMSOwner(0) If sendsms = "Yes" Then 'I want to be notified If (dbCurrent Is Nothing) Then 'Nothing to Process Else Set collUnprocessed = dbCurrent.UnprocessedDocuments If collUnprocessed.Count < 1 Then Else Set docCurrent = collUnprocessed.GetFirstDocument If (docCurrent Is Nothing) Then 'No handle for Current Doc Else Do strPriority = docCurrent.DeliveryPriority(0) strImportance = docCurrent.Importance(0) If ((docCurrent.Form(0) = "Memo") And (strPriority = "H" Or strImportance = "1")) Then 'Need to create new memo & send to pager. Dim docPagerMemo As New NotesDocument(dbCurrent) Dim varFrom As Variant, strSubject As String, strBodyText As String docPagerMemo.SendTo = strSendTo varFrom = Evaluate({@Name([CN]; From)}, docCurrent) strSubject = docCurrent.Subject(0) Set itemBody = docCurrent.GetFirstItem ("Body") If (itemBody Is Nothing) Then 'Body can not be read docPagerMemo.Body = "Text can not be read. Check your email. | From: " & varFrom Else 'If Body can be read, return only 200 characters strBodyText = "Fr: " & varFrom(0) & " : " & Left(itemBody.Abstract(1000,1,0), 200) docPagerMemo.Subject = strSubject docPagerMemo.Body = strBodyText docpagermemo.inetfrom = "b2b" End If Call docPagerMemo.Send(False) Call session.UpdateProcessedDoc(docCurrent) End If Set docCurrent = collUnprocessed.GetNextDocument(docCurrent) Loop Until (docCurrent Is Nothing) End If End If End If Else 'No I dont want to be notified Exit Sub End If End Sub 'End of Agent Regards, George 23.​  Agent to copy values from 1 form to another 在同一个数据库中进行 备注 程序代码 First, create two views: Form1 Selection formula: SELECT form = "Form1" Form2 Selection formula: SELECT form = "Form2 Put the following in the querysave of Form1 form: '======================================= dim session as New NotesSession dim ws as New NotesUIWorkspace dim uidoc as NotesDocument dim db as NotesDatabase dim view as NotesView dim doc1 as NotesDocument, doc2 as NotesDocument set uidoc = ws.CurrentDocument set doc1 = uidoc.Document set view = db.GetView("Form2") set doc2 = view.GetFirstDocument ' you now have a handle on both documents 'now do this... doc2.FieldA = doc1.FieldA call doc2.save(true,true) '======================================= that was all done without testing, so you might have to tweak something here or there, but that is the idea. - Matt 24.​  超越OLE – 通过COM结合MS Office与Notes应用 备注 程序代码 COM技术在Notes程序中的运用,极大丰富了Notes应用的功能和应用范围,本文对该技术的具体使用方面作一介绍。 要在Domino Designer中使用MS Office COM对象,你必须确认使用了正确的对象库,当安装了Office后,这些库就能在Domino Designer自动显示出来,虽然这些不是准确意义上的OLE类,它们还是显示在了Domino Designer设计界面“参考”附签中的“OLE classes”分类下。其中,Word 8.0 对应Office97, Word 9.0 对应Office2000。 为了确保该集成应用能正确运行,用户应在本地注册表中正确注册了相应的Windows应用程序(如Word 或 Excel)。 在使用MS Word的COM接口之前,你必须先理解MS Word对象层次关系结构,如你有些VB的编程经验的话,你已经或多或少接触了该层次结构。具体内容可在MS Office帮助中“Visual Basic入门指南”下的“Microsoft Word对象”一节中查阅。比如你要对Document对象进行操作,可查到Document对象的所有方法和属性,再进行相应的编程。 操作对象的两个基本步骤: 1、 为该对象定义一个Notes变量,类型为Variant; 2、 创建该对象。 代码如下: Dim officeApp as Variant Set officeApp = CreateObject( “Word.Application.9” ) ‘ 对应Office 2000 可以定义MS Word对象层次关系结构中各层的对象,如: Dim officeDocs as Variant Set officeDocs = officeApp.Documents Dim officeMainDoc as Variant Set officeMainDoc = officeDocs.Open( “c:\training.doc” ) 本文的例子中,我们将把选中的多个Notes文档中的客户信息合并到一个Word文档中,并按照Word文档中设定的格式进行信封打印,这些都是通过COM对象来完成的。 本示例中,假定有一个简单的数据库,其中存放有客户信息,如公司信息和客户个人信息等,数据库视图有三个操作:Envelopes, MailingLabels, MailMerge.这实际上是通过三个代理来完成的。当某个操作被执行时,对应的代理完成如下步骤: 1、 把选中的客户文档收集到一文档集合中; 2、 在后台打开一个Word session; 3、 把文档集中的文档某些内容合并到一个为本例设计的Word文档中; 4、 打印该文档; 5、 清空该Word 文档(模板)内容(准备下一次的合并)。当然你在清空之前也可以保存该结果文档。 你事先要按Word结果文档的要求建立一个Word 格式文件,其中包含与Notes文档中对应的多个域,两边的域名称不一定要相同,如本例中Notes文档内公司名为“CompName”,而Word中为“Company”。在本例的Word 文件中相应的6个域为:Company, Address, ZipCity, Country, Date, Regarding. 如何构建MailMerge代理? Sub Initialize Dim officeApp As Variant Dim officeMainDoc As Variant Dim officeSel As Variant Dim officeFields As Variant Dim x As Integer Dim domDoc As NotesDocument Dim domColl As NotesDocumentCollection Dim domSes As New NotesSession Dim domDb As NotesDatabase ' Setting Notes environment Set domDb = domSes.CurrentDatabase Set domColl = domDb.UnprocessedDocuments Set domDoc = domColl.GetFirstDocument ' Setting Word enviornment Set officeApp = CreateObject("Word.Application.9") Set officeMainDoc = officeApp.Documents.Open("c:\MergeMe.doc") Set officeFields = officeMainDoc.FormFields While Not (domDoc Is Nothing) With domDoc officeFields.Item("Company").Result=.CompName(0) & Chr$(13) & .ContName(0) officeFields.Item("Address").Result=.CompAddress(0) officeFields.Item("Zipcity").Result=.CompZip(0) & " " & .CompCity(0) officeFields.Item("Country").Result=.CompCountry(0) officeFields.Item("Today").Result=Str$(Today) officeFields.Item("Regarding").Result=.ContInterest(0) End With ' Print-out Call off
本文档为【LotusDomino学习笔记】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_332311
暂无简介~
格式:doc
大小:2MB
软件:Word
页数:313
分类:互联网
上传时间:2011-05-24
浏览量:20