I created a response document which fetches/inherits some field values from its parent document and i had an richtext field in which i have to create an table in which user adds the input, and i made it by writing LS on PostOpen event.
The proble that i am facing is that, on debugging i found that, intially when document opens all the fields are inherited properly, and as the script for table in richtext executes, it makes all the inherited values to disappear. The coding that i have made use is given below,(writen in PostOpen event)
Sub Postopen(Source As Notesuidocument)
If source.isnewdoc Then
Dim ws As New NotesUIWorkspace
Dim ss As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set db=ss.CurrentDatabase
Set doc=db.CreateDocument
doc.form=“NewMinutesForm”
Dim rich As NotesRichTextItem
Dim nav As NotesRichTextNavigator
Dim table As NotesRichTextTable
Set rich=New NotesRichTextItem(doc,“mrich”)
Dim style(0 To 5) As NotesRichTextParagraphStyle
For i=0 To 5
Set style(i) = ss.CreateRichTextParagraphStyle
style(i).LeftMargin=0
style(i).FirstLineLeftMargin=0
Next
style(0).RightMargin=RULER_ONE_CENTIMETER
style(0).Alignment=ALIGN_CENTER
style1).RightMargin=6.5*RULER_ONE_CENTIMETER
style(1).Alignment=ALIGN_CENTER
style(2).RightMargin=5.25*RULER_ONE_CENTIMETER
style(2).Alignment=ALIGN_CENTER
style(3).RightMargin=4*RULER_ONE_CENTIMETER
style(3).Alignment=ALIGN_CENTER
style(4).RightMargin=2.5*RULER_ONE_CENTIMETER
style(4).Alignment=ALIGN_CENTER
Call rich.AppendTable(2,5, , , style)
Set nav=rich.CreateNavigator
nav.findFirstElement(RTELEM_TYPE_TABLE)
nav.findnextElement(RTELEM_TYPE_TABLECELL)
rich.BeginInsert nav
rich.AppendText(“S.NO”)
rich.EndInsert
nav.findNextElement
rich.BeginInsert nav
rich.AppendText(“ACTION”)
rich.EndInsert
nav.findnextElement
nav.FindFirstElement(rtelem_type_table)
Set able=nav.GetElement
Dim color As NotesColorObject,color1 As NotesColorObject
Set color=ss.CreateColorObject
color.NotesColor=color.SetRGB(177,177,210)
Set color1=ss.CreateColorObject
color1.NotesColor=color_white
table.Style=tablestyle_top
Call table.SetColor(color)
Call table.SetAlternateColor(color1)
Call doc.Save(True,False)
Call source.Save
Call source.Close
Call ws.EditDocument(True,doc)
doc.Remove(True)
End If
End Sub
Any solutions would be greatly appreciated.
Thanks
Vignesh Chandrasekarn