Domino 9 und frühere Versionen > ND6: Entwicklung

Tabellenfarbe mittels LS

(1/2) > >>

mariab:
Hallo,

habe ein Problem beim Färben einer Tabelle. Bekomme in der Zeile mit Call rtt.SetColor(COLOR_BLUE) die Fehlermeldung Type mismatch


--- Code: ---Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rtitem As Notesrichtextitem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Msgbox("Richtextitem")
Call rtitem.appendtable( 1,1 )
'---------- Zugriff auf die Tabelle ---------------
Dim rtnav As NotesRichTextNavigator
Set rtnav = rtitem.CreateNavigator

Set rtt = rtnav.GetFirstElement(RTELEM_TYPE_TABLE )
If rtt Is Nothing Then
Messagebox "Dokument enthält keine Tabelle",, "No links"
Else
Msgbox("Tabelle gefunden")

'------- Tabelle einfärben -------------------------
Call rtt.SetColor(COLOR_BLUE)

Call doc.Save( False, True )
Call aktualisieren(doc)
              End If
End If
End Sub

--- Ende Code ---

eknori:
Du musst erst ein ColorObject erzeugen

  Dim colorObject As NotesColorObject
  Set colorObject = session.CreateColorObject
  colorObject.NotesColor = COLOR_BLUE

und dann die Farbe mit

 Call rtt.SetColor(colorObject)

die fARBE SETZEN

pReD:

--- Zitat von: mariab am 21.04.06 - 09:25:08 ---Hallo,

habe ein Problem beim Färben einer Tabelle. Bekomme in der Zeile mit Call rtt.SetColor(COLOR_BLUE) die Fehlermeldung Type mismatch


--- Code: ---Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rtitem As Notesrichtextitem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Msgbox("Richtextitem")
Call rtitem.appendtable( 1,1 )
'---------- Zugriff auf die Tabelle ---------------
Dim rtnav As NotesRichTextNavigator
Set rtnav = rtitem.CreateNavigator

Set rtt = rtnav.GetFirstElement(RTELEM_TYPE_TABLE )
If rtt Is Nothing Then
Messagebox "Dokument enthält keine Tabelle",, "No links"
Else
Msgbox("Tabelle gefunden")

'------- Tabelle einfärben -------------------------
Call rtt.SetColor(COLOR_BLUE)

Call doc.Save( False, True )
Call aktualisieren(doc)
              End If
End If
End Sub

--- Ende Code ---

--- Ende Zitat ---


mein ich das nur, oder hast du die Variable rtt nicht deklariert?

DerAndre:
Hi.

Kann es sein das rtt nicht deklariert ist?
Hast Du in den Options ein Option declare gesetzt?


Schau mal in der Hilfe nach SetColor, da fehlt jetzt noch einiges.


--- Code: ---This agent sets the color for the first or only table in an item.
Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim dc As NotesDocumentCollection
  Set dc = db.UnprocessedDocuments
  Dim doc As NotesDocument
  Set doc = dc.GetFirstDocument
  Dim rti As NotesRichTextItem
  Set rti = doc.GetFirstItem("Body")
  Dim rtnav As NotesRichTextNavigator
  Set rtnav = rti.CreateNavigator
  If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
    Messagebox "Body item does not contain a table,",, "Error"
    Exit Sub
  End If
  Dim rtt As NotesRichTextTable
  Set rtt = rtnav.GetElement
  rtt.Style = TABLESTYLE_TOP
  Dim colorObject As NotesColorObject
  Set colorObject = session.CreateColorObject
  colorObject.NotesColor = COLOR_BLUE
  Call rtt.SetColor(colorObject)
  Call doc.Save(True, True)
End Sub
--- Ende Code ---

Gruss

André

mariab:
Danke für Eure schnelle Hilfe
Habe nun die Variable rtt deklariert und die Zeile rtt.Style = TABLESTYLE_TOP hinzugefügt. Nun klappts.

Eine Fragfe habe ich noch.
Wie kann ich die RGB Werte angeben wenn ich nicht die Standartwerte wie COLOR_BLUE verwenden möchte.

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln