API Reference
This section provides comprehensive API documentation for craftable, including functions, classes, styles, and exceptions.
Core Functions
Functions — Primary table generation functions
Complete API documentation for the main functions used to generate and export tables:
get_table()— Generate a complete formatted table as a stringexport_table()— Render and optionally write tables to filesget_table_row()— Generate a single formatted table rowget_table_header()— Generate just the header section of a table
Data Structures
Classes — Column definition classes
Documentation for classes used to configure column formatting and behavior:
ColDef— Column definition class for controlling width, alignment, formatting, and moreColDefList— Collection of column definitions with automatic sizing and adjustment methods
Error Handling
Exceptions — Custom exceptions
Documentation for exceptions that may be raised during table generation:
InvalidTableError— Raised when table structure or configuration is invalidInvalidColDefError— Raised when column definition format is invalid
Styles
Text Output Styles
Text Styles — Styles for terminal and text output
Documentation for built-in styles that generate text-based table output for terminals, logs, and plain text files:
NoBorderScreenStyle— Minimal, compact style with no borders (default)BasicScreenStyle— Classic box-drawing characters with bordersRoundedBorderScreenStyle— Modern rounded corners with Unicode charactersMarkdownStyle— GitHub-flavored Markdown table formatASCIIStyle— 7-bit ASCII compatible characters for maximum compatibilityTableStyle— Base class for creating custom text-based stylesBoxChars— Helper class for defining box-drawing character sets
Document Export Styles
Document Styles — Styles for document file formats
Documentation for styles that export tables to common document formats:
DocxStyle— Microsoft Word (.docx) document formatXlsxStyle— Microsoft Excel (.xlsx) spreadsheet format with native type supportOdtStyle— OpenDocument Text (.odt) formatOdsStyle— OpenDocument Spreadsheet (.ods) format with native type supportRtfStyle— Rich Text Format (.rtf) for universal document compatibility
These document styles support features like native numeric types, date handling, and format-specific styling options.