RichTextParagraphStyle margin ignored

HiI have created a form that is to display text collected from multiple documents. The text is to be formatted and so I have created a Rich text field in which to create this formatted text.

The document creation is accomplished by a LotusScript agent.

The problem is that the code works fine (with all RichTextParagraphStyle formatting working) as long as the target Rich Text field is NOT in a table on the form.

When the Rich Text field is placed in a table cell (table created in the form design), the RichTextParagraphStyle properties for left and right margins are ignored.

If the document is opend for edit, the margins can be set by the user and such settings stick when the form is saved.

I need the Rich Text to be enclosed in a table to get the kind of formatting required by the users.

Can anyone explain why this is happening?

I enclose some test script that produces the results I have just explained:

Dim session As New NotesSession

Dim db As NotesDatabase

Dim rt As NotesRichTextItem

Dim vw As NotesView

Dim doc As NotesDocument

Dim rtps As NotesRichTextParagraphStyle

Set rtps = session.CreateRichTextParagraphStyle

rtps.Alignment = ALIGN_LEFT

Set db = session.CurrentDatabase

Set doc = db.CreateDocument

doc.Form = “Test”

rtps.LeftMargin = RULER_ONE_CENTIMETER * 2

rtps.FirstLineLeftMargin = RULER_ONE_CENTIMETER * 2

rtps.SpacingAbove = SPACING_DOUBLE

Set rt = New NotesRichTextItem(doc,“RichText1”)

Call rt.AppendParagraphStyle(rtps)

Call rt.AppendText(“Test Text”)

Call rt.AppendParagraphStyle(rtps)

Call rt.AppendText(“Test Text”)

Set rt = New NotesRichTextItem(doc,“RichText2”)

Call rt.AppendParagraphStyle(rtps)

Call rt.AppendText(“Test Text”)

Call rt.AppendParagraphStyle(rtps)

Call rt.AppendText(“Test Text”)

Call doc.Save(True,True)