developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




table via LotusScript
Terry Comeau 03/08/2012 10:21 AM
General 7.0.3 Windows XP


I'm creating a table in a rich text field. First I write the table title text into the field then I create (append) the table itself. The title text sits to the far left, no margin. The table though sits about 1.6 centimeters (11/16th inch) away from the left (has a margin).

Examples:

Title Text
Table starts here.

Should be:

Title Text
Table should start here

Can anyone tell me what is wrong with my code and how I can make the table sit all the way to the left?

Here is my code:

' Setup text styles used in the document.
' table 1
Set columnHeaderStyle1 = sesNotes.CreateRichTextStyle( )
columnHeaderStyle1.Bold = True
columnHeaderStyle1.Fontsize = 8
'columnHeaderStyle1.NotesFont = rtf.GetNotesFont("Gill Sans", True)
Set dataStyle1 = sesNotes.CreateRichTextStyle( )
dataStyle1.Bold = False
dataStyle1.Fontsize = 8
dataStyle1.NotesFont = FONT_ROMAN

For i = 0 To 12
Set columnStyles1(i) = sesNotes.CreateRichTextParagraphStyle
columnStyles1(i).LeftMargin = 0 ' position relative to cell border.
columnStyles1(i).FirstLineLeftMargin = 0
Next

columnStyles1(0).RightMargin = .6 * RULER_ONE_CENTIMETER
columnStyles1(0).Alignment = ALIGN_CENTER
columnStyles1(1).RightMargin =1.1 * RULER_ONE_CENTIMETER
columnStyles1(1).Alignment = ALIGN_CENTER
columnStyles1(2).RightMargin = 1.1 * RULER_ONE_CENTIMETER
columnStyles1(2).Alignment = ALIGN_CENTER
columnStyles1(3).RightMargin = 1.2 * RULER_ONE_CENTIMETER
columnStyles1(3).Alignment = ALIGN_CENTER
columnStyles1(4).RightMargin = 1.0 * RULER_ONE_CENTIMETER
columnStyles1(4).Alignment = ALIGN_CENTER
columnStyles1(5).RightMargin = .8 * RULER_ONE_CENTIMETER
columnStyles1(5).Alignment = ALIGN_CENTER
columnStyles1(6).RightMargin = .6 * RULER_ONE_CENTIMETER
columnStyles1(6).Alignment = ALIGN_CENTER
columnStyles1(7).RightMargin = 2.0 * RULER_ONE_CENTIMETER
columnStyles1(7).Alignment = ALIGN_CENTER
columnStyles1(8).RightMargin = 1.3 * RULER_ONE_CENTIMETER
columnStyles1(8).Alignment = ALIGN_CENTER
columnStyles1(9).RightMargin = 1.4 * RULER_ONE_CENTIMETER
columnStyles1(9).Alignment = ALIGN_CENTER
columnStyles1(10).RightMargin = 1.4 * RULER_ONE_CENTIMETER
columnStyles1(10).Alignment = ALIGN_CENTER
columnStyles1(11).RightMargin = 1.4 * RULER_ONE_CENTIMETER
columnStyles1(11).Alignment = ALIGN_CENTER
columnStyles1(12).RightMargin = 1.5 * RULER_ONE_CENTIMETER
columnStyles1(12).Alignment = ALIGN_CENTER

' set up table headers
Dim rti As New NotesRichTextItem(docSYD, "rtfBins")

richStyle.Bold = True
Call rti.AppendStyle(richStyle)
Call rti.AppendText("Table Title")
richStyle.Bold = False

Call rti.AppendTable(20, 13,,,columnStyles1)

rti.AppendStyle dataStyle1

Set rtnav = rti.CreateNavigator( )

rtnav.FindLastElement RTELEM_TYPE_TABLE
Set table = rtnav.GetElement

rtnav.FindNextElement RTELEM_TYPE_TABLECELL

rti.AppendStyle columnHeaderStyle1
richStyle.Bold = True
Call rti.AppendStyle(richStyle)

rti.BeginInsert rtnav
rti.AppendText ("Bin #")
rti.EndInsert

etc.

Go back