# Thai Word Layout Fixer

> Fixes Thai Word document layouts by resolving stretched whitespace and broken syllables in tables via ZWSP injection.

Thai Word Layout Fixer is a paid AI agent skill on Agensi by Tee K., in Productivity. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Tee K.](https://www.agensi.io/creators/tee-k)
- Category: [Productivity](https://www.agensi.io/skills/productivity)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/thai-word-layout-fixer
- Tags: productivity, translation, writing, word-automation, thai-language-processing, ooxml, document-layout, microsoft-word

## About this skill

Word documents in Thai often suffer from unsightly gaps when using Thai Distributed alignment, or broken syllables in narrow table cells. This skill fixes these layout issues by programmatically inserting invisible Zero-Width Spaces (ZWSP) at correct word boundaries, preventing Word from breaking words in the middle of a syllable. It handles the complex logic of Thai word segmentation, ensuring compound words stay together while distributing whitespace evenly.

### What it does
- **Smart Word Breaking** inserts ZWSPs only at valid word boundaries to prevent mid-syllable breaks in tables and paragraphs.
- **Thai Distributed Alignment** applies `thaiDistribute` to body text so lines fill the full width, while the word-break points keep the extra spacing small.
- **Table Overflow Correction** recalculates and fixes tables that exceed page margins or have narrow, broken-text columns.
- **Spacing Evaluation** simulates the TH Sarabun font family to estimate how much each line stretches and report lines that are visibly too wide (an estimate, so a final check in Word is still recommended).
- **Mode Switching** toggles between "Print Ready" (with ZWSPs) and "Edit Ready" (clean text) to avoid red underlines during manual editing.
- **Smart Text Modification** cleans invisible markers before making content changes and re-applies layout rules to ensure consistency.

### How it works
1. **Analyze Document** scans paragraphs and tables to categorize content into body text, headers, and table cells.
2. **Apply Layout Logic** uses a multi-tier segmentation strategy involving `Intl.Segmenter` and a refined exclusion list to insert ZWSPs.
3. **Verify and Refine** runs a simulated line-break check to identify and fix remaining gaps or illegal word breaks.
4. **Final Sync** writes the optimized OOXML back to the document while preserving fonts, bolding, and existing styles.

### Frameworks & tools
This skill utilizes Office JavaScript API (Word) and `Intl.Segmenter` for linguistic analysis. It includes custom logic tuned for the TH Sarabun font family and OOXML manipulation.

### Why this beats prompting it yourself
Standard LLM prompts cannot "see" where Word will break a line or handle the invisible characters needed to fix Thai justification. This skill estimates line breaks from TH Sarabun character widths and uses 3-layer word-segmentation logic to prevent errors like "งบ|ประมาณ" that generic prompts ignore.

### Use cases
- Fixing Thai Word documents where sentences are stretched so wide they become unreadable.
- Repairing tables where Thai text is cut off or broken vertically in narrow columns.
- Preparing a document for professional printing or PDF export with clean Thai justification.
- Cleaning up "hidden character" issues that cause the cursor to skip or red underlines to appear in Thai text.

### Known limitations
Requires an agent that can run Office.js inside Microsoft Word (for example Claude for Word). It will not work in coding agents that only read and write files. Line spacing estimation is optimized for TH Sarabun fonts; accuracy may vary with other font families. It does not support nested tables or documents with non-standard default tab stops.

## Requires

- Microsoft Word

Needs Claude for Word or another agent that runs Office.js inside Word. Spacing estimates are tuned for TH Sarabun fonts (PSK, New, IT9); other fonts still get the word-break fixes, without the spacing report.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Thai Word Layout Fixer skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill fix the layout issues common in Thai Word documents?

This skill fixes the common 'stretched whitespace' and broken syllable issues in Thai Word documents by programmatically inserting invisible Zero-Width Spaces (ZWSP) at precise linguistic boundaries.

### Are there any specific font or document structure limitations I should be aware of?

The skill is optimized for the TH Sarabun font family, though it works with other Thai fonts; however, it does not currently support nested tables or documents with non-standard tab stops.

### Can I still edit my document easily after the layout has been fixed?

Yes, the skill includes a 'Mode Switching' feature that allows you to toggle between a 'Print Ready' version with ZWSPs and an 'Edit Ready' version that removes them for easy manual editing without red underlines.

### What exactly is included with my purchase of the Thai Doc Layout skill?

Your purchase includes the full Thai Doc Layout skill set, featuring smart word breaking, table overflow correction, and the multi-tier segmentation logic designed for professional Thai justification.

### Which AI agents and software frameworks is this skill compatible with?

The skill utilizes the Office JavaScript API and the Intl.Segmenter tool to handle complex Thai word segmentation, ensuring it works seamlessly within the Microsoft Word environment.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
