Subject: RE: LotusScript AddNewLine
Your problem in your original post:
During the Querysave event, the rich text in the front end is not yet available in the back end (unlike non-rich text fields). Updating the rich text in a back-end NotesDocument, and getting it to display in a document you are editing at the time, is a little tricky – one method is described here: Update rich text tip. You will not be able to do this during the Querysave event, however – it’s more for action buttons and the like.
You are better off using the NotesUIDocument methods – but you can’t mix them with back-end methods, because back-end changes are not immediately reflected in the UI.
You can insert a line break into some rich text using, for instance:
Source.FieldAppendText “fieldname”, {
}
This is not the same as a paragraph break, but I suspect it will be good enough for your purposes.
As for your followup post, it appears you are having some difficulty with the terminology. The code you posted does not create a form. It creates a document. A form is something you create using Domino Designer. To open a document on screen, as you are attempting to do on the line that gets the error, you must have a form to control the appearance of the document and what fields are on it. Document=data, form=presentation and logic, ok?
Overwriting the clipboard on document save is likely to make users unhappy, as they are likely to assume they can cut something from a document, save and exit, and paste it into another document. The way you’re doing it involves data loss in such a case. I suggest you either make do with the line break instead of paragraph break.
An alternative, since you are saving the document anyway, is to use the Querysave event to modify the rich text exclusively in the back end (you will have to use Source.Refresh(True) first), then in the postsave event, if they are not also closing the document, close and reopen the document using EditDocument. It may require some work to determine whether they are closing the document.