Font.Color

Returns/sets the color of the font.

Syntax Parameters Return/assignment value
- - Integer

SVB Example

Removing commands and comments from an R console report:

'#Language "WWB.NET"
Option Explicit

Sub Main

    Dim rpt As Report = ActiveReportEx
    rpt.SelectAll
    Dim rptText As String = vbCrLf & rpt.SelectionText

    'Remove the R commands from the console report
    RemoveRConsoleLine(rptText, vbCrLf & ">"c)
    'Remove the comments from the console report
    RemoveRConsoleLine(rptText, vbCrLf & "#"c)

    rptText = rptText.TrimStart
    rptText = rptText.TrimEnd

    rpt.SelectionText = rptText
    'Format the report's text color to a soothing lavender
    rpt.SelectAll
    rpt.SelectionFont.Color = RGB(150,123,182)
    rpt.SetSelection(1,1)

End Sub

Sub RemoveRConsoleLine(ByRef rptText As String, ByVal lineToken As String)

    Dim tokenPosition As Integer = 0
    Dim lineEnd As Integer = 0
    'Scan the report text, stripping any lines that start with the specified token
    While tokenPosition <> -1
        'Find the token
        tokenPosition = rptText.IndexOf(lineToken, tokenPosition)
        If (tokenPosition = -1) Then
            Exit While
        End If
        'Find the end of the line after the token
        lineEnd = rptText.IndexOf(vbCrLf, tokenPosition+lineToken.Length())
        If (lineEnd = -1) Then
            Exit While
        End If
        'Remove the line
        rptText = rptText.Remove(tokenPosition, lineEnd-tokenPosition)
    End While

End Sub