Document Synopsis

This agent creates a new document based off the document whose items you wish to examine. All item names and text values are compiled in a report.

It is coded as an agent to work with your mail d.b. and triggered off selected documents in a view. The report document is then placed in your inbox. You can tweek a few lines and use the code in any d.b. you wish.

Code: Sub Initialize 
        Dim session As New NotesSession 
        Dim db As NotesDatabase 
        Dim dc As NotesDocumentCollection 
        Dim doc As NotesDocument 
        Dim testdoc As NotesDocument 
        Dim Body As NotesRichTextItem 
        Dim tempRTitem As NotesRichTextItem 
        Dim getItem As NotesItem 
        Dim theSub As String 
        Dim itemname As String 
        Dim itemType As Integer 
        Dim rtitemText As String 
        Dim richStyle As NotesRichTextStyle 
        Dim richStyle2 As NotesRichTextStyle 
        Set db = session.CurrentDatabase 
        Set dc = db.UnprocessedDocuments 
        Set richStyle = session.CreateRichTextStyle 
        richStyle.NotesFont = FONT_COURIER 
        richStyle.FontSize = 10 
        richStyle.Bold = True 
        Set richStyle2 = session.CreateRichTextStyle 
        richStyle2.NotesFont = FONT_COURIER 
        richStyle2.FontSize = 8 
        richStyle2.Bold = False 
        NumSel = dc.Count   
        For j = 1 To NumSel 
                Set doc = dc.GetNthDocument(j) 
                theSub = doc.GetItemValue("Subject")(0) 
                Set testdoc = New NotesDocument(db) 
                testdoc.Form = "Memo" 
                Set Body = New NotesRichTextItem(testdoc,"Body") 
                testdoc.Subject = ("Document Synopsis for: " & theSub) 
                Forall i In doc.items 
                        itemType = i.Type 
'                       itemValues(Ucase(i.Name)) = i.Text 
                        itemname = i.Name 
                        If itemType = 1 Then 
                                Set tempRTitem = doc.GetFirstItem(itemname) 
                                rtitemText = tempRTitem.GetFormattedText(True, 60) 
                                Call Body.AppendStyle(richStyle) 
                                Call Body.AppendText(Chr(10) & itemname & ":  " & Chr(10)) 
                                Call Body.AppendStyle(richStyle2) 
                                Call Body.AppendText(rtitemText & Chr(10)) 
                                Call Body.AppendStyle(richStyle) 
                                Call Body.AppendText(Chr(10) & itemname & ":  " & Chr(10)) 
                                Call Body.AppendStyle(richStyle2) 
                                Set getItem = doc.GetFirstItem(itemname) 
                                Forall v In getItem.Values 
                                        Call Body.AppendText(Cstr(v) & Chr(10)) 
                                End Forall 
                        End If 
                End Forall 
                Call testdoc.Save(True, False) 
                Call testdoc.PutInFolder("($Inbox)") 
End Sub

This was first published in December 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.