LOTUSSCRIPT/COM/OLE CLASSES
Examples: Style property
1. This agent gets the table style of the first or only table in an item.
Function GetStyleString(Byval styleCode As Long) As String
Select Case styleCode
Case TABLESTYLE_ALTERNATINGCOLS
GetStyleString = "Alternating columns"
Case TABLESTYLE_ALTERNATINGROWS
GetStyleString = "Alternating rows"
Case TABLESTYLE_LEFT
GetStyleString = "Left"
Case TABLESTYLE_LEFTTOP
GetStyleString = "Left top"
Case TABLESTYLE_NONE
GetStyleString = "None"
Case TABLESTYLE_RIGHT
GetStyleString = "Right"
Case TABLESTYLE_RIGHTTOP
GetStyleString = "Right top"
Case TABLESTYLE_SOLID
GetStyleString = "Solid"
Case TABLESTYLE_TOP
GetStyleString = "Top"
End Select
End Function
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
colorStyle$ = GetStyleString(rtt.Style)
Messagebox "Style = " & colorStyle$,, _
"NotesRichTextTable"
End Sub
2. This agent sets the table style 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_ALTERNATINGROWS
Dim colorObject As NotesColorObject
Set colorObject = session.CreateColorObject
colorObject.NotesColor = COLOR_BLUE
Call rtt.SetColor(colorObject)
colorObject.NotesColor = COLOR_YELLOW
Call rtt.SetAlternateColor(colorObject)
Call doc.Save(True, True)
End Sub
See Also
Style property
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary