Hello,
I have a agent displays data in two columns. The problem is: The second column relies on the first column. So if the data in the first column is then the second column will be shifted to the left handside, and if the first column is long, then it’ll be shifted to the right handside. How do I set the fixed margin for the second column? How can I fix this issue?
====================================
…Some of declarations below are not needed in for this agent…
====================================
Dim uiwSource As NotesUIWorkspace
Dim nsSource As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
'Dim doc As NotesDocument
Dim SendDoc As NotesDocument
'Dim curdoc As NotesDocument
Dim amat_db As NotesDatabase
Dim amat_doc As NotesDocument
Dim amat_lookupview As notesview
Dim ecp_db As NotesDatabase
Dim ecp_doc As NotesDocument
Dim ecp_lookupview As notesview
Dim nrtiNotice As NotesRichTextItem
Dim servername As String
Dim agentlog As NOTESLOG
Dim iDocs As Integer
Dim richStyle As NotesRichTextStyle
Dim compare_doc As NotesDocument
Dim ListName As Variant
Dim ListNameNotFound () As Variant, ListNametFound () As Variant
Dim iNotFound As Integer, iFound As Integer
Dim rtpStyle As NotesRichTextParagraphStyle
Dim ecp_admin As Variant, amat_admin As Variant
Dim aACounter As Integer, eACounter As Integer
Dim aCn () As String, eCn () As String
Dim eAdmin As NotesName, aAdmin As NotesName
Dim eLoop As Integer, aLoop As Integer
Dim x As Integer, y As Integer
Dim iamat As Integer
Dim aTemp As String
====================================
Sub Initialize
Dim session As New NotesSession
Dim nisource As NotesItem
Dim nisource1 As NotesItem
Dim nrtiNoticeParaStyle As NotesRichTextParagraphStyle
Dim nrtiNoticeTextStyle As NotesRichTextStyle
On Error Goto Quit
Set agentlog = New NOTESLOG( "SET MARGIN AGENTS")
Call agentlog.OPENAGENTLOG
Call agentLog.LogAction("Started: " & Time$())
servername="XXXX"
Set ecp_db=New notesdatabase(servername, "XXXX.nsf")
Set ecp_lookupview = ecp_db.GetView("XXXX")
Set amat_db=New notesdatabase(servername, "XXXXX.nsf")
Set amat_lookupview = amat_db.GetView("XXXXX")
Set compare_doc = ecp_lookupview.GetFirstDocument
Set SendDoc = New NotesDocument(ecp_db)
Set nrtiNotice = New NotesRichTextItem(SendDoc, "Body")
Set nrtiNoticeParaStyle = Session.CreateRichTextParagraphStyle
Set nrtiNoticeTextStyle = Session.CreateRichTextStyle
nrtiNoticeTextStyle.FontSize = 10
Dim pos As Long
Dim interval As Long
pos = RULER_ONE_INCH
interval = RULER_ONE_CENTIMETER
iNotFound = 0
iFound = 0
iamat = 0
iDocs = 0
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
Dim ntfy_DbAdmin() As String
Dim ntfy_SuperAdmin() As String
Dim RoleFound As Boolean, SaFound As Boolean
Dim i As Integer, j As Integer
i = 0
j = 0
Set acl = ecp_db.ACL
Set aclEntry = acl.GetFirstEntry
RoleFound = False
Do Until aclEntry Is Nothing
If aclEntry.IsRoleEnabled( "[DbAdmin]" ) Then
RoleFound = True
i = i + 1
Redim Preserve ntfy_DbAdmin(i)
ntfy_DbAdmin(i) = aclEntry.Name
End If
Set aclEntry = acl.GetNextEntry( aclEntry )
Loop
If RoleFound Then
Set niSource = New NotesItem(SendDoc, "SendTo", ntfy_DbAdmin)
Else
Set niSource = New NotesItem(SendDoc, "SendTo", "XXXXXX" )
End If
nrtiNoticeParaStyle.LeftMargin = RULER_ONE_INCH
Call nrtiNotice.AppendText("Dear XXX, ")
Call nrtiNotice.AddNewLine(2)
Call nrtiNotice.AppendText("this is a test...")
Call nrtiNotice.AddNewLine(2)
Call nrtiNotice.AddTab(1)
nrtiNoticeTextStyle.Bold = True
nrtiNoticeTextStyle.Underline = True
Call nrtiNotice.AppendStyle(nrtiNoticeTextStyle)
Call nrtiNotice.AppendText("Column 1")
nrtiNoticeParaStyle.LeftMargin = RULER_ONE_INCH * 4.0
Call nrtiNotice.AddTab(3)
Call nrtiNotice.AppendText("Column 2")
nrtiNoticeTextStyle.Bold = False
nrtiNoticeTextStyle.Underline = False
Call nrtiNotice.AppendStyle(nrtiNoticeTextStyle)
Call nrtiNotice.AddNewLine(1)
'The columns are aligned when they're printed out.
'It's because of the length of the data value.
While Not (compare_doc Is Nothing)
iDocs = iDocs + 1
ListName = compare_view.ColumnValues(0)
If ListName <> "" Then
If (compare_view.HasItem("RQ_Status")) Then
If compare_view.GetItemValue("RQ_Status")(0) = "InActive" Then
Set amat_doc=amat_lookupview.GetDocumentByKey(ListName)
If Not (amat_doc Is Nothing) Then
Call nrtiNotice.AddNewLine(1)
Call nrtiNotice.AddTab(1)
Call nrtiNotice.AppendDocLink(compare_view, ListName, ListName)
Call nrtiNotice.AddTab(3)
Call nrtiNotice.AppendDocLink(amat_doc, ListName, ListName)
Call nrtiNotice.AddNewLine(1)
Set niSource = New NotesItem(SendDoc, "SendTo", ntfy_DbAdmin)
End If
End If
End If
End If
Set compare_doc = ecp_lookupview.GetNextDocument(compare_doc)
Wend
Call nrtiNotice.AppendParagraphStyle(nrtiNoticeParaStyle) '<=================
Call nrtiNotice.AddNewLine( 2, True )
Call nrtiNotice.AppendText("Best Regards,")
Call nrtiNotice.AddNewLine( 3, True )
Call nrtiNotice.AppendText(ecp_db.Title + " Database")
Call nrtiNotice.AddNewLine( 2, True )
Set richStyle = Session.CreateRichTextStyle
richStyle.FontSize = 7
Call nrtiNotice.AppendStyle(richStyle)
Call nrtiNotice.AppendText("This is a test")
richStyle.Bold = True
Call nrtiNotice.AppendStyle(richStyle)
Call nrtiNotice.AppendText("This is another message")
richStyle.Bold = False
Call nrtiNotice.AppendStyle(richStyle)
Call nrtiNotice.AppendText("This is another message...")
Call nrtiNotice.AddNewLine( 1, False )
Call nrtiNotice.AddNewLine(1)
SendDoc.Form = "Memo"
SendDoc.Principal = ecp_db.Title
SendDoc.From = SendDoc.Principal(0)
Call SendDoc.ReplaceItemValue("Subject", "Values in Columns" )
Call SendDoc.Send(False)
Call agentLog.LogAction("Ended: " & Str(iDocs))
If Not ( agentLog Is Nothing ) Then
Call agentlog.CLOSE
End If
Exit Sub
Quit:
Msgbox Error & " at line: " & Erl
End Sub
====================================
Thanks for your help.
Mike Woo