Editor for WinForms | ComponentOne
C1.Win.C1Editor.4.8 Assembly / C1.Win.C1Editor Namespace / C1TextRange Class / GetStyleValue Method / GetStyleValue(String) Method
The CSS property name.
Example

In This Topic
    GetStyleValue(String) Method
    In This Topic
    Gets an inline style value by the given CSS property name.
    Syntax
    'Declaration
     
    Public Overloads Function GetStyleValue( _
       ByVal propertyName As System.String _
    ) As System.String
    public System.string GetStyleValue( 
       System.string propertyName
    )

    Parameters

    propertyName
    The CSS property name.

    Return Value

    The string value of the given property.
    Example
    The example shows how to write a function which returns font size of the selected text.
    string GetSelectionFontSize()
    {
        if (_editor.Mode == EditorMode.Design)
        {
            string size = _editor.Selection.GetStyleValue("font-size") ?? string.Empty;
            return size.EndsWith("pt") ? size.Substring(0, size.Length - 2) : size;
        }
        else
            return string.Empty;
    }
    See Also