---
name: "python-docx-table-styler"
description: "Design polished, borderless, and shaded data tables in Microsoft Word using Python."
metadata:
  author: "python-openxml"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "style docx table python"
  - "set cell background color python-docx"
  - "set table column widths docx"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# python-docx Custom Table Styler

Applies custom XML formatting to python-docx tables: cell shading (w:shd), custom cell borders (w:tcBorders), vertical alignment, and cell margins.

## When to Invoke
Invoke this skill whenever you need to:
- style docx table python
- set cell background color python-docx
- set table column widths docx

## Execution SOP & Rules
1. Set column widths explicitly on every cell within the column to avoid Word width auto-reset.
2. Apply background color shading using parse_xml(r'<w:shd {} w:fill="F2F2F2"/>').
3. Configure cell vertical alignment with cell.vertical_alignment = WD_ALIGN_VERTICAL.CENTER.
4. Enable table.rows[0].cantSplit = True to prevent rows from breaking awkwardly across pages.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
