Text & formatting¶
Base attribute models and utilities for styling text and table cells.
Text attributes¶
Shared text styling options consumed by headers, footers, titles, and table cells.
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¶
Table-specific attributes layered on top of text styling (borders, column widths, pagination flags).
Bases: TextAttributes
Base class for table-related attributes in RTF components
validate_border(v)
¶
Validate that all border styles are valid.
Broadcast value¶
Utility for broadcasting scalar or vector values across table dimensions.
Text content¶
Low-level text container used inside custom rows and cells.