One template.
Multiple outputs.
TenTags is a declarative language designed for Python developers and AI systems to generate beautiful HTML, XLSX, PDF and DOCX documents from a single template.
๐ฅ Watch TenTags in 3 Minutes
Learn how to describe complex table layouts with a single declarative string and generate HTML, XLSX, PDF, and DOCX from the same source.
Why developers choose TenTags
Scroll horizontally โ
HTML Generation
Generate responsive HTML pages from declarative templates.
XLSX Spreadsheets
Produce native XLSX spreadsheets with formatting and formulas.
PDF Documents
Export invoices, reports and printable documents.
DOCX Documents
Export native DOCX documents with custom table grid formatting, cell shading, and merged cells.
๐ View Python Code Example (SQLite & TenTags Integration) โผ
import sqlite3
import tentags
# Initialize demo database
conn = sqlite3.connect("sales.db")
conn.execute("DROP TABLE IF EXISTS sales")
conn.execute(
"CREATE TABLE sales (product TEXT, q1_sales INT, q2_sales INT, status TEXT)"
)
conn.executemany(
"INSERT INTO sales VALUES (?, ?, ?, ?)",
[
("Laptops", 12000, 15000, "Excellent"),
("Smartphones", 22000, 24000, "Excellent"),
("Headphones", 3000, 3500, "Good"),
],
)
conn.commit()
rows = conn.execute(
"""
SELECT product, q1_sales, q2_sales, status
FROM sales
"""
).fetchall()
# ==================== TENTAGS 2.5.1 IMPLEMENTATION ====================
data_rows = [
[
"Electronics Sales Report ",
"",
"",
"",
],
[
"Product",
"Q1 Sales ",
"Q2 Sales ",
"Status ",
],
]
style_rows = [
[" "] * 4,
[" "] * 4,
]
for product, q1, q2, status in rows:
data_rows.append(
[
product,
f"{q1} ",
f"{q2} ",
f"{status} ",
]
)
if status == "Excellent":
status_style = " "
else:
status_style = " "
style_rows.append(
[
" ",
" ",
" ",
status_style,
]
)
preamble = tentags.serialize.preamble(
len(data_rows),
4,
border_color="#e2e8f0",
border_style="solid-1",
cell_height=30,
)
style = tentags.serialize.style(
style_rows,
expected_rows=len(data_rows),
expected_cols=4,
)
data = tentags.serialize.data(
data_rows,
expected_rows=len(data_rows),
expected_cols=4,
)
html = tentags.render(preamble, style, data)
print(html)
conn.close()
From code to document
One template can generate different document formats.
import tentags
table = data(
...
)
html = render_html(table)
render_pdf(table, "output.pdf")
render_xlsx(table, "output.xlsx")
<bg=#4F8CFF>
<color=white>
<b>Employee</b>
Generated HTML
Generated XLSX
Generated PDF
What developers say
Real feedback from creators using TenTags.
Loading reviews...
Install in seconds
Start generating documents with a single command.
pip install tentags
TenTags Studio Editor
A desktop visual editor designed to construct, modify, and preview your TenTags layouts in real-time. Instantly export to HTML, XLSX, PDF, and DOCX formats.
๐จ Visual Grid Designer
Design tables visually using an interactive grid. Apply custom cell sizes, font properties (bold, italic, size, colors), hyperlinks, alignments, target marks, and vertical or horizontal cell merges with ease.
๐ Live Bi-Directional Sync
Built on Python's Abstract Syntax Trees (AST). Type code in the editor or design visually in the grid; the compiler synchronizes both directions in real-time without losing comments or context.
๐ฅ CSV Template Support
Load style layouts and raw text content directly from CSV files. The editor handles padding for mismatched dimensions and auto-aligns sequential imports automatically to save you time.