| name | docx-table-styler |
| description | Convert Obsidian/Markdown to styled DOCX for Korean government proposals and research reports. Styles all tables with navy header, horizontal row alternation, content-proportional column widths, 10pt font, tight cell margins, vertical center alignment. Preserves embedded images. Hancom HWP compatible. Triggers on requests like "DOCX ํ
์ด๋ธ ์คํ์ผ", "ํ๊ธ ๋ณด๊ณ ์ ํ ๊พธ๋ฏธ๊ธฐ", "์ ๋ถ ์ ์์ ํฌ๋งท DOCX", "export Obsidian to styled Word", "all tables styled", "proposal document formatting". |
DOCX Table Styler (Korean Government Report Preset)
When to use
Invoke when the user asks to:
- Convert a large Markdown document (especially Obsidian vault with
![[wikilinks]]) to a styled .docx
- Apply consistent branded table styling across many tables (dozens to hundreds)
- Produce a Korean government proposal, research report, or bilingual KR/EN document
- Prepare a DOCX that will later be opened in Hancom Office and saved as
.hwp/.hwpx
What it does
Full pipeline from source .md to styled .docx:
- Converts Obsidian
![[filename]] wikilinks to standard markdown links (sed preprocessing)
- Runs Pandoc to produce unstyled
.docx with TOC and embedded images
- Applies table styling via
python-docx to every table (including nested):
tblLook conditional formatting flags โ zeroed (prevents style override)
- Content-proportional column widths (Korean chars weighted 1.7ร, min 900 dxa, budget 9000 dxa)
fixed table layout (widths respected in Hancom)
- Row-based alternating shading โ header navy, data rows blue/white alternating
- Uniform column styling (no first/last column special case)
- Cell vertical center alignment
- Minimal cell margins (top/bottom 20 dxa, left/right 80 dxa)
- Zero paragraph spacing, line spacing 1.0, empty paragraphs stripped
- Font size 10pt throughout (run-level +
pPr/rPr default)
- (Optional) Prepends a full-page cover image with page break
Inputs
Required:
- Input
.md file path
- Image folder path (for Pandoc to resolve
![[filename]])
- Output
.docx path
Optional:
- Cover image (
--cover path/to/cover.jpg)
Default palette (Korean gov proposal)
| Element | Hex |
|---|
| Header background | #1F3864 (dark navy) |
| Header text | #FFFFFF (white, bold) |
| Odd data rows | #D9E2F3 (light blue) |
| Even data rows | #FFFFFF (white) |
| Body text | #000000 (black) |
Customization: edit NAVY, LIGHT, WHITE constants at top of scripts/style_docx_tables.py.
Invocation
Full pipeline (most common)
bash ~/.claude/skills/docx-table-styler/scripts/md_to_docx.sh \
"proposal.md" \
"./๋์" \
"proposal.docx"
With cover page
bash ~/.claude/skills/docx-table-styler/scripts/md_to_docx.sh \
"proposal.md" \
"./๋์" \
"proposal.docx" \
--cover "cover.jpg"
Style an existing DOCX (skip MD conversion)
python3 ~/.claude/skills/docx-table-styler/scripts/style_docx_tables.py \
input.docx output.docx
Add cover page to existing DOCX
python3 ~/.claude/skills/docx-table-styler/scripts/add_cover_page.py \
input.docx cover.jpg output.docx
Success criteria
Constraints & pitfalls
- Obsidian wikilinks: Pandoc does NOT understand
![[file]] โ the sed preprocessing step is mandatory. The wrapper script handles this; if bypassing to call pandoc directly, run the sed step first.
- python-docx API quirks:
CT_PPr.get_or_add_rPr() does NOT exist โ create w:rPr manually via OxmlElement.
table.style = "Table Grid" may raise KeyError if the style is not present in the source DOCX โ wrap in try/except (already handled in script).
row.cells returns merged cells multiple times; the script guards with min(len(cells), num_cols).
- Nested tables: the script recursively descends through
cell.tables.
- Hancom HWP compatibility: requires BOTH
tblGrid/gridCol widths AND tcW per cell AND tblLayout w:type="fixed". The script sets all three.
- Text color on empty paragraphs: must set BOTH run-level color AND paragraph-level
pPr/rPr/w:color so empty paragraphs under navy header render white, not black.
- Scale: 104-table document processes in ~5s on M-series Mac; larger docs scale linearly.
Known limitations / open branching decisions
- Row banding only (no column banding alternative)
- Single header row assumed (multi-row header detection not implemented)
- LTR languages only (no RTL handling)
- Wide tables (10+ columns) may look cramped at 9000 dxa budget โ consider landscape page orientation
- HWP conversion is manual (open in Hancom โ save as
.hwp); no CLI automation included
After this skill
User opens the resulting .docx in Hancom ํ๊ธ โ ํ์ผ โ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ์ ์ฅ โ .hwp or .hwpx.
Hancom post-processing typically needed:
- Font substitution (์ ์์ ํ์ค: ํจ์ด๋กฌ๋ฐํ / ํจ์ด๋กฌ๋์)
- Page margin adjustment (์ ๋ถ ํ์ค: ์ํ์ข์ฐ 25mm)
- TOC regeneration (์
๋ ฅ โ ์ฐจ๋ก โ ์ฐจ๋ก ๋ง๋ค๊ธฐ)
Verification commands
unzip -p output.docx word/document.xml | tr '<' '\n' | grep -c '^w:tbl '
unzip -l output.docx | grep -c 'word/media/'
unzip -p output.docx word/document.xml | grep -o 'w:fill="[0-9A-Fa-f]*"' | head -5
File layout
~/.claude/skills/docx-table-styler/
โโโ SKILL.md # This file
โโโ scripts/
โโโ md_to_docx.sh # Full pipeline wrapper
โโโ style_docx_tables.py # Table styling engine
โโโ add_cover_page.py # Optional cover page inserter