RichText

Overview

RichText is a class in Aspose.Note FOSS for Python. Inherits from: Node.

RichText.Append appends the given text with optional style to the end of the rich text.

This class provides 12 methods for working with RichText objects in Python programs. Available methods include: Append, AppendFront, Clear, GetEnumerator, IndexOf, Insert, Remove, Replace, Trim, TrimEnd, TrimStart, __init__. All exported members are accessible to any Python application after installing the Aspose.Note FOSS for Python package. Properties: Alignment, IsTitleDate, IsTitleText, IsTitleTime, LastModifiedTime, Length, and 7 more.

Properties

NameTypeAccessDescription
TextstrReadGets the text.
TextRunslist[TextRun]ReadGets the text runs.
ParagraphStyleParagraphStyleReadGets the paragraph style.
Tagslist[NoteTag]ReadGets the tags.
LengthintReadGets the length.
AlignmentHorizontalAlignment | NoneReadGets the alignment.
IsTitleTextboolReadGets the is title text.
IsTitleDateboolReadGets the is title date.
IsTitleTimeboolReadGets the is title time.
LastModifiedTime``ReadGets the last modified time.
SpaceBefore``ReadGets the space before.
SpaceAfter``ReadGets the space after.
LineSpacing``ReadGets the line spacing.

Methods

SignatureDescription
__init__(Text: str, TextRuns: list[TextRun] | None, ParagraphStyle: ParagraphStyle | None, Alignment: HorizontalAlignment | None, Tags: list[NoteTag] | None, LastModifiedTime: datetime | None, SpaceBefore: float | None, SpaceAfter: float | None, LineSpacing: float | None)
Append(text: str, style: TextStyle | None)RichTextAdds the given text with an optional style to the end and returns the RichText
AppendFront(text: str, style: TextStyle | None)RichTextInserts the given text with an optional style at the beginning and returns the RichText
Clear()RichTextRemoves all content from the rich text and returns the instance
GetEnumerator()Iterator[str]Returns an iterator over the string segments of the RichText
IndexOf(value: str, startIndex: int, count: int | None, comparison: str | None)intReturns the index of value within the text, searching from startIndex for count characters with optional comparison
Insert(index: int, text: str, style: TextStyle | None)RichTextPlaces the given text with an optional style at the specified index and returns the RichText
Remove(start: int, count: int | None)RichTextDeletes a segment starting at the given index for an optional count and returns the RichText
Replace(old_value: str, new_value: str, style: TextStyle | None)RichTextReplaces occurrences of old_value with new_value and applies optional style to the new text
Trim()RichTextRemoves leading and trailing whitespace from the rich text
TrimStart()RichTextRemoves leading whitespace from the rich text
TrimEnd()RichTextRemoves trailing whitespace from the rich text

See Also