Skip to content

Text & Formatting

Components and utilities for text styling and formatting in RTF documents.

Text Attributes

Base attributes for text formatting.

Bases: BaseModel

Base class for text-related attributes in RTF components

calculate_lines(text, available_width, row_idx=0, col_idx=0)

Calculate number of lines needed for text given available width.

Parameters:

Name Type Description Default
text str

Text content to measure

required
available_width float

Available width in inches

required
row_idx int

Row index for attribute lookup (default: 0)

0
col_idx int

Column index for attribute lookup (default: 0)

0

Returns:

Type Description
int

Number of lines needed (minimum 1)

convert_to_list(v)

Convert single values to lists before validation.

Table Attributes

Attributes specific to table formatting.

Bases: TextAttributes

Base class for table-related attributes in RTF components

validate_border(v)

Validate that all border styles are valid.

Text Content

Component for handling text content in cells.

Bases: BaseModel

Represents RTF text with formatting.

Broadcast Value

Utility for broadcasting values across rows and columns.

Bases: BaseModel