How to read a Lotus Notes Rich Text Table with new line in the cell

I am unable to read the entire contents of a rich text table cell is it contains a new line within the cell. How do I accomplish this?

here is the code I'm using:
Sub Initialize
      Dim ws As New NotesUIWorkspace
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim maildoc As NotesDocument
      Dim rtitem As NotesRichTextItem
      Dim rtnav As NotesRichTextNavigator
      
      
      Set db=s.CurrentDatabase
      Set dc=db.UnprocessedDocuments
      
      If dc.Count>1 Then
            Msgbox "Please select a single document", MB_OK, "Line Report"
            Continue=False
            End
      Else
            Set maildoc=dc.GetFirstDocument()
            Set rtitem=maildoc.GetFirstItem("Body")
            Set rtnav=rtitem.CreateNavigator
            count = GetElementCount(rtnav, RTELEM_TYPE_TABLE)
'msg$ = msg$ & "Tables:" & Chr(9)  & Chr(9) & count% & Chr(10)
'Messagebox msg$,, maildoc.Subject(0)
            If count=0 Then
                  Messagebox "Body item does not contain a table,",, _
                  "Error"
                  Exit Sub
            End If
            
            For k=1 To count
                  If  rtnav.FindNthElement(RTELEM_TYPE_TABLE,k) Then
                        Dim rttab As NotesRichTextTable
                        Set rttab=rtnav.GetElement
                        Dim rtrange As NotesRichTextRange
                        Set rtrange=rtitem.CreateRange
                        If k=1 Then
                              Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)    
                        Else
                              Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
                        End If
                        
                        firstFlag = True
                        
                        For i& = 1 To rttab.RowCount
                              For j& = 1 To rttab.ColumnCount
                                    If Not firstFlag Then
                                          Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
                                    Else    
                                          firstFlag = False      
                                    End If
                                    Call rtrange.SetBegin(rtnav)
                                    Messagebox rtrange.TextParagraph,, _
                                    "Row " & i& & _
                                    ", Column " & j&
                              Next    
                        Next
                  End If
            Next
      End If
End Sub

Function GetElementCount(rtnav As NotesRichTextNavigator, eType As Integer) As Integer
      GetElementCount = 0
      If rtnav.FindFirstElement(eType) Then
            Do
                  GetElementCount = GetElementCount + 1
            Loop While rtnav.FindNextElement()
      End If
End Function
sullisnyc44Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sullisnyc44Author Commented:
found this bit of code to get me started...

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim body As NotesRichTextItem
  Dim rtnav As NotesRichTextNavigator
  Dim rtt As NotesRichTextTable
  Dim rtRangeTable As NotesRichTextRange
  Dim rtRangeCell As NotesRichTextRange
  Dim rtRangePara As NotesRichTextRange
  Dim rtNavTable As NotesRichTextNavigator
  Dim rtNavCell As NotesRichTextNavigator
  Dim cellCounter As Integer
  Dim msg As String
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  Set body = doc.GetFirstItem("Body")
  REM Find first table in Body item
  Set rtnav = body.CreateNavigator
  If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
    Messagebox "Body item does not contain a table,",, _
    "Error"
    Exit Sub
  End If
  REM Set up range and navigator for table
  Set rtRangeTable = body.CreateRange
  Call rtRangeTable.SetBegin(rtnav)
  Call rtRangeTable.SetEnd(rtnav)
  Set rtNavTable = rtRangeTable.Navigator
  REM Find cells in table
  Set rtRangeCell = body.CreateRange
  Set rtRangePara = body.CreateRange
  cellCounter = 0
  Call rtNavTable.FindFirstElement(RTELEM_TYPE_TABLECELL)
  Do
    msg = ""
    cellCounter = cellCounter + 1
    REM Set up range and navigator for cell
    Call rtRangeCell.SetBegin(rtNavTable)
    Call rtRangeCell.SetEnd(rtNavTable)
    Set rtNavCell = rtRangeCell.Navigator
    REM Find paragraphs in cell
    Call rtNavCell.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH)
    Do
      Call rtRangePara.SetBegin(rtNavCell)
      msg = msg & rtRangePara.TextParagraph & Chr(13)
    Loop While rtNavCell.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
    Messagebox msg,, "Cell " & cellCounter
  Loop While rtNavTable.FindNextElement(RTELEM_TYPE_TABLECELL)
End Sub
0
Sjef BosmanGroupware ConsultantCommented:
Haven't yet rad your code, but what I can say is that text that contains a new line is in fact text in two paragraphs. So maybe you (just) have to get the next paragraph.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mbonaciCommented:
That's it, you found the solution yourself, you have to loop through paragraphs, the same way you loop through table cells.
0
Sjef BosmanGroupware ConsultantCommented:
Too kind of you...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.