Page layout components
Components for defining page structure, headers, footers, and supporting text blocks.
RTFPage
Defines page dimensions, margins, orientation, and pagination settings.
rtflite.input.RTFPage
pydantic-model
RTFPage(**data)
Bases:
Configure RTF page layout and pagination settings.
The RTFPage component controls page dimensions, margins, orientation, and pagination behavior including rows per page and border styles for first/last rows across page boundaries.
Examples:
Basic portrait page with custom margins:
page = RTFPage(
orientation="portrait",
margin=[
1.0,
1.0,
1.5,
1.0,
1.5,
1.0,
], # left, right, top, bottom, header, footer
)
Landscape layout for wide tables:
page = RTFPage(
orientation="landscape",
nrow=30, # Fewer rows due to landscape
border_first="double", # Double border on first row
border_last="single" # Single border on last row
)
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Total number of rows per page including ALL components: - Column headers (if displayed) - Data rows - Footnotes (if present) - Source lines (if present) This is NOT just data rows - it's the complete row budget. |
|
|
Border style for the first row of the table. Defaults to "double" for emphasis. |
|
|
Border style for the last row of the table. Defaults to "double" for closure. |
Note
The nrow parameter represents the total row capacity of a page,
not just data rows. Plan accordingly when setting this value.
Show JSON schema:
{
"description": "Configure RTF page layout and pagination settings.\n\nThe RTFPage component controls page dimensions, margins, orientation,\nand pagination behavior including rows per page and border styles for\nfirst/last rows across page boundaries.\n\nExamples:\n Basic portrait page with custom margins:\n ```python\n page = RTFPage(\n orientation=\"portrait\",\n margin=[\n 1.0,\n 1.0,\n 1.5,\n 1.0,\n 1.5,\n 1.0,\n ], # left, right, top, bottom, header, footer\n )\n ```\n\n Landscape layout for wide tables:\n ```python\n page = RTFPage(\n orientation=\"landscape\",\n nrow=30, # Fewer rows due to landscape\n border_first=\"double\", # Double border on first row\n border_last=\"single\" # Single border on last row\n )\n ```\n\nAttributes:\n nrow: Total number of rows per page including ALL components:\n - Column headers (if displayed)\n - Data rows\n - Footnotes (if present)\n - Source lines (if present)\n This is NOT just data rows - it's the complete row budget.\n\n border_first: Border style for the first row of the table.\n Defaults to \"double\" for emphasis.\n\n border_last: Border style for the last row of the table.\n Defaults to \"double\" for closure.\n\nNote:\n The `nrow` parameter represents the total row capacity of a page,\n not just data rows. Plan accordingly when setting this value.",
"properties": {
"orientation": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "portrait",
"description": "Page orientation ('portrait' or 'landscape')",
"title": "Orientation"
},
"width": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Page width in inches",
"title": "Width"
},
"height": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Page height in inches",
"title": "Height"
},
"margin": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Page margins [left, right, top, bottom, header, footer] in inches",
"title": "Margin"
},
"nrow": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Total rows per page including headers, data, footnotes, and sources. NOT just data rows - this is the complete page row budget.",
"title": "Nrow"
},
"border_first": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "double",
"description": "First row border style",
"title": "Border First"
},
"border_last": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "double",
"description": "Last row border style",
"title": "Border Last"
},
"col_width": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Total width of table columns in inches",
"title": "Col Width"
},
"use_color": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": false,
"description": "Whether to use color in the document",
"title": "Use Color"
},
"page_title": {
"default": "all",
"description": "Where to display titles in multi-page documents ('first', 'last', 'all')",
"title": "Page Title",
"type": "string"
},
"page_footnote": {
"default": "last",
"description": "Where to display footnotes in multi-page documents ('first', 'last', 'all')",
"title": "Page Footnote",
"type": "string"
},
"page_source": {
"default": "last",
"description": "Where to display source in multi-page documents ('first', 'last', 'all')",
"title": "Page Source",
"type": "string"
}
},
"title": "RTFPage",
"type": "object"
}
Fields:
-
(orientation )str | None -
(width )float | None -
(height )float | None -
(margin )Sequence [float ] | None -
(nrow )int | None -
(border_first )str | None -
(border_last )str | None -
(col_width )float | None -
(use_color )bool | None -
(page_title )str -
(page_footnote )str -
(page_source )str
Validators:
-
→validate_orientation orientation -
→validate_margin margin -
→validate_border ,border_first border_last -
→validate_page_placement ,page_title ,page_footnote page_source -
→validate_width_height ,width ,height ,nrow col_width
orientation
pydantic-field
orientation: str | None = 'portrait'
Page orientation ('portrait' or 'landscape')
width
pydantic-field
width: float | None = None
Page width in inches
height
pydantic-field
height: float | None = None
Page height in inches
margin
pydantic-field
margin: Sequence [float ] | None = None
Page margins [left, right, top, bottom, header, footer] in inches
nrow
pydantic-field
nrow: int | None = None
Total rows per page including headers, data, footnotes, and sources. NOT just data rows - this is the complete page row budget.
border_first
pydantic-field
border_first: str | None = 'double'
First row border style
border_last
pydantic-field
border_last: str | None = 'double'
Last row border style
col_width
pydantic-field
col_width: float | None = None
Total width of table columns in inches
use_color
pydantic-field
use_color: bool | None = False
Whether to use color in the document
page_title
pydantic-field
page_title: str = 'all'
Where to display titles in multi-page documents ('first', 'last', 'all')
page_footnote
pydantic-field
page_footnote: str = 'last'
Where to display footnotes in multi-page documents ('first', 'last', 'all')
page_source
pydantic-field
page_source: str = 'last'
Where to display source in multi-page documents ('first', 'last', 'all')
RTFPageHeader
Header text that appears at the top of pages. Supports field codes for page numbering.
rtflite.input.RTFPageHeader
pydantic-model
RTFPageHeader(**data)
Bases:
RTF page header component for document headers.
The RTFPageHeader appears at the top of every page, typically used for page numbering, document titles, or study identifiers. Right-aligned by default with automatic page numbering.
Examples:
Default page numbering:
header = RTFPageHeader() # Shows "Page X of Y"
Custom header text:
header = RTFPageHeader(
text="Protocol ABC-123 | Confidential",
text_justification=["c"] # Center align
)
Header with page number:
header = RTFPageHeader(
text="Study Report - Page \\chpgn", # Current page number
text_format=["b"], # Bold
text_font_size=[10]
)
Note
- Default text is "Page \chpgn of {\field{\*\fldinst NUMPAGES }}"
- Text conversion is disabled by default to preserve RTF field codes
- Right-aligned by default
Show JSON schema:
{
"description": "RTF page header component for document headers.\n\nThe RTFPageHeader appears at the top of every page, typically used for\npage numbering, document titles, or study identifiers. Right-aligned by\ndefault with automatic page numbering.\n\nExamples:\n Default page numbering:\n ```python\n header = RTFPageHeader() # Shows \"Page X of Y\"\n ```\n\n Custom header text:\n ```python\n header = RTFPageHeader(\n text=\"Protocol ABC-123 | Confidential\",\n text_justification=[\"c\"] # Center align\n )\n ```\n\n Header with page number:\n ```python\n header = RTFPageHeader(\n text=\"Study Report - Page \\\\chpgn\", # Current page number\n text_format=[\"b\"], # Bold\n text_font_size=[10]\n )\n ```\n\nNote:\n - Default text is \"Page \\\\chpgn of {\\\\field{\\\\*\\\\fldinst NUMPAGES }}\"\n - Text conversion is disabled by default to preserve RTF field codes\n - Right-aligned by default",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"text_indent_reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "table",
"description": "Reference point for indentation ('page' or 'table')",
"title": "Text Indent Reference"
}
},
"title": "RTFPageHeader",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(text )Sequence [str ] | None -
(text_indent_reference )str | None
Validators:
-
→convert_text text
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
text
pydantic-field
text: Sequence [str ] | None = None
Text content
text_indent_reference
pydantic-field
text_indent_reference: str | None = 'table'
Reference point for indentation ('page' or 'table')
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
RTFPageFooter
Footer text that appears at the bottom of pages.
rtflite.input.RTFPageFooter
pydantic-model
RTFPageFooter(**data)
Bases:
RTF page footer component for document footers.
The RTFPageFooter appears at the bottom of every page, typically used for confidentiality notices, timestamps, or file paths. Center-aligned by default.
Examples:
Simple footer:
footer = RTFPageFooter(
text="Company Confidential"
)
Multi-line footer:
footer = RTFPageFooter(
text=[
"Proprietary and Confidential",
"Do Not Distribute"
],
text_font_size=[8, 8]
)
Footer with timestamp:
footer = RTFPageFooter(
text="Generated: 2024-01-15 14:30:00 | program.py",
text_justification=["l"], # Left align
text_font_size=[8]
)
Note
- Center-aligned by default
- Text conversion is disabled by default to preserve special characters
- Appears on every page of the document
Show JSON schema:
{
"description": "RTF page footer component for document footers.\n\nThe RTFPageFooter appears at the bottom of every page, typically used for\nconfidentiality notices, timestamps, or file paths. Center-aligned by default.\n\nExamples:\n Simple footer:\n ```python\n footer = RTFPageFooter(\n text=\"Company Confidential\"\n )\n ```\n\n Multi-line footer:\n ```python\n footer = RTFPageFooter(\n text=[\n \"Proprietary and Confidential\",\n \"Do Not Distribute\"\n ],\n text_font_size=[8, 8]\n )\n ```\n\n Footer with timestamp:\n ```python\n footer = RTFPageFooter(\n text=\"Generated: 2024-01-15 14:30:00 | program.py\",\n text_justification=[\"l\"], # Left align\n text_font_size=[8]\n )\n ```\n\nNote:\n - Center-aligned by default\n - Text conversion is disabled by default to preserve special characters\n - Appears on every page of the document",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"text_indent_reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "table",
"description": "Reference point for indentation ('page' or 'table')",
"title": "Text Indent Reference"
}
},
"title": "RTFPageFooter",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(text )Sequence [str ] | None -
(text_indent_reference )str | None
Validators:
-
→convert_text text
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
text
pydantic-field
text: Sequence [str ] | None = None
Text content
text_indent_reference
pydantic-field
text_indent_reference: str | None = 'table'
Reference point for indentation ('page' or 'table')
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
RTFTitle
Document and table titles displayed above the main content.
rtflite.input.RTFTitle
pydantic-model
RTFTitle(**data)
Bases:
RTF title component with center-aligned text and LaTeX conversion enabled.
The RTFTitle component displays centered title text at the top of the document or table. It supports multiple title lines and LaTeX-style text conversion for mathematical symbols and formatting.
Examples:
Single line title:
title = RTFTitle(text="Adverse Events Summary")
Multi-line title with formatting:
title = RTFTitle(
text=["Clinical Study Report", "Safety Analysis Set"],
text_format=["b", ""] # First line bold, second normal
)
Title with LaTeX symbols:
title = RTFTitle(
text="Efficacy Analysis (\\alpha = 0.05)"
)
# Renders as: Efficacy Analysis (alpha = 0.05) with Greek alpha symbol
Note
Text conversion is enabled by default for titles, converting: - LaTeX symbols (e.g., \alpha to Greek alpha, \beta to Greek beta) - Subscripts (e.g., x_1 to x with subscript 1) - Other mathematical notation
Show JSON schema:
{
"description": "RTF title component with center-aligned text and LaTeX conversion enabled.\n\nThe RTFTitle component displays centered title text at the top of the document\nor table. It supports multiple title lines and LaTeX-style text conversion\nfor mathematical symbols and formatting.\n\nExamples:\n Single line title:\n ```python\n title = RTFTitle(text=\"Adverse Events Summary\")\n ```\n\n Multi-line title with formatting:\n ```python\n title = RTFTitle(\n text=[\"Clinical Study Report\", \"Safety Analysis Set\"],\n text_format=[\"b\", \"\"] # First line bold, second normal\n )\n ```\n\n Title with LaTeX symbols:\n ```python\n title = RTFTitle(\n text=\"Efficacy Analysis (\\\\alpha = 0.05)\"\n )\n # Renders as: Efficacy Analysis (alpha = 0.05) with Greek alpha symbol\n ```\n\nNote:\n Text conversion is enabled by default for titles, converting:\n - LaTeX symbols (e.g., \\\\alpha to Greek alpha, \\\\beta to Greek beta)\n - Subscripts (e.g., x_1 to x with subscript 1)\n - Other mathematical notation",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"text_indent_reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "table",
"description": "Reference point for indentation ('page' or 'table')",
"title": "Text Indent Reference"
}
},
"title": "RTFTitle",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(text )Sequence [str ] | None -
(text_indent_reference )str | None
Validators:
-
→convert_text text
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
text
pydantic-field
text: Sequence [str ] | None = None
Text content
text_indent_reference
pydantic-field
text_indent_reference: str | None = 'table'
Reference point for indentation ('page' or 'table')
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
RTFSubline
Subject lines that sit beneath the title and above the table body.
rtflite.input.RTFSubline
pydantic-model
RTFSubline(**data)
Bases:
RTF subline component with left-aligned text.
Show JSON schema:
{
"description": "RTF subline component with left-aligned text.",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"text_indent_reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "table",
"description": "Reference point for indentation ('page' or 'table')",
"title": "Text Indent Reference"
}
},
"title": "RTFSubline",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(text )Sequence [str ] | None -
(text_indent_reference )str | None
Validators:
-
→convert_text text
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
text
pydantic-field
text: Sequence [str ] | None = None
Text content
text_indent_reference
pydantic-field
text_indent_reference: str | None = 'table'
Reference point for indentation ('page' or 'table')
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
RTFFootnote
Footnote text displayed after the table content.
rtflite.input.RTFFootnote
pydantic-model
RTFFootnote(**data)
Bases:
RTF footnote component for explanatory notes and citations.
The RTFFootnote component displays footnote text at the bottom of tables. Supports multiple footnote lines and can be rendered as a table (with borders) or plain text. Text conversion is enabled by default.
Examples:
Single footnote:
footnote = RTFFootnote(
text="CI = Confidence Interval; N = Number of subjects"
)
Multiple footnotes:
footnote = RTFFootnote(
text=[
"* p-value from ANCOVA model",
"** Missing values were imputed using LOCF",
"*** Baseline is defined as last value before first dose"
]
)
Footnote without table borders:
footnote = RTFFootnote(
text="Data cutoff date: 2023-12-31",
as_table=False # No borders around footnote
)
Note
- Multiple footnote lines are joined with \line separator
- Text conversion is enabled by default (LaTeX symbols supported)
- Default rendering includes table borders (as_table=True)
Show JSON schema:
{
"description": "RTF footnote component for explanatory notes and citations.\n\nThe RTFFootnote component displays footnote text at the bottom of tables.\nSupports multiple footnote lines and can be rendered as a table (with borders)\nor plain text. Text conversion is enabled by default.\n\nExamples:\n Single footnote:\n ```python\n footnote = RTFFootnote(\n text=\"CI = Confidence Interval; N = Number of subjects\"\n )\n ```\n\n Multiple footnotes:\n ```python\n footnote = RTFFootnote(\n text=[\n \"* p-value from ANCOVA model\",\n \"** Missing values were imputed using LOCF\",\n \"*** Baseline is defined as last value before first dose\"\n ]\n )\n ```\n\n Footnote without table borders:\n ```python\n footnote = RTFFootnote(\n text=\"Data cutoff date: 2023-12-31\",\n as_table=False # No borders around footnote\n )\n ```\n\nNote:\n - Multiple footnote lines are joined with \\\\line separator\n - Text conversion is enabled by default (LaTeX symbols supported)\n - Default rendering includes table borders (as_table=True)",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"col_rel_width": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Relative widths of table columns",
"title": "Col Rel Width"
},
"border_left": {
"default": [
[
""
]
],
"description": "Left border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Left",
"type": "array"
},
"border_right": {
"default": [
[
""
]
],
"description": "Right border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Right",
"type": "array"
},
"border_top": {
"default": [
[
""
]
],
"description": "Top border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Top",
"type": "array"
},
"border_bottom": {
"default": [
[
""
]
],
"description": "Bottom border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Bottom",
"type": "array"
},
"border_first": {
"default": [
[
""
]
],
"description": "First row border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border First",
"type": "array"
},
"border_last": {
"default": [
[
""
]
],
"description": "Last row border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Last",
"type": "array"
},
"border_color_left": {
"default": [
[
""
]
],
"description": "Left border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Left",
"type": "array"
},
"border_color_right": {
"default": [
[
""
]
],
"description": "Right border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Right",
"type": "array"
},
"border_color_top": {
"default": [
[
""
]
],
"description": "Top border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Top",
"type": "array"
},
"border_color_bottom": {
"default": [
[
""
]
],
"description": "Bottom border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Bottom",
"type": "array"
},
"border_color_first": {
"default": [
[
""
]
],
"description": "First row border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color First",
"type": "array"
},
"border_color_last": {
"default": [
[
""
]
],
"description": "Last row border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Last",
"type": "array"
},
"border_width": {
"default": [
[
15
]
],
"description": "Border width in twips",
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"title": "Border Width",
"type": "array"
},
"cell_height": {
"default": [
[
0.15
]
],
"description": "Cell height in inches",
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"title": "Cell Height",
"type": "array"
},
"cell_justification": {
"default": [
[
"l"
]
],
"description": "Cell horizontal alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Cell Justification",
"type": "array"
},
"cell_vertical_justification": {
"default": [
[
"center"
]
],
"description": "Cell vertical alignment ('top', 'center', 'bottom')",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Cell Vertical Justification",
"type": "array"
},
"cell_nrow": {
"default": [
[
1
]
],
"description": "Number of rows per cell",
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"title": "Cell Nrow",
"type": "array"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"as_table": {
"description": "Whether to render as table (True) or plain text (False)",
"title": "As Table",
"type": "boolean"
}
},
"required": [
"as_table"
],
"title": "RTFFootnote",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(col_rel_width )list [float ] | None -
(border_left )list [list [str ]] -
(border_right )list [list [str ]] -
(border_top )list [list [str ]] -
(border_bottom )list [list [str ]] -
(border_first )list [list [str ]] -
(border_last )list [list [str ]] -
(border_color_left )list [list [str ]] -
(border_color_right )list [list [str ]] -
(border_color_top )list [list [str ]] -
(border_color_bottom )list [list [str ]] -
(border_color_first )list [list [str ]] -
(border_color_last )list [list [str ]] -
(border_width )list [list [int ]] -
(cell_height )list [list [float ]] -
(cell_justification )list [list [str ]] -
(cell_vertical_justification )list [list [str ]] -
(cell_nrow )list [list [int ]] -
(text )Sequence [str ] | None -
(as_table )bool
Validators:
-
→convert_text text -
→validate_as_table as_table
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
col_rel_width
pydantic-field
col_rel_width: list [float ] | None = None
Relative widths of table columns
border_left
pydantic-field
border_left: list [list [str ]] = [['']]
Left border style
border_right
pydantic-field
border_right: list [list [str ]] = [['']]
Right border style
border_top
pydantic-field
border_top: list [list [str ]] = [['']]
Top border style
border_bottom
pydantic-field
border_bottom: list [list [str ]] = [['']]
Bottom border style
border_first
pydantic-field
border_first: list [list [str ]] = [['']]
First row border style
border_last
pydantic-field
border_last: list [list [str ]] = [['']]
Last row border style
border_color_left
pydantic-field
border_color_left: list [list [str ]] = [['']]
Left border color
border_color_right
pydantic-field
border_color_right: list [list [str ]] = [['']]
Right border color
border_color_top
pydantic-field
border_color_top: list [list [str ]] = [['']]
Top border color
border_color_bottom
pydantic-field
border_color_bottom: list [list [str ]] = [['']]
Bottom border color
border_color_first
pydantic-field
border_color_first: list [list [str ]] = [['']]
First row border color
border_color_last
pydantic-field
border_color_last: list [list [str ]] = [['']]
Last row border color
border_width
pydantic-field
border_width: list [list [int ]] = [[15]]
Border width in twips
cell_height
pydantic-field
cell_height: list [list [float ]] = [[0.15]]
Cell height in inches
cell_justification
pydantic-field
cell_justification: list [list [str ]] = [['l']]
Cell horizontal alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
cell_vertical_justification
pydantic-field
cell_vertical_justification: list [list [str ]] = [['center']]
Cell vertical alignment ('top', 'center', 'bottom')
cell_nrow
pydantic-field
cell_nrow: list [list [int ]] = [[1]]
Number of rows per cell
text
pydantic-field
text: Sequence [str ] | None = None
Text content
as_table
pydantic-field
as_table: bool
Whether to render as table (True) or plain text (False)
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
validate_border
validate_border(v)
Validate that all border styles are valid.
RTFSource
Source information displayed at the bottom of the document.
rtflite.input.RTFSource
pydantic-model
RTFSource(**data)
Bases:
RTF source component for data source citations.
The RTFSource component displays source information at the very bottom of the document. Typically used for dataset names, program references, or generation timestamps. Rendered as plain text without borders by default.
Examples:
Simple source citation:
source = RTFSource(
text="Source: ADAE dataset, generated 2024-01-15"
)
Multiple source lines:
source = RTFSource(
text=[
"Dataset: ADAE version 3.0",
"Program: ae_summary.py",
"Generated: 2024-01-15 14:30:00"
]
)
Source with table borders:
source = RTFSource(
text="Database lock: 2023-12-31",
as_table=True, # Add borders around source
text_justification=[["l"]] # Left align instead of center
)
Note
- Center-aligned by default
- Rendered without borders by default (as_table=False)
- Text conversion is enabled by default
Show JSON schema:
{
"description": "RTF source component for data source citations.\n\nThe RTFSource component displays source information at the very bottom\nof the document. Typically used for dataset names, program references,\nor generation timestamps. Rendered as plain text without borders by default.\n\nExamples:\n Simple source citation:\n ```python\n source = RTFSource(\n text=\"Source: ADAE dataset, generated 2024-01-15\"\n )\n ```\n\n Multiple source lines:\n ```python\n source = RTFSource(\n text=[\n \"Dataset: ADAE version 3.0\",\n \"Program: ae_summary.py\",\n \"Generated: 2024-01-15 14:30:00\"\n ]\n )\n ```\n\n Source with table borders:\n ```python\n source = RTFSource(\n text=\"Database lock: 2023-12-31\",\n as_table=True, # Add borders around source\n text_justification=[[\"l\"]] # Left align instead of center\n )\n ```\n\nNote:\n - Center-aligned by default\n - Rendered without borders by default (as_table=False)\n - Text conversion is enabled by default",
"properties": {
"text_font": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font number for text",
"title": "Text Font"
},
"text_format": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text formatting (e.g. 'b' for 'bold', 'i' for'italic')",
"title": "Text Format"
},
"text_font_size": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Font size in points",
"title": "Text Font Size"
},
"text_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text color name or RGB value",
"title": "Text Color"
},
"text_background_color": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Background color name or RGB value",
"title": "Text Background Color"
},
"text_justification": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"title": "Text Justification"
},
"text_indent_first": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "First line indent in twips",
"title": "Text Indent First"
},
"text_indent_left": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Left indent in twips",
"title": "Text Indent Left"
},
"text_indent_right": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Right indent in twips",
"title": "Text Indent Right"
},
"text_space": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Line spacing multiplier",
"title": "Text Space"
},
"text_space_before": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space before paragraph in twips",
"title": "Text Space Before"
},
"text_space_after": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Space after paragraph in twips",
"title": "Text Space After"
},
"text_hyphenation": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Enable automatic hyphenation",
"title": "Text Hyphenation"
},
"text_convert": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"items": {
"type": "boolean"
},
"type": "array"
},
"type": "array"
},
{
"type": "null"
}
],
"default": [
true
],
"description": "Convert LaTeX commands to Unicode characters",
"title": "Text Convert"
},
"col_rel_width": {
"anyOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Relative widths of table columns",
"title": "Col Rel Width"
},
"border_left": {
"default": [
[
""
]
],
"description": "Left border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Left",
"type": "array"
},
"border_right": {
"default": [
[
""
]
],
"description": "Right border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Right",
"type": "array"
},
"border_top": {
"default": [
[
""
]
],
"description": "Top border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Top",
"type": "array"
},
"border_bottom": {
"default": [
[
""
]
],
"description": "Bottom border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Bottom",
"type": "array"
},
"border_first": {
"default": [
[
""
]
],
"description": "First row border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border First",
"type": "array"
},
"border_last": {
"default": [
[
""
]
],
"description": "Last row border style",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Last",
"type": "array"
},
"border_color_left": {
"default": [
[
""
]
],
"description": "Left border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Left",
"type": "array"
},
"border_color_right": {
"default": [
[
""
]
],
"description": "Right border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Right",
"type": "array"
},
"border_color_top": {
"default": [
[
""
]
],
"description": "Top border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Top",
"type": "array"
},
"border_color_bottom": {
"default": [
[
""
]
],
"description": "Bottom border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Bottom",
"type": "array"
},
"border_color_first": {
"default": [
[
""
]
],
"description": "First row border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color First",
"type": "array"
},
"border_color_last": {
"default": [
[
""
]
],
"description": "Last row border color",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Border Color Last",
"type": "array"
},
"border_width": {
"default": [
[
15
]
],
"description": "Border width in twips",
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"title": "Border Width",
"type": "array"
},
"cell_height": {
"default": [
[
0.15
]
],
"description": "Cell height in inches",
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"title": "Cell Height",
"type": "array"
},
"cell_justification": {
"default": [
[
"l"
]
],
"description": "Cell horizontal alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Cell Justification",
"type": "array"
},
"cell_vertical_justification": {
"default": [
[
"center"
]
],
"description": "Cell vertical alignment ('top', 'center', 'bottom')",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"title": "Cell Vertical Justification",
"type": "array"
},
"cell_nrow": {
"default": [
[
1
]
],
"description": "Number of rows per cell",
"items": {
"items": {
"type": "integer"
},
"type": "array"
},
"title": "Cell Nrow",
"type": "array"
},
"text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text content",
"title": "Text"
},
"as_table": {
"description": "Whether to render as table (True) or plain text (False)",
"title": "As Table",
"type": "boolean"
}
},
"required": [
"as_table"
],
"title": "RTFSource",
"type": "object"
}
Fields:
-
(text_font )list [int ] |list [list [int ]] | None -
(text_format )list [str ] |list [list [str ]] | None -
(text_font_size )list [float ] |list [list [float ]] | None -
(text_color )list [str ] |list [list [str ]] | None -
(text_background_color )list [str ] |list [list [str ]] | None -
(text_justification )list [str ] |list [list [str ]] | None -
(text_indent_first )list [int ] |list [list [int ]] | None -
(text_indent_left )list [int ] |list [list [int ]] | None -
(text_indent_right )list [int ] |list [list [int ]] | None -
(text_space )list [int ] |list [list [int ]] | None -
(text_space_before )list [int ] |list [list [int ]] | None -
(text_space_after )list [int ] |list [list [int ]] | None -
(text_hyphenation )list [bool ] |list [list [bool ]] | None -
(text_convert )list [bool ] |list [list [bool ]] | None -
(col_rel_width )list [float ] | None -
(border_left )list [list [str ]] -
(border_right )list [list [str ]] -
(border_top )list [list [str ]] -
(border_bottom )list [list [str ]] -
(border_first )list [list [str ]] -
(border_last )list [list [str ]] -
(border_color_left )list [list [str ]] -
(border_color_right )list [list [str ]] -
(border_color_top )list [list [str ]] -
(border_color_bottom )list [list [str ]] -
(border_color_first )list [list [str ]] -
(border_color_last )list [list [str ]] -
(border_width )list [list [int ]] -
(cell_height )list [list [float ]] -
(cell_justification )list [list [str ]] -
(cell_vertical_justification )list [list [str ]] -
(cell_nrow )list [list [int ]] -
(text )Sequence [str ] | None -
(as_table )bool
Validators:
-
→convert_text text -
→validate_as_table as_table
text_font
pydantic-field
text_font: list [int ] | list [list [int ]] | None = None
Font number for text
text_format
pydantic-field
text_format: list [str ] | list [list [str ]] | None = None
Text formatting (e.g. 'b' for 'bold', 'i' for'italic')
text_font_size
pydantic-field
text_font_size: list [float ] | list [list [float ]] | None = None
Font size in points
text_color
pydantic-field
text_color: list [str ] | list [list [str ]] | None = None
Text color name or RGB value
text_background_color
pydantic-field
text_background_color: list [str ] | list [list [str ]] | None = None
Background color name or RGB value
text_justification
pydantic-field
text_justification: list [str ] | list [list [str ]] | None = None
Text alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
text_indent_first
pydantic-field
text_indent_first: list [int ] | list [list [int ]] | None = None
First line indent in twips
text_indent_left
pydantic-field
text_indent_left: list [int ] | list [list [int ]] | None = None
Left indent in twips
text_indent_right
pydantic-field
text_indent_right: list [int ] | list [list [int ]] | None = None
Right indent in twips
text_space
pydantic-field
text_space: list [int ] | list [list [int ]] | None = None
Line spacing multiplier
text_space_before
pydantic-field
text_space_before: list [int ] | list [list [int ]] | None = None
Space before paragraph in twips
text_space_after
pydantic-field
text_space_after: list [int ] | list [list [int ]] | None = None
Space after paragraph in twips
text_hyphenation
pydantic-field
text_hyphenation: list [bool ] | list [list [bool ]] | None = None
Enable automatic hyphenation
text_convert
pydantic-field
text_convert: list [bool ] | list [list [bool ]] | None = [True]
Convert LaTeX commands to Unicode characters
col_rel_width
pydantic-field
col_rel_width: list [float ] | None = None
Relative widths of table columns
border_left
pydantic-field
border_left: list [list [str ]] = [['']]
Left border style
border_right
pydantic-field
border_right: list [list [str ]] = [['']]
Right border style
border_top
pydantic-field
border_top: list [list [str ]] = [['']]
Top border style
border_bottom
pydantic-field
border_bottom: list [list [str ]] = [['']]
Bottom border style
border_first
pydantic-field
border_first: list [list [str ]] = [['']]
First row border style
border_last
pydantic-field
border_last: list [list [str ]] = [['']]
Last row border style
border_color_left
pydantic-field
border_color_left: list [list [str ]] = [['']]
Left border color
border_color_right
pydantic-field
border_color_right: list [list [str ]] = [['']]
Right border color
border_color_top
pydantic-field
border_color_top: list [list [str ]] = [['']]
Top border color
border_color_bottom
pydantic-field
border_color_bottom: list [list [str ]] = [['']]
Bottom border color
border_color_first
pydantic-field
border_color_first: list [list [str ]] = [['']]
First row border color
border_color_last
pydantic-field
border_color_last: list [list [str ]] = [['']]
Last row border color
border_width
pydantic-field
border_width: list [list [int ]] = [[15]]
Border width in twips
cell_height
pydantic-field
cell_height: list [list [float ]] = [[0.15]]
Cell height in inches
cell_justification
pydantic-field
cell_justification: list [list [str ]] = [['l']]
Cell horizontal alignment ('l'=left, 'c'=center, 'r'=right, 'j'=justify)
cell_vertical_justification
pydantic-field
cell_vertical_justification: list [list [str ]] = [['center']]
Cell vertical alignment ('top', 'center', 'bottom')
cell_nrow
pydantic-field
cell_nrow: list [list [int ]] = [[1]]
Number of rows per cell
text
pydantic-field
text: Sequence [str ] | None = None
Text content
as_table
pydantic-field
as_table: bool
Whether to render as table (True) or plain text (False)
convert_to_list
convert_to_list(v)
Convert single values to lists before validation.
calculate_lines
calculate_lines(text: str , available_width: float , row_idx: int = 0, col_idx: int = 0) -> int
Calculate number of lines needed for text given available width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
|
Text content to measure |
required |
available_width
|
|
Available width in inches |
required |
row_idx
|
|
Row index for attribute lookup (default: 0) |
0
|
col_idx
|
|
Column index for attribute lookup (default: 0) |
0
|
Returns:
| Type | Description |
|---|---|
|
Number of lines needed (minimum 1) |
validate_border
validate_border(v)
Validate that all border styles are valid.