RVTDocs.com
Namespace: Autodesk.Revit.DB Class: TextNote

TextNote.SetFormattedText

Method
Description:
Sets the text and associated formatting of the text of in this text note with a given FormattedText object.
Syntax
public void SetFormattedText(
	FormattedText formattedText
)
Examples
#region Autodesk.Revit.DB.FormattedText
public void FormatText(TextNote textNote)
{
    // TextNote created with "New sample text"
    FormattedText formatText = textNote.GetFormattedText();

    // italicize "New"
    TextRange range = new TextRange(0, 3);
    formatText.SetItalicStatus(range, true);

    // make "sample" bold
    range = formatText.Find("sample", 0, false, true);
    if (range.Length > 0)
        formatText.SetBoldStatus(range, true);

    // make "text" underlined
    range = formatText.Find("text", 0, false, true);
    if (range.Length > 0)
        formatText.SetUnderlineStatus(range, true);

    // make all text uppercase
    formatText.SetAllCapsStatus(true);

    textNote.SetFormattedText(formatText);
}
#endregion
Parameters
Parameter Type Description
formattedText FormattedText The FormattedText object containing the text and associated formatting of the text.
Return Value
Exceptions
Exception Condition
ArgumentNullException A non-optional argument was null