Can I use AppendtoTextList & RenderToRTItem along with while loop

I have to generate a complinace reports. I have taken a rich textfield in my form.Now my question to you is that I wanted to use appendtoTextList & RendertoRTItem alone with a while loop. But i am not getting the desired result. Some alignment problem arisen.

can it be sorted out? Please suggest?

Thanx in advance.

Subject: Can I use AppendtoTextList & RenderToRTItem along with while loop.

There shouldn’t be a problem, since these are two independent operations happening on different fields. At least I hope they are. You aren’t trying to use AppendToTextList on a rich text field, are you?

Subject: RE: Can I use AppendtoTextList & RenderToRTItem along with while loop.

Thanx for the reply. Ya i am using AppendtotextList. But still my output is not proper i.e. between two lines, there are so much of GAP inspite of using appendtotextlist.I am giving you the code.Please help me out.

Thanx in advance.

Dim s As New NotesSession

Dim uiws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim db As NotesDatabase

Dim doc As NotesDocument, doc1 As NotesDocument, doc2 As NotesDocument, doc3 As NotesDocument

Dim rtitem As NotesRichTextItem

Dim dc As NotesDocumentCollection

Dim item As NotesItem

Dim Vw1 As NotesView, Vw2 As NotesView ,Vw3 As NotesView,Vw4 As NotesView, Vw5 As NotesView

Dim richStyle As NotesRichTextStyle

Dim rtpStyle As NotesrichTextParagraphStyle

Dim key(0) As String



Set db=s.CurrentDatabase

Set uidoc=uiws.CurrentDocument	

Set richStyle = s.CreateRichTextStyle

Set rtpStyle = s.CreateRichTextParagraphStyle

Set doc=db.CreateDocument

doc.form="frmComplianceReport"

Set rtitem = New NotesRichTextItem _

( doc, "ComplianceReport1" )

tmpdept =uidoc.FieldGetText("DepartmentTX")

key(0)=tmpdept

Set Vw1=db.GetView("VwComplianceAllforCount")

Set Vw2=db.GetView("VwUnFitForDuty")

Set Vw3=db.GetView("VwReferredCases")

Set Vw4=db.GetView("VwBlankMedicalRecordTest")

Set Vw5=db.GetView("VwDeptEmployeeforCount")



Set dc=Vw1.GetAllDocumentsByKey(key,True) 

'Messagebox dc.Count

Set doc1=db.CreateDocument

doc1.form="DfrmSummery"

doc1.DepartmentTX=tmpdept

doc1.TotalAttendedNM=dc.Count

Set dc=Vw2.GetAllDocumentsByKey(key,True) 

doc1.UnitforDutyNM=dc.Count

Set dc=Vw3.GetAllDocumentsByKey(key,True) 

doc1.ReferredcasesNM=dc.Count

Set dc=Vw5.GetAllDocumentsByKey(key,True)

doc1.TotalEmplNM=dc.Count

Call doc1.RenderToRTItem(rtitem)

Set doc2=Vw4.GetDocumentByKey(key,True)

richStyle.NotesFont = FONT_ARIALBLACK

richStyle.FontSize = 13

richstyle.NotesColor=Blue

'RICHSTYLE.Bold="Heading"

rtpstyle.Alignment=ALIGN_LEFT

'rtpStyle.InterLineSpacing = SPACING_SINGLE[0]

rtpStyle.SpacingBelow = SPACING_SINGLE



Heading="List of Employees who has not attended the medical check-up"

Call rtitem.AppendStyle(richStyle)

Call rtitem.AppendParagraphStyle(rtpstyle)

Call rtitem.AppendText(Cstr(Heading))



Set doc1=db.CreateDocument

doc1.form="DfrmPersonalDetails"	



While Not (doc2 Is Nothing)

	'Set doc3=db.CreateDocument

	'doc3.form="DfrmSummery"	

	doc1.PnoTX=doc2.PnoTX(0) + "-" + doc2.FnameTX(0) + " " + doc2.LnameTX(0)

	'Msgbox DOC1.PnoTX(0)

	'Set item = doc1.GetFirstItem("PnoTX")

	If item.Contains(doc1.PnoTX(0)) Then

	'	Msgbox PnoTX(0)

Else

	item.AppendToTextList(doc2.PnoTX(0) + " "+ doc2.FNameTX(0) + " " + doc2.LNameTX(0))

	Call doc1.Save( False, True )

End If

	'Msgbox rtpStyle.InterLineSpacing

	

	Call doc1.RenderToRTItem(rtitem)

	

	Set doc2 = Vw4.GetNextDocument(doc2)	

	Call rtitem.AppendParagraphStyle(rtpStyle)

Wend

Call uidoc.FieldSetText("hiddentx","1")

Call doc.Save( True, True )

Call UIDOC.Close