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

FormattedText(String)

Constructor
Description:
Creates a new FormattedText object with unformatted text.
Remarks:
The given text should have no more than 30,000 characters. Line feed characters ('/n') are not allowed. An empty string is allowed.
Syntax
public FormattedText(
	string plainText
)
Examples
public void ReformatText(TextNote textNote, string textToChange)
{
    String plainText = textNote.Text;
    FormattedText formattedText = new FormattedText(plainText);

    TextRange foundRange = formattedText.Find(textToChange, 0, false, true);
    while (foundRange.Length > 0)
    {
        formattedText.SetBoldStatus(foundRange, true);
        foundRange = formattedText.Find(textToChange, foundRange.End, false, true);
    }

    textNote.SetFormattedText(formattedText);
}
Parameters
Parameter Type Description
plainText String The text in a plain text form.
Return Value
Exceptions
Exception Condition
ArgumentException plainText (excluding a carriage return character ('\r') at the end) has more than 30,000 characters. -or- plainText contains invalid characters such as a newline character.
ArgumentNullException A non-optional argument was null