Skip to content

caxton.api

The extended generative API. caxton re-exports most of it; import caxton.api directly for the backend-specific escape hatches.

Factories and operations

Identical to the caxton facade — caxton.api is where they are defined.

from caxton.api import render, sheet, spreadsheet, table, text, validate, write

Formatting and format helpers

from caxton.api import (
    Style,
    StyleSheet,
    custom_format,
    date_format,
    decimal_format,
    money_format,
    percentage_format,
    time_format,
)

See caxton.core.formatting for the full documentation.

XLSX escape hatches

Backend-specific, namespaced, and never part of the core model.

Classes:

Functions:

  • openpyxl_hook

    Create an XLSX-namespaced post-render OpenPyXL hook.

  • pivot

    Bind an existing XLSX pivot to generated data.

OpenpyxlHookContext dataclass

OpenpyxlHookContext(native_workbook: Any, native_sheet: Any)

Narrow XLSX-scoped access to native OpenPyXL objects.

OpenpyxlHookExtension dataclass

OpenpyxlHookExtension(function: OpenpyxlHook, sheet: str | None = None)

Run one explicit hook after semantic content is rendered.

PivotBinding dataclass

PivotBinding(target: str, source: ColumnRef | TableReference, refresh_on_open: bool = True)

XLSX-only intent to rebind an existing pivot cache source.

openpyxl_hook

openpyxl_hook(function: OpenpyxlHook, *, sheet: str | None = None) -> OpenpyxlHookExtension

Create an XLSX-namespaced post-render OpenPyXL hook.

Returns:

pivot

pivot(target: str, *, source: ColumnRef | TableReference, refresh_on_open: bool = True) -> PivotBinding

Bind an existing XLSX pivot to generated data.

Returns: