Examples: HeaderFontStyle property (NotesViewColumn - LotusScript®)

  1. This agent displays whether bold is set and whether italic is set.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Set db = session.CurrentDatabase
      Set view = db.GetView("Categorized")
      Set vc = view.Columns(0)
      If (vc.HeaderFontStyle And VC_FONT_BOLD) = _
      VC_FONT_BOLD Then
        msg1$ = "Bold is set"
      Else
        msg1$ = "Bold is not set"
      End If
      If (vc.HeaderFontStyle And VC_FONT_ITALIC) = _
      VC_FONT_ITALIC Then
        msg2$ = "Italic is set"
      Else
        msg2$ = "Italic is not set"
      End If
      Messagebox msg1$ & Chr(13) & msg2$,, "Font styles"
    End Sub
  2. This agent toggles the font style between bold and italic.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Set db = session.CurrentDatabase
      Set view = db.GetView("Categorized")
      Set vc = view.Columns(0)
      If vc.HeaderFontStyle = VC_FONT_BOLD Then
        vc.HeaderFontStyle = VC_FONT_ITALIC
      Else
        vc.HeaderFontStyle = VC_FONT_BOLD
      End If
      Messagebox vc.FontStyle,, "New font style"
    End Sub
  3. To set a style without disturbing the others, use a logical construct of the following form:
    vc.HeaderFontStyle = _
    vc.HeaderFontStyle Or VC_FONT_BOLD

    To set two styles without disturbing the others, use a logical construct of the following form:

    vc.HeaderFontStyle = _
    vc.HeaderFontStyle Or VC_FONT_BOLD Or VC_FONT_ITALIC

    To unset a style without disturbing the others, use a logical construct of the following form:

    vc.HeaderFontStyle = _
    vc.HeaderFontStyle And (Not VC_FONT_BOLD)

    To unset two styles without disturbing the others, use a logical construct of the following form:

    vc.HeaderFontStyle = _
    vc.HeaderFontStyle And (Not (VC_FONT_BOLD Or VC_FONT_ITALIC))