Skip to content
Back to skills

Docx Python Docx Justify

ASecurity

Use when writing a .docx with python-docx that contains formulas, code, or manually line-broken text blocks — do not apply paragraph justify alignment to them, it stretches spacing unnaturally.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
ai-agentspython

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add Bank848/Claude-Abo --skill docx-python-docx-justify --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docx Python Docx Justify?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docx Python Docx Justify
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bank848-docx-python-docx-justify/badge)](https://www.skillsdirectory.com/skills/bank848-docx-python-docx-justify)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docx-python-docx-justify
description: Use when writing a .docx with python-docx that contains formulas, code, or manually line-broken text blocks — do not apply paragraph justify alignment to them, it stretches spacing unnaturally.
---

## python-docx: ห้าม justify กับสูตร/โค้ด/บล็อกที่ตัดบรรทัดเอง
เวลาสร้าง .docx ด้วย python-docx แล้วมีเนื้อหาที่เป็นสูตรคำนวณ, สมการ, หรือบล็อกข้อความที่ตัดบรรทัดเองด้วย `\n` ภายใน paragraph เดียว (ไม่ใช่ prose ปกติ) → **ห้ามตั้ง `alignment = WD_ALIGN_PARAGRAPH.JUSTIFY`** กับ paragraph นั้นเด็ดขาด ให้ปล่อยเป็น left align ปกติ (ไม่ set alignment เลย)

- **เหตุผล:** justify ยืดช่องว่างระหว่างคำในทุกบรรทัดยกเว้นบรรทัดสุดท้ายให้เต็มความกว้างหน้ากระดาษ (พฤติกรรมปกติของ justify กับ manual line-break หลายบรรทัด) สูตรหลายบรรทัดในพารากราฟเดียวจึงออกมาเป็นช่องห่างๆ และดูผิดปกติทันที
- **หลักการทั่วไปที่ดึงมาจากกรณีนี้:** justify (`WD_ALIGN_PARAGRAPH.JUSTIFY`) เหมาะกับ **prose ความเรียงยาวที่ wrap เองตามความกว้างหน้ากระดาษ** เท่านั้น (เช่นเนื้อหา, คำอธิบาย, สรุป) — ไม่เหมาะกับเนื้อหาที่ **มนุษย์คุมการตัดบรรทัดเอง** ไม่ว่าจะเป็นสูตรคณิตศาสตร์, code block, ASCII table, หรือ list ที่จงใจให้แต่ละบรรทัดสั้นยาวไม่เท่ากัน — เพราะ justify จะพยายามยืดทุกบรรทัดให้เต็มความกว้างเสมอไม่สนความยาวจริงของเนื้อหา
- **วิธีเช็คก่อนส่ง:** ถ้า paragraph ไหนมี `\n` (multi-line ในรันเดียว) หรือเป็นเนื้อหาสูตร/โค้ด ให้ตรวจว่าไม่ได้ตั้ง justify ติดมาจาก default/copy-paste จากฟังก์ชัน helper ตัวอื่นในสคริปต์เดียวกัน (ข้อผิดพลาดที่พบบ่อยคือฟังก์ชัน helper ตัวเดียวที่มี parameter align="justify" ถูกใช้ร่วมกันทั้งสูตรและ prose)
- ใช้กับทุก project ที่สร้างเอกสาร .docx ผ่าน python-docx — เช็คทุกครั้งที่มีเนื้อหาแบบสูตร/โค้ด/ตารางข้อความในเอกสาร

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.