I am sure this is a really easy thing to do. I just miss one thing and I am not able to figure out what. I am reading myself through the forum of R6 and R5 and the NotesHelp. But I just do not get it.
I have an agent which collects text from documents and puts them in a NotesRichTextItem. I am able to apply RichTextStyles. The first line I add to the RichTextItem is just a kind of Timestamp. Then the next AppendText is the text which I tooke from another document. This text is mostly multiline text.
What I would like to do is to inset this text a little bit so it is easier to read. But I am not able.
The code looks like this now
Dim rtpStyle As NotesRichTextParagraphStyle
Set rtpStyle = session.CreateRichTextParagraphStyle
Subject: RE: How to create a pragraph in a RichTextItem?
Hi!
I do not understand why it does not work with your code. You may have some other style defined before the rich text?
I tested with a simple form called “Test”, with has a rich text field called “Body”, and using this agent code :
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc, "Body" )
doc.Form = "Test"
Dim text As String
text = |1111111
Subject: RE: How to create a pragraph in a RichTextItem?
I figured out what the problem is. It is the CRLF. When I build a message I do it like this:
msg = “blablabla”
msg = msg + chr(13) + chr(10) + “blublublu”
this is then the text I append to the rich text item.
The result is that the paragraph styles are not applied.
If I do it like this(as you mentioned)
msg = {blablabla
blublublu}
then the parapgraph styles are applied.
Unfortunately I cannot build the message like this. The agent gets the text for the rich text item from several documents. I will need to figure out about the CRLF charachter sequence to use.
Subject: RE: How to create a pragraph in a RichTextItem?
CRLF does not necessarily create a new paragraph. AddNewLine() does. A rich text paragraph can contain a formatted string, which may include a carriage rturn/line feed. AddNewLine() creates a new rich text paragraph entity.