Skip to content

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.

rtflite.attributes.TextAttributes pydantic-model

Bases: BaseModel

Base class for text-related attributes in RTF components

Show JSON schema:
{
  "description": "Base class for text-related attributes in RTF components",
  "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"
    }
  },
  "title": "TextAttributes",
  "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_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

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 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)

Table attributes

Table-specific attributes layered on top of text styling (borders, column widths, pagination flags).

rtflite.attributes.TableAttributes pydantic-model

Bases: TextAttributes

Base class for table-related attributes in RTF components

Show JSON schema:
{
  "description": "Base class for table-related attributes in RTF components",
  "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"
    }
  },
  "title": "TableAttributes",
  "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]])

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_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

validate_border

validate_border(v)

Validate that all border styles are valid.

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 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)

Broadcast value

Utility for broadcasting scalar or vector values across table dimensions.

rtflite.attributes.BroadcastValue pydantic-model

Bases: BaseModel

Show JSON schema:
{
  "properties": {
    "value": {
      "description": "The value of the table, can be various types including DataFrame.",
      "title": "Value"
    },
    "dimension": {
      "anyOf": [
        {
          "maxItems": 2,
          "minItems": 2,
          "prefixItems": [
            {
              "type": "integer"
            },
            {
              "type": "integer"
            }
          ],
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Dimensions of the table (rows, columns)",
      "title": "Dimension"
    }
  },
  "required": [
    "value"
  ],
  "title": "BroadcastValue",
  "type": "object"
}

Config:

  • arbitrary_types_allowed: True

Fields:

  • value (Any)
  • dimension (tuple[int, int] | None)

Validators:

  • convert_valuevalue
  • validate_dimensiondimension

value pydantic-field

value: Any

The value of the table, can be various types including DataFrame.

dimension pydantic-field

dimension: tuple[int, int] | None = None

Dimensions of the table (rows, columns)

Text content

Low-level text container used inside custom rows and cells.

rtflite.row.TextContent pydantic-model

Bases: BaseModel

Represents RTF text with formatting.

Show JSON schema:
{
  "description": "Represents RTF text with formatting.",
  "properties": {
    "text": {
      "description": "The text content",
      "title": "Text",
      "type": "string"
    },
    "font": {
      "default": 1,
      "description": "Font index",
      "title": "Font",
      "type": "integer"
    },
    "size": {
      "default": 9,
      "description": "Font size",
      "title": "Size",
      "type": "integer"
    },
    "format": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Text formatting codes: b=bold, i=italic, u=underline, s=strikethrough, ^=superscript, _=subscript",
      "title": "Format"
    },
    "color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Text color",
      "title": "Color"
    },
    "background_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Background color",
      "title": "Background Color"
    },
    "justification": {
      "default": "l",
      "description": "Text justification (l, c, r, d, j)",
      "title": "Justification",
      "type": "string"
    },
    "indent_first": {
      "default": 0,
      "description": "First line indent",
      "title": "Indent First",
      "type": "integer"
    },
    "indent_left": {
      "default": 0,
      "description": "Left indent",
      "title": "Indent Left",
      "type": "integer"
    },
    "indent_right": {
      "default": 0,
      "description": "Right indent",
      "title": "Indent Right",
      "type": "integer"
    },
    "space": {
      "default": 1,
      "description": "Line spacing",
      "title": "Space",
      "type": "integer"
    },
    "space_before": {
      "default": 15,
      "description": "Space before paragraph",
      "title": "Space Before",
      "type": "integer"
    },
    "space_after": {
      "default": 15,
      "description": "Space after paragraph",
      "title": "Space After",
      "type": "integer"
    },
    "convert": {
      "default": true,
      "description": "Enable LaTeX to Unicode conversion",
      "title": "Convert",
      "type": "boolean"
    },
    "hyphenation": {
      "default": true,
      "description": "Enable hyphenation",
      "title": "Hyphenation",
      "type": "boolean"
    }
  },
  "required": [
    "text"
  ],
  "title": "TextContent",
  "type": "object"
}

Fields:

  • text (str)
  • font (int)
  • size (int)
  • format (str | None)
  • color (str | None)
  • background_color (str | None)
  • justification (str)
  • indent_first (int)
  • indent_left (int)
  • indent_right (int)
  • space (int)
  • space_before (int)
  • space_after (int)
  • convert (bool)
  • hyphenation (bool)

text pydantic-field

text: str

The text content

font pydantic-field

font: int = 1

Font index

size pydantic-field

size: int = 9

Font size

format pydantic-field

format: str | None = None

Text formatting codes: b=bold, i=italic, u=underline, s=strikethrough, ^=superscript, _=subscript

color pydantic-field

color: str | None = None

Text color

background_color pydantic-field

background_color: str | None = None

Background color

justification pydantic-field

justification: str = 'l'

Text justification (l, c, r, d, j)

indent_first pydantic-field

indent_first: int = 0

First line indent

indent_left pydantic-field

indent_left: int = 0

Left indent

indent_right pydantic-field

indent_right: int = 0

Right indent

space pydantic-field

space: int = 1

Line spacing

space_before pydantic-field

space_before: int = DEFAULT_SPACE_BEFORE

Space before paragraph

space_after pydantic-field

space_after: int = DEFAULT_SPACE_AFTER

Space after paragraph

convert pydantic-field

convert: bool = True

Enable LaTeX to Unicode conversion

hyphenation pydantic-field

hyphenation: bool = True

Enable hyphenation