LotusScript 代理的基本用法
- 格式:pdf
- 大小:226.60 KB
- 文档页数:3
使用LotusScript获取多值域的值原理:文档中的域值是数组形式的。
多值域的值类似于一行多列的数组,下标从0开始。
假定域名为Employee,类型为多值文本域,文档中此域的值为:james,robin,alfred。
计划使用LS的得到返回值为:jamesrobinalfred。
方法1、直接获取strEmployee = doc.Employee(0) +doc.Employee(1) +doc.Employee(2)方法2、使用Evaluate声明Dim strEmployee AsVariantConst NotesMacro$ = "@Implode(Employee)"strEmployee = Evaluate(NotesMacro$,doc)MsgBoxCStr(strEmployee(0))方法3、使用GetItemValue方法Dim tname AsVarianttname = backdoc.GetItemValue("TComm3Name")MsgBox tnameForAll o In tnameMsgBoxCStr(o)EndForAll方法4、转化为数组处理Dim i,j AsIntegeri = 0arrEmployee = doc.GetItemValue("Employee ")For j=LBound(arrEmployee) ToUBound(arrEmployee)MsgBoxCStr(arrEmployee(i))i=i+1Next------------------例子--------------Dim WebStartDb As NotesDatabase '系统启动数据库Dim LinkDoc As NotesDocument '系统启动库中的链结文档Set WebStartDb=s.Getdatabase("", "weboa\woastart.nsf")Set LinkDoc = WebStartDb.GetDocumentByUNID(backdoc.DocID(0)) '根据链结文档ID从系统启动库中取链结文档IfNot LinkDoc IsNothingThenDim arrEmployee AsVariantDim strTComm3Name AsStringDim z,j AsIntegerz = 0strTComm3Name=""arrEmployee = backdoc.GetItemValue("TComm3Name")For j=LBound(arrEmployee) ToUBound(arrEmployee)'MsgBox "111:" & CStr(arrEmployee(z))strTComm3Name= strTComm3Name + CStr(arrEmployee(z))+";"z=z+1Next'MsgBox "strTComm3Name:" & strTComm3NameEndIfLinkDoc.IsTCommm=strTComm3NameCall LinkDoc.Save(True,True)。
LotusScript 代理的基本用法1、FTSearch搜索:Set dc=db.Ftsearch("name",0)'0位置为最大的查询数,0为所有匹配的文件FTSearch必须创建数据库索引Set doc=dc.Getfirstdocument()、2、Item:Set doc=dc.Getfirstdocument()While Not doc Is NothingForAll ritem In doc.ItemsMsgBox End ForAllWend3、取出特定的域Set doc=view.getFirstdocument()If doc.HashItem("yu") <> "" ThenSet item=doc.getfirstitem("yu")Set doc=view.getNextdocument(doc)End If4、使用文本属性If doc.Hashitem("yu") <> "" ThenSet doc=dc.Getfirstdocument()While Not doc Is NothingForAll itemValue In doc.yuitemValue = "Anonymous"End ForAllSet doc=dc.Getnextdocument(doc)WendEnd If5、获取域值:ForAll itemValue In doc.Getitemvalue("yu")6、添加域set item =new NotesItem(doc,"newYu",erName)Call doc.Appenditemvalue("newYu",Newvalue)7、替换值:1)、While Not doc Is NothingCall doc.Replaceitemvalue("resName","newValue")Set doc=dc.getnextdocument(doc)Wend2)、Set doc=dc.Getfirstdocument()While Not doc Is Nothing'Call doc.Replaceitemvalue("resName","newValue")Set item =doc.Getfirstitem("yu")While Not item Is NothingForAll resitems In doc.Itemsv(0)resitems="newVlaue"End ForAll= doc.Itemsv(0)Set item =doc.getnextitem(item)WendSet doc=dc.getnextdocument(doc)Wend8、拷贝域Set item =doc.Getitemvalue("name")call item.Copyitemtodocument(doc, "name")call doc.save(true,false)Call doc1.Copyallitems(doc2,true) ‘替换所有的9、删除指定的域:1)、For j=1 To dc.countSet item=doc.Getitemvalue("name")While Not item Is NothingCall item.Remove()Call doc.Save(true,false)WendSet doc=dc.Getnthdocument(j)Next2)、For j=1 To dc.countWhile Not doc.Hasitem("name")Call doc.Removeitem("name")Call doc.Save(True,false)WendSet doc=dc.Getnthdocument(j)Next10、RTF文本域的输出:Set item=doc.GetFirstItem("RtfYU")MsgBox item.Text11、在代理中使用公式:temp=Evaluate("@ReplaceSubstring(aa;bb;cc)",doc) 12、嵌入对象:ForAll csx In doc.EmbeddedobjectsEnd ForAllSet doc=dc.Getnthdocument(j)Next13、激活嵌入对象:Call doc.EmbeddedObjects(0).Activate(True)14、if的用法Set doc=dc.Getfirstdocument() If Not IsEmpty(db.Agents) Then ForAll agent In db.Agents MsgBox End ForAllEnd If。
LotusScript 语言的基本知识一、概述LotusScript 是一种和Basic相兼容的面向对象的Scripting 环境,它具有强大的能够从事面向对象应用软件开发的语言范围,能够提供循环和分支的能力、数组以及访问Notes对象的能力。
判断Notes中什么时候使用LotusScript 或公式语言1)任何时候当执行该任务的函数或命令存在时,使用公式。
2)对于复杂的程序控制或循环,使用LotusScript 。
3)存取或操作储存的文档数据要使用LotusScript ,特别对于跨文档、跨数据库的存取。
4)若公式语言不能办到,则使用LotusScript在Notes应用程序中访问和操作对象需要三步进行:1.声明对象变量DIMDIM db As NotesDatabase2.实例化一个类将其赋值给对象变量SET db=New NotesDatabase( "Domestic" ,"Sales. nsf')3 •使用这个对象的方法或属性db.created '用来展现创建数据库时的日期和时间、NotesScript 中的数据元素NotesScript 中的常量Null ' 特殊值,代表数据遗失或空Empty ' 相当于"",也就是空串Noth ing ' 涉及变量的初始值,表示对象变量没有内容PI ' 圆周率True/False ' 分别为数值1和0数据类型Integer(整型)Long(长整型)Single(单精度型)Double(双精度型)Currency(货币型)String(字符串)运算符+ - * / <><> = Not And OR &常量和变量Dim address As String '定义变量address = "100 Ma in Street "'变量赋值Co nst address = "100 Mai n Street"'创建字符常量address通信输入和输出Dim response as Integerresponse = Inputbox( "Do you want to continue")'弹岀输入框输入Messagebox(respo nse) '弹岀输岀窗口输岀数据注释1 •单行注释:用Rem或'号2.多行注释:用%Ren和%EndRem% Rem '多行注释实例The first statement in this Script declares a variable myName.The second assi gn the value "Robert" to myName.The third statement display the value of myName. % End Rem数据类型转换Asc(String) 函数’将字符串转化为 ANSI 字符代码 CDate(Strin*) 函数'将字符串转化为日期型CBool(expressi on) 函数'将表达式转化为布尔型 CByte(expressi on) 函数'将表达式转化为字节型CCur(expressio n)函数'将表达式转化为货币型**bl(expressi on)函数’将表达式转化为双精度型 Chr (Integer) 函数'返回整数 AscII 码对象的字符,例如65表示AClnt (expression) 函数’将表达式转化为整型 CLn g(expressi on) CSn g(expressi on)CStr (expression)函数'将表达式转化为长整型 函数'将表达式转化为单精度型 函数'将表达式转化为字符串Hex (number) 函数'返回十六进制 Oct(number) 函数'返回八进制三、数组管理Dim MyDays(7) DimMyDay(1 to ReDim MyDay(1 UBou nd(MyDay,1) LBou nd(MyDay) LBou nd(MyDay,2)as String'声明一个数组一共7个元素,下标为0〜67) as String '声明一个数组下标为to 3)'重新设置数组的边界和维数,这里ReDim 用于定义动态数组'返回数组的上界,1表示若是多维数组,返回第一维的上界 '返回数组的下界'返回数组第2维的下界MyDay(1) = "Su nday"'给数组元素赋值四、语句1、IF ... End ifif balanee > 100 thenin terest = 0.35elsein terest = 0en dif2、Select caseSelectcase thisMo nthcase 1Resp onse = "Ja nuary"case 2 to 10 '也可以写成case 10,20,30 或caseis > 10 response = "Other" caseelseMessageBox(thisMo nth &"is in valid value")en dSelect3、Do...loops 禾口while... wendDowhile / until 条件'语句组loopDo'语句组loopwhile / until 条件while条件'语句组wend4、For...NextFor i = 1 to 5MyDays(i) = InputBox( "Enter your work days:")Next i5、ForAllForAll m in db.managers '循环显示数组db.managers 中的元素MessageBox(m)End ForAll[JavaScript]将Excel文件中的数据导入到表单2009-03-24 17:50:31标签:导入Excel休闲职场JavaScript版权声明:原创作品,如需转载,请与作者联系。
proxy-cheap使用教程Proxy-Cheap是一个提供HTTP/HTTPS和SOCKS5代理服务的网站。
它提供了一个易于使用的平台,使用户能够轻松获取和管理代理服务器。
本教程将向您展示如何使用Proxy-Cheap来获得代理和配置您的浏览器以使用这些代理。
步骤1:创建Proxy-Cheap账户步骤2:购买代理在Proxy-Cheap的仪表板上,选择合适的套餐。
Proxy-Cheap提供不同的套餐,以满足不同用户的需求。
选择你喜欢的套餐,点击“Buy”按钮,并按照界面上的指示完成购买。
步骤3:获取代理购买成功后,您将返回到Proxy-Cheap的仪表板。
在仪表板上,您可以找到您购买的代理服务器的列表,其中包括服务器的IP地址、端口号和验证凭证。
您可以根据自己的需求选择适合您的代理服务器。
步骤4:配置代理现在,您可以将代理配置在您的浏览器中,以便您可以通过代理服务器浏览Internet。
以下是如何在不同浏览器中配置代理的步骤:- Google Chrome:1. 在Chrome中,点击右上角的菜单按钮,并选择“Settings”。
2. 在设置页面中,滚动到底部并点击“Advanced”。
3. 在“System”部分,点击“Open proxy settings”。
4. 在Internet属性对话框的连接选项卡中,点击“LAN设置”。
5. 在局域网(LAN)设置窗口中,选中“使用代理服务器”复选框,并输入您在Proxy-Cheap仪表板中获得的代理服务器的IP地址和端口号。
6.点击“确定”保存您的更改,并关闭所有打开的窗口。
- Mozilla Firefox:1. 在Firefox中,点击右上角的菜单按钮,并选择“Options”。
2. 在选项页面中,选择“General”选项卡。
3. 在网络设置部分,点击“Settings”按钮。
4. 在连接设置窗口中,选择“手动代理配置”选项,并输入您在Proxy-Cheap仪表板中获得的代理服务器的IP地址和端口号。
数据导出-Domino浏览器端(网页端)数据导出实现简介:本文介绍了两种导出domino数据的实现方法,一种使用代理,一种使用XPage。
一、使用代理导出数据导出代理使用LotusScript实现,基本原理涉及输出信息到网页,设置网页内容类型:1、print()方法可输出信息到网页2、设置输出HTML页面类型 为附件 “Content-Disposition:Attachment;”参考代码:%REMSub exportDataBSDescription: 数据导出,参数为导出的数据%END REMSub exportDataBS(dataTable As String)Dim attSetting As StringDim htmlHeader As String'Generate HTML PageattSetting="Content-Disposition:Attachment; filename=" & Format(Now,"YYYYMM DDHHMM") & ".xls" & Chr$(13)htmlHeader=|<html><head><meta content="text/html; charset=GB2312" http-equiv="Content-Type"/>| & Chr$(13) & _|<style type="text/css">body {background-color:transparent;font-family: Arial;}table {font-size:12;border: 1px black solid;border-collapse:collapse;}th,td {border: 1px black solid;}</style>| & _|</head><body>|Print attSetting & htmlHeader & dataTable & |</body></html>|End Sub3、通过对请求页面可获取GET和POST类型参数值参考代码:Set context=s.DocumentcontextREQUEST_CONTENT=context.Getitemvalue("REQUEST_CONTENT")(0) 'POST参数 Query_String_Decoded=context.Getitemvalue("Query_String_Decoded")(0) 'URL参数 '<<<<<<Get dataIf REQUEST_CONTENT<>"" Then'Export selected documentids=Trim(StrToken(REQUEST_CONTENT,"ids=",2))If ids<>"" ThenaryIDs=Split(ids,".")ForAll Noteid In aryIDsSet request=db.Getdocumentbyid(Noteid)If Not request Is Nothing ThentbHTML=tbHTML & getDocInfoHTML(request)ElsetbHTML=tbHTML & "<tr><td>" & Noteid & "</td><td>" & "File not fo und" & "</td></tr>"End If ' get request doc objectEnd ForAll 'loop note idsEnd IfElseIf Query_String_Decoded<>"" Then'Export as conditiondtType=GetParameter("type",Query_String_Decoded)startDate =GetParameter("start",Query_String_Decoded)endDate = GetParameter("end",Query_String_Decoded)matType=GetParameter("matType",Query_String_Decoded)'导出处理代码...ElsePrint "未获取到导出参数!"GoTo endSubEnd If其他辅助函数:* 获取URL参数Function GetParameter(strParamName As String, strQuery As String) As StringDim i As IntegerDim s As StringDim v As VariantGetParameter = ""i = InStr(UCase(strQuery),"&" & UCase(strParamName) & "=")If i <> 0 Thens = StrRight(Mid(strQuery, i),"=")If InStr(s, "&") Thens = StrLeft(s, "&")End Ifv = Evaluate("@UrlDecode(""Domino""; """ & s & """)")GetParameter = CStr(v(0))End IfEnd Function* 特殊字符转换Function PCDATA(ByVal phrase$) As String%REM当需要输出HTML格式文本时,可使用此函数将输出字符中的特殊字符转换为&#unicode格式%END REMOn Error GoTo errorHandlerDim begin%, found%, oldPhrase$If phrase$="" Then GoTo endSuboldPhrase= phraseDim a As LongDim ch As Stringphrase$=""For a=1 To Len(oldphrase)ch=Mid$(oldphrase,a,1)If Uni(ch)=32 Or Uni(ch)>47 And Uni(ch)<58 Or _ '0-9Uni(ch)>64 And Uni(ch)<91 Or _ 'A-ZUni(ch)>96 And Uni(ch)<123 Then 'a-zphrase$=phrase$ & chElsephrase$=phrase$ & "&#" & Uni(ch) & ";"End IfNextPCDATA = phraseendSub:Exit FunctionerrorHandler:PCDATA = oldPhraseResume endSubEnd Function二、通过设置XPage返回信息来导出数据设置导出功能的XPage,需设置Xpage的"rendered"属性为false,并在XPage的“afterRenderResponse()”事件中编写导出数据代码,使用SSJS编写,可以导出特殊字符(不用做处理),基本要点是:* 设置输出页面类型var exCon:javax.faces.context.ExternalContext = facesContext.getExternalContext();var writer:javax.faces.context.ResponseWriter = facesContext.getResponseWriter();var response:javax.servlet.http.HttpServletResponse = exCon.getResponse();response.setContentType("application/vnd.ms-excel;charset=utf-8");response.setHeader("Cache-Control", "no-cache");response.setHeader("Content-Disposition","attachment; filename=\"export.xls\"");* 设置输出页面及样式writer.write("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/></head>"); writer.write("<body style=\"background-color:transparent;font-family: Arial\">");.....writer.write("</body></html>");writer.endDocument();* 实现代码参考(输出指定视图内容)function getSerialTimeNo():string{var nt:Date=@Now();var y=@Year(nt);var mon=@Month(nt);var d=@Day(nt);var h=@Hour(nt);var m=@Minute(nt);var s=@Second(nt);var day=y+(@Length(mon)==1?"0":"")+mon+(@Length(d)==1?"0":"")+d;var time=(@Length(h)==1?"0":"")+h+(@Length(m)==1?"0":"")+m+(@Length(s)==1?"0":"")+s;return day+time;}function export2Excel(){try {//javax.faces.context.FacesContextvar exCon:javax.faces.context.ExternalContext = facesContext.getExternalContext();var writer:javax.faces.context.ResponseWriter = facesContext.getResponseWriter();var response:javax.servlet.http.HttpServletResponse = exCon.getResponse();response.setContentType("application/vnd.ms-excel;charset=utf-8");response.setHeader("Cache-Control", "no-cache");response.setHeader("Content-Disposition","attachment; filename=\"export"+getSerialTimeNo()+".xls\"");writer.write("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/></hea d>");writer.write("<body style=\"background-color:transparent;font-family: Arial\">");try{//////////////////////////输出代码开始///////////////////////////////页面参数传递var condition=sessionScope.parts;sessionScope.parts=null;var vw:NotesView = null;var vc:NotesViewEntryCollection = null;var ve:NotesViewEntry = null;var veTmp:NotesViewEntry = null;vw = database.getView("Request");vc = vw.getAllEntries();if(vc.getCount()>0){//输出表格及表格标题writer.write("<table border=\"1px black solid\">");writer.write("<tr>");var columns=vw.getColumnNames();for(j = 0 ; j < vw.getColumnCount() ; j++){writer.write("<th>" + columns[j] + "</th>");}writer.write("</tr>");//输出表格行:视图数据ve = vc.getFirstEntry();while (ve) {v = ve.getColumnValues();//条件判断if(condition==null || condition==v.elementAt(0)){writer.write("<tr>");for (i = 0; i < v.size(); i++) {writer.write("<td>"+v.elementAt(i).toString()+"</td>");}}veTmp = vc.getNextEntry(ve);ve.recycle();ve= veTmp;}writer.write("</table>");}else{//没有数据writer.write("No Data");}//////////////////////////输出代码结束/////////////////////////////}catch(e){writer.write("ERROR: "+e.toString());}writer.write("</body></html>");writer.endDocument();} catch (e) {print("sysExportToExcel: "+e);}}Use the context global variable to get an XSPContext object representing the current context.。
Office 文档集数据库是以嵌入对象的方法嵌入word文档的,该文档在body域中,发送传真时,页眉、页脚发不出来,其他格式能正常发出来.而且可以做到不发传真封面,另外,这种方式也可以避免附件方式那样发出来还会出现一个附件图标,故现在的任务是如何往该文档中写内容了。
往该文档中写内容,有两种方式:一种是用VB写一个DLL,有关word文档的操作,包括插入一个表格、插入一个字符串、插页眉等等。
这些函数都放在Dll中,然后被lotus script调用。
另一种方式是用lotusscript 直接操纵该嵌入文档,但操纵嵌入文档的lotusscript语法与VB语法差异很大。
所能获得的例子代码和帮助都是VB语法,只能从lotusscript提取的ole对象库中去察看个函数的语法,至于个函数中的参数的意义只能从msdn中获得,而msdn中对参数的讲解也不是很详细,所有VB常量在lotusscript中没有定义,只能半猜半试的直接使用数值。
下面的例子是lotus script 操纵word文档:'获取嵌入文档的句丙Set thisdoc = source.getobject("oleobject"'设置该文档的页面设置的左边距为20个单位(象素)With thisdoc.pagesetup.leftmargin = 20End With'插入页眉(由于真正的页眉在传真时无法显示,这里的页眉是模拟的)'插入一幅图Set thispicture = thisdoc.shapes.Addpicture("d:\学习\cassiatb.jpg"'设置文字的插入点thisrangeSet thisrange = thisdoc.range(1,1)pageheadstring = "CAISSA Touristic GmbH" & Chr(10) & "HAMBURG·BEIJING·SHANGHAI·BARCELONA" & Chr(10) &Chr(10) & Chr(10)'插入一段文字:pageheadstringthisrange.insertbefore (pageheadstring)'获取一段文字:从字符1到24Set thisrange = thisdoc.range(1,24)'设置该段文字的属性:With thisrange.bold = True '加粗.ParagraphFormat.Alignment = 1'wdAlignParagraphCenter 行居中.font.size = 20 '字体大小为20End WithSet thisrange = thisdoc.range(25,59)With thisrange.bold = True.ParagraphFormat.Alignment = 1'wdAlignParagraphCenter.font.size = 16End With'thispicture.wrapformat.side = wdwrapright'设置图像属性With thispicture.wrapformat '环绕方式.type = wdwrappicture '类型为picture.side = wdwrapright '文字右环绕End With。
第10章在Web中使用LotusScript第10章在Web中使用LotusScript (1)10.1 使用LotusScript的Web代理 (1)10.2 激活一个代理的URL (2)10.3 编写WebQueryOpen代理 (3)10.4 编写WebQuerySave代理 (6)10.5 在代理中使用CGI变量 (7)10.5.1 删除文档 (8)10.6 在Web工作流中使用LotusScript (11)本章主要说明在Domino的Web开发中使用LotusScript的方法,关于LotusScript的程序设计知识请参考第三章和IBM 公司提供的帮助文档。
10.1 使用LotusScript的Web代理LotusScript在Web上的唯一使用方法就是编写代理,完成比较复杂的程序逻辑,或者是只有通过操作Domino后端对象才能完成的功能。
在Web上运行一个LotusScript代理有两种方法:●使用@URLOpen调用它的URL,例如,http://server/db/agentname?OpenAgent●使用公式ToolsRunMacro和RunAgent调用代理。
当使用ToolsRunMacro调用代理时,有两种特殊的应用场合,即在文档的WebQueryOpen和WebQuerySave事件中调用代理。
当你在Web上运行一个LotusScript代理时,代理可以访问由浏览器和Domino提供的信息,即CGI 变量,如果使用第二种方式运行代理,还可以访问当前文档中的域的值,这些信息都包含在NotesSession 中的DocumentContext属性中。
DocumentContext属性是一个特别的N o t e s D o c u m e n t对象,它包含了关于当前环境的信息。
这个文档内容类似于N o t e s U I D o c u m e n t对象,你可以使用它在表单保存前从表单中得到值。
在notes编程中,尤其web开发中,代理是很常用的,但是,相对而言,代理的调试也很不方便。
下面就我的经验,列出几种常用的方法,欢迎大家指正和补充。
(这里讨论的都是lotussript代理)1.notes端跟踪法使用notes开发客户端时,对于那些在客户端运行的代理(与服务器端运行相对)可以直接跟踪代理的运行。
方法:选中菜单中“文件-〉工具-〉调试lotusscript”后再运行代理即可。
优点:调试直观,代理可以单步跟踪、设置断点(使用stop语句或者在调试窗口中双击需要加断点的语句)、观察该中断时刻的各种变量和对象的值等。
所以使用这种调试方法可以很快地知道问题的所在。
缺点:只适用于客户端运行的代理,而且有些web客户端运行的代理也无法调试。
一些调试技巧:可以把那些在服务器端运行的代理的核心代码先在客户端调试通过后,再改回服务器端运行,这样有时可以节省很多调试时间。
有些web端运行的代理也可照此方法调试。
2.输出调试信息对于那些在服务器端运行的代理,或在web端运行的代理,可以利用print命令来输出一些关键的信息来帮助你了解问题的所在。
方法:在代理中怀疑有问题的地方或分支点附近加入print命令来打印一些关键信息,从而帮助了解问题的所在。
a.对于处于非调试状态下的notes客户端而言,print的信息将显示在客户端下部的状态条中。
b.对于处于调试状态下的notes客户端而言,print的信息将显示在客户端下部的状态条中和调试窗口的输出窗口中。
c.对于web应用而言,print的信息将直接输出到浏览器中。
(但请注意,位于表单的webqueryopen 代理中的print输出都将被忽略)d.对于服务器端运行的代理,print的信息将保存在NOTES.LOG文件中附带说一句,当代理产生错误时,一般都会在domino的命令窗口中产生一个错误信息,说明错误的类型,可能的话,先看看这些信息,了解一下错误的类型,可能会比一上来就盲目地跟踪要好一些。
LotusScript 代理的基本用法
1、FTSearch搜索:
Set dc=db.Ftsearch("name",0)
'0位置为最大的查询数,0为所有匹配的文件FTSearch必须创建数据库索引Set doc=dc.Getfirstdocument()、
2、Item:
Set doc=dc.Getfirstdocument()
While Not doc Is Nothing
ForAll ritem In doc.Items
MsgBox
End ForAll
Wend
3、取出特定的域
Set doc=view.getFirstdocument()
If doc.HashItem("yu") <> "" Then
Set item=doc.getfirstitem("yu")
Set doc=view.getNextdocument(doc)
End If
4、使用文本属性
If doc.Hashitem("yu") <> "" Then
Set doc=dc.Getfirstdocument()
While Not doc Is Nothing
ForAll itemValue In doc.yu
itemValue = "Anonymous"
End ForAll
Set doc=dc.Getnextdocument(doc)
Wend
End If
5、获取域值:
ForAll itemValue In doc.Getitemvalue("yu")
6、添加域
set item =new NotesItem(doc,"newYu",erName)
Call doc.Appenditemvalue("newYu",Newvalue)
7、替换值:
1)、While Not doc Is Nothing
Call doc.Replaceitemvalue("resName","newValue")
Set doc=dc.getnextdocument(doc)
Wend
2)、Set doc=dc.Getfirstdocument()
While Not doc Is Nothing
'Call doc.Replaceitemvalue("resName","newValue")
Set item =doc.Getfirstitem("yu")
While Not item Is Nothing
ForAll resitems In doc.Itemsv(0)
resitems="newVlaue"
End ForAll
= doc.Itemsv(0)
Set item =doc.getnextitem(item)
Wend
Set doc=dc.getnextdocument(doc)
Wend
8、拷贝域
Set item =doc.Getitemvalue("name")
call item.Copyitemtodocument(doc, "name")
call doc.save(true,false)
Call doc1.Copyallitems(doc2,true) ‘替换所有的9、删除指定的域:
1)、For j=1 To dc.count
Set item=doc.Getitemvalue("name")
While Not item Is Nothing
Call item.Remove()
Call doc.Save(true,false)
Wend
Set doc=dc.Getnthdocument(j)
Next
2)、For j=1 To dc.count
While Not doc.Hasitem("name")
Call doc.Removeitem("name")
Call doc.Save(True,false)
Wend
Set doc=dc.Getnthdocument(j)
Next
10、RTF文本域的输出:
Set item=doc.GetFirstItem("RtfYU")
MsgBox item.Text
11、在代理中使用公式:
temp=Evaluate("@ReplaceSubstring(aa;bb;cc)",doc) 12、嵌入对象:
ForAll csx In doc.Embeddedobjects
End ForAll
Set doc=dc.Getnthdocument(j)
Next
13、激活嵌入对象:
Call doc.EmbeddedObjects(0).Activate(True)
14、if的用法
Set doc=dc.Getfirstdocument() If Not IsEmpty(db.Agents) Then ForAll agent In db.Agents MsgBox
End ForAll
End If。