Here’s an odd thing. In my client when I get to this part of my code (full code follows), Call rtbody.AppendTable (rowCount%,columnCount%,rpts)
The rtbody item is renamed in debugger to non printable characters (looks like FOO with high ascii code box characters).
Needless to say the ‘Body’ field remains empty and never is updated with my table.
This code is run from a button on the form in edit mode. I have one RichText field on this form called Body (the form is based on the Journal entry form). I tried running this button while the doc is new and have also tried saving it first, closing it, then reopening and running the button, same FOO result.
I did read the 66 docs that were returned in this forum for AppendTable. I also searched the Fix DB and the Technotes forum and didn’t see this FOO thing mentioned.
I am asking for help, what should I look at to fix this. Could this be a a bug or something that I did? Here’s my code - with thanks to one of those 66 posters!
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
’ Dim rtbody As NotesRichTextItem
’ Set rtbody = doc.GetFirstItem( “Body”)
Dim rtbody As New NotesRichTextItem( doc, "Body" )
REM Create table in Body item
rowCount% = 3
columnCount% = 3
numColumns = 3
Dim rtpStyle As NotesRichTextParagraphStyle
Dim rtps(1 To 3) As NotesRichTextParagraphStyle
'populate the array that will set the size of the columns
For column = 1 To columnCount%
Set rtpStyle = session.CreateRichTextParagraphStyle
'the first column is the long one
If column = 1 Then
rtpStyle.RightMargin = RULER_ONE_INCH * 1.5
rtpStyle.FirstLineLeftMargin = 0
rtpStyle.LeftMargin = 0
'the last column is slightly bigger than the remaining
Elseif column = 4 Then
rtpStyle.RightMargin = RULER_ONE_INCH * 4
rtpStyle.FirstLineLeftMargin = 0
rtpStyle.LeftMargin = 0
Else
'all other columns can be half and inch rtpStyle.FirstLineLeftMargin = 0
rtpStyle.LeftMargin = 0
rtpStyle.RightMargin = RULER_ONE_INCH * 1.5
End If
Set rtps(column) = rtpStyle
Next
Call rtbody.AppendTable (rowCount%,columnCount%,,,rpts)
' (rowCount%, columnCount%,,, styles)
’ REM Populate table
’ Dim rtnav As NotesRichTextNavigator
’ Set rtnav = body.CreateNavigator
’ Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
’ For iRow% = 1 To 4 Step 1
’ For iColumn% = 1 To 3 Step 1
’ Call body.BeginInsert(rtnav)
’ Call body.AppendText("Row " & iRow% & ", Column " & iColumn%)
’ Call body.EndInsert
’ Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
’ Next
’ Next
REM Save document and refresh view
Call doc.Save(True, False)
Call ws.ViewRefresh
Call uidoc.Close
Set uidoc = ws.EditDocument(True,doc)
End Sub
Thanks,
Linda ![]()
P.S. I am not a ‘developer’ I just play one on TV…