Reputation: 11
I'm new with Notes and LotusScript and I got a problem.
I need to create a table in a rich text item, I have used an "action partagée" (maybe "shared action" in English). My code runs without returning an error but my table is not visible.
Sub Click(Source As Button)
On Error Goto errorhandler
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As Notesuidocument
Dim doc_bdl As NotesDocument
Dim table As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
' création du document
Set uidoc = workspace.ComposeDocument("","","EXPEDITION")
Set doc_bdl = uidoc.Document
Set table = New NotesRichTextItem(doc_bdl,"rtTableau")
' création du tableau
Call table.AppendTable(4, 3)
Set rtnav = table.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
Dim iRow As Integer
Dim iColumn As Integer
For iRow = 1 To 4 Step 1
For iColumn = 1 To 3 Step 1
Call table.BeginInsert(rtnav)
Call table.AppendText("Ligne " & iRow & ", Colonne " & iColumn)
Call table.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
Exit Sub
errorHandler:
Print Lsi_info(2) & " : " & Err & " (" & Error & ") ligne " & Erl
Exit Sub
End Sub
I have read that to see the content of rich text items it's necessary to refresh the document. So I used examples in the help. I tried to add this :
Call doc_bdl.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
I got no error but I still not see my table.
I tried this :
Call doc_bdl.Save(True, False)
Call doc_bdl.Refresh(True)
I got this error : "Illegal use of PROPERTY"
Can someone help me ? Thank you in advance
PS : English is not my language so please excuse my possible errors, I don't find french forums for help.
Upvotes: 1
Views: 1582
Reputation: 2795
You need to do something like this:
' Save your backend document with the updated RichText field
Call doc_bdl.Save(True, False)
' Open saved backend document as a uidoc
ws.EditDocument(True, doc_bdl)
If you want to build a table with content, and you don't know how many rows there will be (and/or if you want more control ov the formatting of the table) you can use this technique:
http://blog.texasswede.com/dynamic-tables-in-classic-notes/
Upvotes: 1