Das Notes Forum
Domino 9 und frühere Versionen => ND8: Entwicklung => Thema gestartet von: v_haderer am 19.07.13 - 11:12:11
-
Hallo Zusammen!
kurze Frage :)
Ich erstelle im Bodyfeld eines neuen Mails eine Tabelle ->
Call rtitem.AppendTable(zeilen, spalten,, RULER_ONE_INCH * 1.5)
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For aktZeile = 1 To zeilen
For aktSpalte = 1 To Spalten
Call rtitem.BeginInsert(rtnav)
boldMerker = richStyle.Bold
If aktZeile = 1 Then
richStyle.Bold = True
Call rtitem.AppendStyle(richStyle)
End If
Call rtitem.AppendText("Zeile " & aktZeile% & ", Spalte " & aktSpalte)
If aktZeile = 1 Then
richStyle.Bold = boldMerker
Call rtitem.AppendStyle(richStyle)
End If
Call rtitem.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
... das funktioniert soweit ganz brav.
Nun wird die Tabelle leider immer an die Breite des Mails automaitsch angepasst was "nicht besonders hübsch" ;) aussieht.
Kann mir jemand sagen wie ich die Spaltenbreite in solch einer Tabelle via Script setzen kann? ???
vielen lieben Dank
glg
Viktor
-
Laut Designer Hilfe sollte das mit einem weiteren optionalen Parameter rtpsStyleArray gehen:
Call notesRichTextItem.AppendTable( rows%, columns% [, labels] [, leftMargin&] [, rtpsStyleArray] )
rtpsStyleArray
Array of type NotesRichTextParagraphStyle. Optional. Creates a table with fixed-width columns and style attributes as specified. Omitting this parameter creates an auto-width table. The array must contain one element for each column in the table in sequence. Explicitly set the first line left margin and left margin, which control the start of text relative to the start of the column, and the right margin, which controls column width.
Andreas
-
Danke für den Tipp, damit habe ich schon probiert zu arbeiten.
Hat seltsamerweise keinerlei Auswirkung auf die Tabelle ???
-
Hallo,
Darf man auch einmal fragen, wie Du es probiert hast?
Beispiel aus der Designer-Hilfe ist aus meiner Sicht sehr hilfreich.
Andreas
-
einfach testweise mit
rtpStyle.FirstLineLeftMargin = RULER_ONE_INCH*0.4
rtpStyle.LeftMargin = 100
rtpStyle.RightMargin = 500
meine Vermutung ist das ich mich schlichtweg unglaublich blöd anstelle ;-)
-
Du musst rtpsStyleArray als Array ;D übergeben und zwar pro Spalte ein Element. In der Designerhilfe gibts dazu folgendes Beispiel:
This view action creates a basic table of 4 rows and 3 columns, and populates it. The width of each column is fixed at 1.5 inches. The left margin of the table is 1.5 inches.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Dim doc As New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "Main topic")
Call doc.ReplaceItemValue("Subject", "Table 4 x 3")
Dim body As New NotesRichTextItem(doc, "Body")
REM Create table in Body item
rowCount% = 4
columnCount% = 3
Dim styles(1 To 3) As NotesRichTextParagraphStyle
For i% = 1 To 3 Step 1
Set styles(i%) = session.CreateRichTextParagraphStyle
styles(i%).LeftMargin = 0
styles(i%).FirstLineLeftMargin = 0
styles(i%).RightMargin = RULER_ONE_INCH * 1.5
Next
Call body.AppendTable _
(rowCount%, columnCount%,, RULER_ONE_INCH * 1.5, styles)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call body.BeginInsert(rtnav)
Call body.AppendText("Row " & iRow% & ", Column " & iColumn%)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
REM Save document and refresh view
Call doc.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
End Sub
-
P
E
R
F
E
K
T
:) :) :) :) :) :)
D A N K E !!!1