Subject: NotesRichTextItem.saveToDisk=False do not work
The help states - If you mark an existing item as not to be saved, it disappears from disk the next time you save the document.
As rich text fields do not exist on the document until it is saved for the first time then this is probably the problem. Have you tried it on an existing document to see if the rich text field disappears?
Subject: RE: NotesRichTextItem.saveToDisk=False do not work
What are you doing in read mode? If it is creating a rich text field on the back end document but you never save that document then the rich text field will not be saved to disk.
There is a difference in the way rich text fields and other fields work.
text, number fields etc exist on a document as soon as it is created so setting SaveToDisk to False will not save them to a document.
rich text fields do not exist on a document until it has been saved for the first time so setting SaveToDisk to False is having no affect. It can not see the rich text field to stop it being saved.
Subject: RE: NotesRichTextItem.saveToDisk=False do not work
I have tested this out and found that SaveToDisk = False does not work for new rich text fields or rich text fields where you set SaveToDisk = False but amend the value of the existing field
'New Document. Rich Text field saved with value of TEXT
Sub Postopen(Source As Notesuidocument)
Dim ws As New notesuiworkspace
Dim uidoc As NotesuiDocument
Dim doc As notesdocument
Dim rtitem As notesrichtextitem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rtitem = New notesrichtextitem(doc, "TestRTFIeld")
Call rtitem.AppendText("TEXT")
rtitem.SaveToDisk = False
End Sub
'Existing rich text field with value of TEXT not saved to the document
Sub Postopen(Source As Notesuidocument)
Dim ws As New notesuiworkspace
Dim uidoc As NotesuiDocument
Dim doc As notesdocument
Dim rtitem As notesrichtextitem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rtitem = doc.GetFirstItem("TestRTField")
rtitem.SaveToDisk = False
End Sub
'Existing rich text field with value of TEXT saved to document with new value of TEXT1
Sub Postopen(Source As Notesuidocument)
Dim ws As New notesuiworkspace
Dim uidoc As NotesuiDocument
Dim doc As notesdocument
Dim rtitem As notesrichtextitem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rtitem = doc.GetFirstItem("TestRTField")
Call rtitem.AppendText("TEXT1")
rtitem.SaveToDisk = False
Subject: RE: NotesRichTextItem.saveToDisk=False do not work
Thanks a lot Matt.Because the names of that fields are calculated dynamically I have decided to dim a global variable of all the fields I create on post open event, and on QueryClose to delete them with doc.GetFirstItem and item.remove rather to cycle with forall item in doc.Items and if … item.remove.