因为表单中有两个放附件的域A和B,无法用hasEmbedded来判断B是否有附件。
请大神指点一下其他方法。我只需要判断域B是否有附件,但是域A会干扰。
往一个RichText类型的域里放文档链接(Copy as a document link)。怎么判断这个域是不是空?
两个问题,感谢了先!
Dim rtitem As NotesItem
Set rtitem = doc.GetFirstItem("Link")
Msgbox rtitem.ValueLength
Link域里是空的为什么返回长度104?RichText域里没有任何内容时字节长度就是104?
目前没有完美的办法,
1) 如果可以先保存文档,那你可以先保存文档(uidoc.Save),然后重新打开就可以对单个RTF字段内容进行判断:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkSpace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim strUNID As String
Dim rtfItem As Variant
Dim bFind As Boolean
Set db = session.CurrentDatabase
Set uidoc=ws.CurrentDocument
Call uidoc.Save()
strUNID = uidoc.Document.UniversalID
Call uidoc.Close()
Set doc=db.getDocumentByUNID(strUNID )
Set uidoc=ws.EditDocument(True,doc)
Set doc=uidoc.Document
Set rtfItem =doc.GetFistItem("Your RTF Item Name")
If Not Isempty(rtfItem.EmbeddedObjects) Then
bFind=False
Forall o In rtfItem.EmbeddedObjects
If o.Type=EMBED_ATTACHMENT Then
bFind=True
End If
End Forall
If Not bFind Then
Msgbox "Has Not any Attachment!"
Else
Msgbox "Has Attachment!"
End If
Else
Msgbox "Has Not any Attachment!"
End If
链接的判断只要将那个EMBED_ATTACHMENT换成EMBED_OBJECTLINK,具体参考:
类NotesRichTextItem的EmbeddedObjects属性和类NotesEmbeddedObject的Type属性