Help with margins/indents in rich text field

Hi everyone,

What I am trying to do is add text into a rich text field, but I want different parts of the text to have different margins. For example, I want the text to look like this:

This is the first line of text, not indented

…This is the second line of text, indented. And no matter how many lines it wraps on, they should all be indented.

This is the third line of text, not indented

Here is what I tried for that:

Sub Click(Source As Button)

Dim s As New NotesSession

Dim db As NotesDatabase

Dim prtdoc As NotesDocument

Dim rtpStyle As NotesrichTextParagraphStyle



Set db = s.CurrentDatabase

Set prtdoc = New NotesDocument(db)

Set rtpStyle = s.CreateRichTextParagraphStyle



prtdoc.Form = "JEC Print"

Dim richText As New NotesRichTextItem(prtdoc, "Info")

rtpStyle.LeftMargin = RULER_ONE_INCH

Call richText.AppendParagraphStyle(rtpStyle)

Call richText.AppendText("This is the first line of text, not indented")

Call richText.AddNewLine(1)

rtpStyle.LeftMargin = RULER_ONE_INCH * 10

Call richText.AppendParagraphStyle(rtpStyle)

Call richText.AppendText ("This is the second line of text, indented.  And no matter how many lines it wraps on, they should all be indented.")

Call richText.AddNewLine(1)

rtpStyle.LeftMargin = RULER_ONE_INCH

Call richText.AppendParagraphStyle(rtpStyle)

Call richText.AppendText("This is the third line of text, not indented")

Call richText.AddNewLine(1)

Call prtdoc.Save(True, False)

End Sub

But when I open the doc, no lines are indented… they all line up at the left side of the page.

Can anyone help with that?

Thanks!!

Subject: Help with margins/indents in rich text field

Your code looks fine at first glance. If your RichText field happens to reside inside a table, I found, that it will ignore any attempt to indent lines.

Subject: Help with margins/indents in rich text field

Try setting the FirstLineLeftMargin as well.