[]
        
(Showing Draft Content)

C1.Win.C1Editor.C1TextRange.GetStyleValue

GetStyleValue Method

GetStyleValue(string)

Gets an inline style value by the given CSS property name.

Declaration
public string GetStyleValue(string propertyName)
Parameters
Type Name Description
string propertyName

The CSS property name.

Returns
Type Description
string

The string value of the given property.

Examples

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;
}

GetStyleValue(string, C1StyleType)

Gets an inline style value by the given CSS property name.

Declaration
public string GetStyleValue(string propertyName, C1StyleType type)
Parameters
Type Name Description
string propertyName

The CSS property name.

C1StyleType type

Specifies the type of content to which the inline style will be applied.

Returns
Type Description
string

The string value of the given property.