FormattedTextAsTextRange Method |
Returns a
TextRange object that represents the entire text.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic TextRange AsTextRange()
Public Function AsTextRange As TextRange
public:
TextRange^ AsTextRange()
member AsTextRange : unit -> TextRange
Return Value
TextRange
The
TextRange object that represents the entire text.
Remarks
This range includes a carriage return character ('\r') that is always present.
As a result the range can never be an empty range.
Examplepublic void AppendText(TextNote textNote)
{
FormattedText formatText = textNote.GetFormattedText();
TextRange range = formatText.AsTextRange();
range.Start = range.End - 1;
range.Length = 0;
string someNewText = "\rThis is a new paragraph\vThis is a new line without a paragraph break\r";
formatText.SetPlainText(range, someNewText);
range = formatText.AsTextRange();
range.Start = range.End - 1;
range.Length = 0;
string someListText = "\rBulleted List item 1\rItem 2\vSecond line for Item 2\rThird bullet point";
formatText.SetPlainText(range, someListText);
range.Start++;
range.Length = someListText.Length;
formatText.SetListType(range, ListType.Bullet);
if (formatText.GetAllCapsStatus(range) != FormatStatus.None)
{
formatText.SetAllCapsStatus(range, false);
}
textNote.SetFormattedText(formatText);
}
Public Sub AppendText(textNote As TextNote)
Dim formatText As FormattedText = textNote.GetFormattedText()
Dim range As TextRange = formatText.AsTextRange()
range.Start = range.[End] - 1
range.Length = 0
Dim someNewText As String = vbCr & "This is a new paragraph" & vbVerticalTab & "This is a new line without a paragraph break" & vbCr
formatText.SetPlainText(range, someNewText)
range = formatText.AsTextRange()
range.Start = range.[End] - 1
range.Length = 0
Dim someListText As String = vbCr & "Bulleted List item 1" & vbCr & "Item 2" & vbVerticalTab & "Second line for Item 2" & vbCr & "Third bullet point"
formatText.SetPlainText(range, someListText)
range.Start += 1
range.Length = someListText.Length
formatText.SetListType(range, ListType.Bullet)
If formatText.GetAllCapsStatus(range) <> FormatStatus.None Then
formatText.SetAllCapsStatus(range, False)
End If
textNote.SetFormattedText(formatText)
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also