Details
| I am testing a technique to make rich text data immediately visible to the client and am experiencing a problem where a uidoc window will not close. The code functions correctly until I hit around 5000 lines of output.
Sample code is listed below and assumes that the code is executed from a button or action on a form and the form contains a rich text field named "body". The constant MAXLINES is used to control the number of lines of output. When MAXLINES is increased to around 5000, the original uidoc window remains opened.
Sub Click(Source As Button)
'--- Number of lines of output written to the Rich Text field
Const MAXLINES = 50
Dim uiws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim uidocNew As NotesUIDocument
Dim rtitem As NotesRichTextItem
Dim rtrange As NotesRichTextRange
Dim i As Integer
Set uidoc = uiws.CurrentDocument
Set doc = uidoc.Document
Call uidoc.Refresh(True)
Set rtitem = doc.GetFirstItem("Body")
Set rtrange = rtitem.CreateRange
Call rtrange.Remove
For i = 1 To MAXLINES
Call rtitem.AppendText( Format(i,"0#. ") + "This is a line of test output")
Call rtitem.AddNewline(2)
Next
rtitem.Update
doc.SaveOptions = "0"
Call uidoc.Close(True)
Set uidocNew = uiws.EditDocument(True,doc, , , , True)
Delete uidoc
uidocNew.Document.RemoveItem("SaveOptions")
End Sub
|