Metadata-Version: 2.3
Name: tablichka
Version: 0.1.1
Summary: Convert HTML text and tables to XLSX with class-based styles.
Author: DurnevVS
Author-email: DurnevVS <lewberstklol@gmail.com>
Requires-Dist: beautifulsoup4>=4.15.0
Requires-Dist: openpyxl>=3.1.5
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# Tablichka

Tablichka converts HTML into XLSX.

## Install

```bash
pip install tablichka
```

```bash
uv add tablichka
```

## Example

```python
from pathlib import Path

from openpyxl.styles import Border, Font, PatternFill, Side

from tablichka import Style, convert

line = Side(style="thin", color="808080")
border = Border(left=line, right=line, top=line, bottom=line)

styles = {
    "title": Style(font=Font(name="Times New Roman", size=18, bold=True)),
    "header": Style(
        font=Font(name="Times New Roman", size=12, bold=True),
        fill=PatternFill(fill_type="solid", fgColor="D9EAF7"),
    ),
    "bordered": Style(border=border),
}

html = """
<h1 class="title">Sales report</h1>
<p>October 2026</p>
<table>
    <tr>
        <th class="bordered header" rowspan="2">Product</th>
        <th class="bordered header" colspan="2">Sales</th>
    </tr>
    <tr>
        <th class="bordered header">Quantity</th>
        <th class="bordered header">Price</th>
    </tr>
    <tr>
        <td class="bordered">Monitor</td>
        <td class="bordered">5</td>
        <td class="bordered">15000</td>
    </tr>
    <tr>
        <td class="bordered">Keyboard</td>
        <td class="bordered">10</td>
        <td class="bordered">2000</td>
    </tr>
</table>
"""

if __name__ == "__main__":
    project = Path(__file__).resolve().parents[1]
    convert(html, project / "test_html.xlsx", styles=styles)
```

## Supported HTML tags

- `h1` headings and `p` paragraphs.
- Tables with `tr` rows and `th` or `td` cells, including `thead`, `tbody`, and `tfoot` sections.
- Cell merges with positive integer `rowspan` and `colspan` values.


