LOTUS学习技巧3.docx
- 文档编号:30236172
- 上传时间:2023-08-13
- 格式:DOCX
- 页数:13
- 大小:19.27KB
LOTUS学习技巧3.docx
《LOTUS学习技巧3.docx》由会员分享,可在线阅读,更多相关《LOTUS学习技巧3.docx(13页珍藏版)》请在冰豆网上搜索。
LOTUS学习技巧3
LOTUS学习技巧 三
1.我如何在页面上建立一个热点,让它打开一个文档?
答:
在页面上写一段文字,然后选上这段文字,然后点菜单”创建”–热点--操作热点
然后选LotusScript,举个例子,比如打开ID为NT00000C62的文档:
SubClick(SourceAsButton)
DimuiworkspaceAsNewnotesuiworkspace
DimcurdatabaseAsnotesuidatabase
DimdatabaseAsnotesdatabase
DimdocAsnotesdocument
Setcurdatabase=uiworkspace.currentdatabase
Setdatabase=curdatabase.database
Setdoc=database.getdocumentbyid("00000C62")
Calluiworkspace.EditDocument(True,doc,False)
EndSub
2.我如何实现归档,比如我如何把当前视图中所有被选中的文档归入文件夹fold中?
答:
用Script象如下这样实现:
SubAddDocToFold(foldAsString)
DimuiworkspaceAsNewnotesuiworkspace
DimuiviewAsnotesuiview
DimdocAsNotesDocument
DimdocListAsString
Setuiview=uiworkspace.currentview
Forj=1Touiview.Documents.Count
Setdoc=uiview.Documents.GetNthDocument(j)
Calldoc.PutInFolder(fold)
Next
EndSub
3.我如何实现把某文件夹视图中的被选择的文档从该文件夹中清除,但却不能删除他们?
答:
用Script实现如下:
SubRemoveDocFromFold(foldAsString,allAsInteger)
'功能:
'把文档从某个文件夹中移走,但并不删除此文档
'参数:
'fold:
文件夹
'all:
0表示仅移走当前选择的文档,1表示移走该文件夹中所有文档
DimuiworkspaceAsNewnotesuiworkspace
DimuiviewAsnotesuiview
DimdocAsNotesDocument
DimviewAsnotesview
Setuiview=uiworkspace.currentview
Setview=uiview.view
Ifall=0Then'移去所选文档
Forj=1Touiview.Documents.Count
Setdoc=uiview.Documents.GetNthDocument(j)
Calldoc.RemoveFromFolder(fold)
Next
Else
Ifall=1Then'移去全部文档
Setdoc=view.GetFirstDocument
'遍列该视图的所有文档,获取所有满足条件的纪录数
WhileNot(docIsNothing)
Calldoc.RemoveFromFolder(fold)
Setdoc=view.GetNextDocument(doc)
Wend
EndIf
EndIf
'Evaluate("@Command([ViewRefreshFields])")
EndSub
4.我如何把当前视图中的所有的被选择的文档的某个域的值替换掉?
答:
用Script实现如下:
SubSelectedDocFieldReplace(FieldAsString,repvalAsString)
'功能:
'把所选文档中的每个Field域的值改为repval
'参数:
'Field要更改的域的名称
'repval修改后的域值
DimuiworkspaceAsNewnotesuiworkspace
DimuiviewAsnotesuiview
DimdocAsNotesDocument
Dimorder_numAsString
'order_num=Inputbox$("请输入批次")
Setuiview=uiworkspace.currentview
Forj=1Touiview.Documents.Count
Setdoc=uiview.Documents.GetNthDocument(j)
OnErrorGotolable1
Calldoc.replaceitemvalue(Field,repval)
Calldoc.save(True,False)
Next
ExitSub
lable1:
Msgbox("错误!
,所选文档没有指定的域,这个错误发生在没有给selectedDocFieldReplace()函数传递正确的参数")
ExitSub
EndSub
5.我如何创建某个程序运行结果的日志文档?
6.
答:
首先新建一个日志文档的表单,并把该表单设置成数据库的默认表单,然后就用Script创建文档,并填写该文档中某些域的值,最后存盘,例子程序片段如下:
'写传真日志
Dimfaxerdocasnotesdocument
‘faxerr_receiver,faxerr_docnum,faxerr_content是表单form_faxerr的三个域名
‘
Setfaxerrdoc=NewNotesDocument(db)
faxerrdoc.Form="form_faxerr"
Callfaxerrdoc.replaceitemvalue("faxerr_receiver",Cstr(peoplecount))
Callfaxerrdoc.replaceitemvalue("faxerr_docnum",strsucssnding)
Callfaxerrdoc.replaceitemvalue("faxerr_content",faxerrmsg)
success=faxerrdoc.ComputeWithForm(False,False)
IfsuccessThen
Callfaxerrdoc.Save(True,False)
Else
Msgbox("无法写入传真日志....")
EndIf
'Msgbox(faxerrmsg)
ExitSub
7.我要从当前视图中选择一批文档,并让程序从这些文档中提取信息,在嵌入在表单中的OLE对象Word文档中建立一张表,要求是选择了几篇文档就在这张表中画几行,这张表的每个列的信息都中文档中的域中提取,换句话说,就是要把被选文档以Word文档表格的形式表示出来,能否给我一个这方面的例子程序?
8.
答:
可以,下面就是这样的一个例子:
Subinputgroupplan(sourceAsnotesuidocument,doccollectionAsnotesdocumentcollection)
'功能:
自动生成出团计划表。
'详细描述:
'从文档集合doccollection中提取各个域值,并把提取的信息以一定
'的表格形式送入当前文档的body域中的OLE对象--Word文档中.
'参数:
'source:
当前文档
'doccollection:
文档集(比如文档的选择集)
'编写:
'商云方
'完成日期:
'
DimsessionAsNewNotesSession'当前会话
DimcounterAsInteger'计数器
DimdoccustomAsNotesDocument'notes文档对象
DimthisdocAsVariant'Word文档对象
DimthisrangeAsVariant'Word开发中的range对象
DimthispictureAsVariant'嵌入Word文档的图象对象
DimthistableAsVariant'嵌入Word文档的表格对象
DimpageheadAsString'嵌入Word标题
'获取嵌入文档的句丙
Ifsource.EditModeThen
Setthisdoc=source.getobject("oleobject")
'插入一幅图
Setthispicture=thisdoc.shapes.Addpicture("c:
\学习\cassiatb.jpg")
'设置图像属性
Withthispicture.wrapformat'环绕方式
.type=wdwrappicture'类型为picture
.side=wdwrapright'文字右环绕
EndWith
'设置该文档的页面设置的左边距为20个单位(象素)
Withthisdoc.pagesetup
.leftmargin=20
.rightmargin=20
EndWith
counter=0
pagehead=Inputbox$("请输入标题")
pagehead=Chr(10)&pagehead&Chr(10)&Chr(10)&Chr(10)
'Callsource.FieldSetText("Namelist_Group_Num",group_num)
'groupstring="Namelist"&""&group_num&Chr(10)
Setthisrange=thisdoc.range(1,1)
thisrange.InsertBefore(pagehead)
Setthisrange=thisdoc.range(2,Len(pagehead))
Withthisrange
.bold=True'加粗
.ParagraphFormat.Alignment=1'wdAlignParagraphCenter行居中
.font.size=20'字体大小为20
EndWith
Setdoccustom=doccollection.GetFirstDocument
'遍列文档集的所有文档,获取所有满足条件的纪录数
WhileNot(doccustomIsNothing)
counter=counter+1
Setdoccustom=doccollection.GetNextDocument(doccustom)
Wend
'动态分配纪录数组
'Redimrecord(counter,6)AsString
'插入一张表
Setthisrange=thisdoc.range(Len(pagehead)+1,Len(pagehead)+1)
Setthistable=thisdoc.tables.Add(thisrange,counter+1,8)
'thistable.autoformat(False)
'写表头
thistable.rows
(1).cells
(1).range.insertbefore("前往国家")
thistable.rows
(1).cells
(2).range.insertbefore("国家数")
thistable.rows
(1).cells(3).range.insertbefore("天数")
thistable.rows
(1).cells(4).range.insertbefore("出境城市")
thistable.rows
(1).cells(5).range.insertbefore("入境城市")
thistable.rows
(1).cells(6).range.insertbefore("出发日期")
thistable.rows
(1).cells(7).range.insertbefore("同行价")
thistable.rows
(1).cells(8).range.insertbefore("市场指导价")
'恢复计数器
counter=0
'写表内容
Setdoccustom=doccollection.GetFirstDocument
WhileNot(doccustomIsNothing)
counter=counter+1
thistable.rows(counter+1).cells
(1).range.insertbefore(doccustom.plan_country(0))
thistable.rows(counter+1).cells
(2).range.insertbefore(doccustom.plan_country_num(0))
thistable.rows(counter+1).cells(3).range.insertbefore(doccustom.plan_day(0))
thistable.rows(counter+1).cells(4).range.insertbefore(doccustom.plan_out_city(0))
thistable.rows(counter+1).cells(5).range.insertbefore(doccustom.plan_in_city(0))
thistable.rows(counter+1).cells(6).range.insertbefore(doccustom.plan_date(0))
thistable.rows(counter+1).cells(7).range.insertbefore(doccustom.plan_whole_price(0))
thistable.rows(counter+1).cells(8).range.insertbefore(doccustom.plan_mart_price(0))
Setdoccustom=doccollection.GetNextDocument(doccustom)
Wend
EndIf
EndSub
9.如何实现表单上的内容根据用户的输入动态变化?
答:
一般可以用notes的隐藏属性功能来控制,使用当公式为真是隐藏,然后靠公式来控制具体怎样隐藏.比如可以在对话筐上放一个对话筐列表,里面放十个选项,当用户选择了其中的某几个选项时,响应的在下面的表单部分显示几行.这可以画一个表格,这个表格的属性中设置边框的线条粗细为零.然后对应十个选项分为十行,每行填入和选项响应的内容,然后选定某一行的所有文本,编辑其隐藏属性,选当公式为真时隐藏,这个公式您就可以写成当选项的被选中条目中不包含本行文字时隐藏就可以了,这样这一行就会在响应的选项被选中时才会显示.
10.notes没有应用程序级的公共变量,那么我如果要弹出一个对话筐,并从这个对话筐中返回很多用户输入,我该怎么办?
怎样判断视图中没有文档?
dimuiwasnewnotesuiworkspace
dimdocasnotesdocument
setdoc=uiw.getfirstdocument()
ifdocisnothingthen
.....
endif
如何将查询结果放到一个文件夹里?
下面是将搜索结果放到名叫newfolder的文件夹中,并跳转到该文件夹上
SubClick(SourceAsButton)
dimuiwasnewnotesuiworkspace
dimuidocasnotesuiworkspace
dimdocasnotesdocument
setuidoc=uiw.currentdocument
setdoc=uidoc.document
dimssasnewnotessession
dimdbasnotesdatabase
setdb=ss.currentdatabase
constnewfolder="文件夹名称"
DimdocsAsnotesdocumentcollection
q=doc.query(0)
Setdocs=db.ftsearch(q,0)
Calldocs.PutAllInFolder(newfolder)
Calluiw.OpenDatabase(,,newfolder)
EndSub
如何在Notes中调用ODBC数据源中的进程?
DimsessionAsNewNotesSession
DimconAsNewODBCConnection
DimqryAsNewODBCQuery
DimresultAsNewODBCResultSet
Setqry.Connection=con
Setresult.Query=qry
con.ConnectTo(资料库)
qry.SQL=SELECT*FROM资料库
result.Execute
Ifresult.IsResultSetAvailableThen
Do
result.NextRow
id=result.GetValue(ID,id)
LoopUntilresult.IsEndOfData
result.Close(DB_CLOSE)
Else
Messagebox"CannotgetresultsetforAssetData"
ExitSub
EndIf
con.Disconnect
EndSub
从后台刷新当前文档?
将当前文档先关闭后再打开
setdoc=uidoc.document
......
calluidoc.save()
calluidoc.close()
setuidoc=ws.editdocument(doc)
获得当前视图中选择了的文档?
可以用Notesdatabase的Unprocesseddocuments属性。
DimsessionAsNewnotessession
DimdbAsnotesdatabase
DimcollectionAsnotesdocumentcollection
Setdb=session.currentdatabase
Setcollection=db.UnprocessedDocuments
Unprocesseddocuments其实很有用的
notes和Excel交换数据
DimsessionAsNewNotesSession
DimdbAsNotesDatabase
DimviewAsNotesView
DimdocAsNotesDocument
DimexcelApplicationAsVariant
DimexcelWorkbookAsVariant
DimexcelSheetAsVariant
DimiAsInteger
SetexcelApplication=CreateObject(Excel.Application)
excelApplication.Visible=True
SetexcelWorkbook=excelApplication.Workbooks.Add
SetexcelSheet=excelWorkbook.Worksheets(Sheet1)
excelSheet.Cells(1,1).Value=姓名
excelSheet.Cells(1,2).Value=年龄
i=1
Setdb=session.CurrentDatabase
Setview=db.GetView(abc)
Setdoc=view.GetFirstDocument
WhileNot(docIsNothing)
i=i+1
excelSheet.Cells(i,1).Value=doc.ClassCategories(0)
excelSheet.Cells(i,2).Value=doc.Subject(0)
Setdoc=view.GetNextDocument(doc)
Wend
excelSheet.Columns(A:
B).Select
excelSheet.Columns(A:
B).EntireColumn.AutoFit
excelWorkbook.SaveAs(Script内容)
excelApplication.Quit
SetexcelApplication=Nothing
在视图中怎样历遍所有的文档?
DimdbAsNewNotesDatabase(Ankara,current\projects.nsf)
DimviewAsNotesView
DimdocAsNotesDocument
Setview=db.GetView(Open\ByDueDate)
Setdoc=view.GetFirstDocument
WhileNot(docIsNothing)
....................
Setdoc=view.GetNextDocument(doc)
Wend
在scipt中如何调用公式
例如我们想要取服务器名的普通名,在script中用@name(),假设server变量以取到服务器名称
在script中用Evaluate可以运行公式,如:
servername=Evaluate(@name([CN];server))
怎样用script代理取到CGI变量
DimsessionAsNewNotesSession
DimdocAsNotesDocument
Setdoc=session.DocumentContext
MessageboxUser=+doc.Remote_User(0)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LOTUS 学习 技巧