Skip to content

About

A Microsoft Word add-in that instantly formats AI chat outputs (ChatGPT, Gemini, DeepSeek Markdown, tables & RTL) into professional Word styles.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Chat Formatter for Word / قالب‌بندی چت برای ورد

English | فارسی


English

The Problem This Solves

If you've ever copied a long answer from ChatGPT, DeepSeek, Gemini, or any AI chat into Word, you know the pain:

  • Headings stay as plain text with # symbols
  • Bold/italic/inline code markers (**, *, `) remain visible
  • Markdown tables (| a | b |) don't become real Word tables
  • Code blocks, blockquotes, bullet/numbered lists — all need manual cleanup
  • You spend hours fixing formatting instead of using the content

This repository exists to solve that in seconds.

Paste an AI answer into Word, open the Add-ins tab and click Format Chat Text — and it instantly becomes:

  • Real Word headings (styles Heading 1–5)
  • Real character formatting (bold, italic, strikethrough, inline code)
  • Real Word tables (Markdown pipe tables AND tab-separated from Excel/Sheets)
  • Real bullet/numbered lists (with RTL support for Persian/Arabic and automatic vertical splitting for inline numbered lists)
  • Clean standard dashes (—, ——, –, -- normalized to - outside code blocks)
  • Proper code blocks with monospace font and shading
  • Blockquotes with indentation and border
  • Links as underlined blue text

Undo with Ctrl+Z — the entire conversion is a single undo record.


What It Converts

Input Output
# Heading … ##### Heading Word Heading 1–5 styles
Text / === underline Heading 1 / Heading 2 (Setext)
**bold**, *italic*, ~~strike~~ Real character formatting
`inline code` Consolas 10pt, dark red
```code``` blocks Shaded monospace paragraphs
| a | b | + separator row Real Word table (RTL-aware)
Tab-separated rows (Excel/Sheets) Real Word table
- item, * item, + item Bulleted paragraphs (RTL aware)
1. item, ۱. مورد (or inline ۱. ... ۲. ...) Numbered paragraphs, numbers preserved and aligned vertically
—, ——, –, prose -- Standard - hyphen (outside code & URLs)
> quote Indented italic blockquote with right border
[label](url) Underlined blue text
---, ***, ___ Removed

Header rows are bold, shaded, and repeat across page breaks. Tables stretch to page width. Persian and English content are both handled — indentation flips to the right side automatically for RTL text.


Install

Standalone single-file installers (recommended — no ZIP needed):

Download just the file for your operating system directly from this repository. Both installers automatically uninstall any previous version first (old templates, lock files, legacy registry entries, and old settings) and then install the latest ChatFormatter.dotm.

Windows

  1. Download ChatFormatter-Windows-Installer.bat (direct file download; or grab it from Releases)
  2. Double-click ChatFormatter-Windows-Installer.bat normally (do not use Run as administrator, or it may install under a different Windows user profile; if SmartScreen prompts, click More info → Run anyway)

macOS

  1. Download ChatFormatter-Mac-Installer.command (direct file download; or grab it from Releases)
  2. Double-click ChatFormatter-Mac-Installer.command
    • If macOS says it lacks execute permission after downloading via a browser, run chmod +x ~/Downloads/ChatFormatter-Mac-Installer.command once in Terminal, or run bash ~/Downloads/ChatFormatter-Mac-Installer.command
    • If Gatekeeper asks, right-click the file and choose Open
  3. Open Word and answer Yes the first time it asks to enable the macros

(Alternatively, you can download a release ZIP from Releases, extract it, and run install.bat on Windows or install.command on macOS — those also clean up any previous version first.)

Both copy ChatFormatter.dotm into Word's STARTUP folder, so Word loads it as a global add-in on every launch. The Windows installer also registers that folder as a trusted location so macros run without security prompts.

Restart Word afterwards. Settings live in ~/.chatformatter/settings.ini on both platforms.


Use

From the Add-ins tab (recommended):

  1. Copy an answer from the AI chat
  2. Paste it into Word
  3. Open the Add-ins tab in the Word ribbon and click Format Chat Text
  4. Choose Yes to convert Markdown pipe / TSV tables as well, or No for text formatting only

Via the macro list (Alt+F8 on Windows, Tools > Macro on macOS):

Macro Action
FormatChatText Format entire document (asks: include tables?)
FormatSelection Format only the current selection
ShowSettings Display current configuration

Requirements

  • Windows or macOS
  • Microsoft Word 2016 or newer
  • No Python, no .NET, no internet, no admin rights (unless Word is in a protected path)

Uninstall

Run uninstall.bat (Windows) or uninstall.command (macOS). It removes the template and your settings.ini; the trusted-location entry on Windows is left in place because it is harmless.


Build from Source

The .dotm and standalone installers are committed so most users never need this. To rebuild after editing the VBA:

python3 tools/build_dotm.py      # rebuilds ChatFormatter.dotm + both standalone installers
python3 tools/package_win.py     # dist/win/ and dist/ChatFormatter-Win-<version>.zip
python3 tools/package_mac.py     # dist/mac/ and dist/ChatFormatter-Mac-<version>.zip

Needs only Python 3 (olefile is optional). The build writes the VBA project into a copy of tools/seed.dotm using a pure-Python MS-OVBA writer, so it needs neither Word nor PowerShell and runs identically on every platform. The template is platform neutral: the same .dotm ships to Windows and macOS, only the installer differs.

Check the result before shipping:

python3 tests/lint_vba.py src/ChatFormatter.bas src/ThisDocument.cls
python3 tests/test_cases.py
python3 tests/test_dotm_build.py
python3 tests/test_sample.py
python3 tests/test_word_output.py <original.docx> <formatted.docx>

test_word_output.py compares a document the add-in already formatted against the reference model; it needs a real Word run to produce the second file.


Repository Layout

ChatFormatter-Windows-Installer.bat  standalone self-contained installer (Windows)
ChatFormatter-Mac-Installer.command  standalone self-contained installer (macOS)
install.bat                          ZIP-mode installer (Windows)
uninstall.bat                        one-click uninstaller (Windows)
packaging/mac/                       install.command, uninstall.command, README-mac.md
ChatFormatter.dotm                   compiled template (what Word loads)
src/ChatFormatter.bas                all formatting logic, one linear pass
src/ThisDocument.cls                 startup hook for the Add-ins toolbar
tools/vbabuild.py                    MS-OVBA compressor and CFB writer/reader
tools/build_dotm.py                  injects src/ into tools/seed.dotm
tools/build_installers.py            embeds ChatFormatter.dotm into standalone installers
tools/package_win.py                 builds the Windows release ZIP
tools/package_mac.py                 builds the macOS release ZIP
tests/                               reference model and test suites

How the Add-in Loads

The template lives in Word's STARTUP folder, so Word loads it as a global add-in on every launch. ThisDocument runs ChatFormatter.AutoExec on startup, which registers the Format Chat Text button in the Add-ins tab so you can format pasted AI responses cleanly on demand without interfering with normal right-clicks.


Security Note

This is a macro-enabled template (.dotm). Install it from a source you trust. The installer marks Word's STARTUP folder as a trusted location — that's how every Word add-in works, but be aware if you share a machine.


License

MIT. See LICENSE.


فارسی

مشکلِ که این پروژه حل می‌کند

اگر تا به حال پاسخ طولانی‌ای را از ChatGPT، DeepSeek، Gemini یا هر چت‌بات هوش مصنوعی دیگر در ورد کپی کرده باشید، دردش را می‌دانید:

  • تیترها به صورت متن ساده با نماد # باقی می‌مانند
  • نشانه‌های پرته/خمیده/کد‌درون‌خطی (**، *، `) همچنان قابل دیدن هستند
  • جداول مارک‌داون (| a | b |) تبدیل به جداول واقعی ورد نمی‌شوند
  • بلوک‌های کد، نقل‌قول‌ها، لیست‌های پرتی/شماره‌دار — همه نیاز به اصلاح دستی دارند
  • شما ساعات وقت‌تان را صرف ویرایش قالب‌بندی می‌کنید به جای استفاده از محتوا

این مخزن برای حل همین مشکل در عرض چند ثانیه ساخته شده است.

یک پاسخ هوش مصنوعی را در ورد پیست کنید، از تب افزونه‌ها (Add-ins) روی دکمهٔ Format Chat Text کلیک کنید — و بلافاصله تبدیل می‌شود به:

  • تیترهای واقعی ورد (استایل‌های Heading ۱–۵)
  • قالب‌بندی واقعی کاراکتر (پررنگ، خمیده، خط‌خورده، کد درون‌خطی)
  • جداول واقعی ورد (جداول مارک‌داون Pipe و جداول Tab-separated از اکسل/شیتز با پشتیبانی RTL)
  • لیست‌های بولت/شماره‌دار واقعی (با پشتیبانی RTL برای فارسی/عربی و شکستن خودکار لیست‌های شماره‌دار متوالی به زیر هم)
  • یکسان‌سازی خط تیره‌های بلند و دوتایی (—، ——، –، --) به یک - استاندارد (خارج از بلوک‌های کد و لینک‌ها)
  • بلوک‌های کد با قلم مونوسپیس و سایه‌دهی
  • نقل‌قول‌ها با تورفتگی و کادر
  • لینک‌ها به صورت متن زیرخط‌دار آبی

واگرد با Ctrl+Z — کل تبدیل یک رکورد Undo واحد است.


مواردی که تبدیل می‌شوند

ورودی خروجی
# Heading … ##### Heading استایل‌های ورد Heading ۱–۵
متن ساده / زیرخط === Heading ۱ / Heading ۲ (Setext)
**پررنگ**، *خمیده*، ~~خط‌خورده~~ قالب‌بندی واقعی کاراکتر
`کد درون‌خطی` Consolas ۱۰نقطه، قرمز تیره
```بلوک کد``` پاراگراف‌های مونوسپیس سایه‌دار
| الف | ب | + ردیف جداکننده جدول واقعی ورد (با جهت RTL و سرستون پررنگ/سایه‌دار)
ردیف‌های جدا شده با Tab (اکسل/شیتز) جدول واقعی ورد
- آیتم، * آیتم، + آیتم پاراگراف‌های بولت‌دار (آگاه به RTL)
۱. آیتم یا ۱. ... ۲. ... پاراگراف‌های شماره‌دار عمودی، شماره‌ها حفظ می‌شوند
—، ——، –، -- متنی خط تیرهٔ استاندارد - (خارج از کد و لینک)
> نقل‌قول بلوک نقل‌قول خمیده تورفتگی‌دار با کادر راست
[برچسب](آدرس) متن زیرخط‌دار آبی
---، ***، ___ حذف می‌شوند

ردیف‌های سرتیتر پرته، سایه‌دار و در فصفح تکرار می‌شوند. جداول عرض صفحه را می‌پوشانند. محتوای فارسی و انگلیسی هر دو پشتیبانی می‌شوند — تورفتگی برای متن‌های RTL به‌صورت خودکار به راست می‌رود.


نصب

نصب‌کننده‌های تک‌فایلی مستقل (پیشنهادی — بدون نیاز به فایل ZIP):

فقط فایل مخصوص سیستم‌عامل خود را مستقیماً از همین مخزن دانلود و اجرا کنید. هر دو فایل به‌صورت خودکار ابتدا نسخهٔ قبلی را به‌طور کامل پاک می‌کنند (فایل‌های قدیمی، فایل‌های قفل، کلیدهای رجیستری قدیمی و تنظیمات قبلی) و سپس نسخهٔ جدید ChatFormatter.dotm را نصب می‌نمایند.

ویندوز

۱. فایل ChatFormatter-Windows-Installer.bat را دانلود کنید (دانلود مستقیم فایل؛ یا از صفحه Releases) ۲. روی ChatFormatter-Windows-Installer.bat به‌صورت عادی دابل‌کلیک کنید (Run as administrator را نزنید تا در پروفایل کاربر دیگری نصب نشود؛ در صورت نمایش پیام SmartScreen، روی More info → Run anyway بزنید)

مک

۱. فایل ChatFormatter-Mac-Installer.command را دانلود کنید (دانلود مستقیم فایل؛ یا از صفحه Releases) ۲. روی ChatFormatter-Mac-Installer.command دابل‌کلیک کنید

  • اگر مرورگر پس از دانلود اجازهٔ اجرا (+x) نداده بود، یک بار در Terminal دستور chmod +x ~/Downloads/ChatFormatter-Mac-Installer.command یا bash ~/Downloads/ChatFormatter-Mac-Installer.command را اجرا کنید
  • اگر پیام امنیتی macOS نمایش داده شد، روی فایل راست‌کلیک کرده و Open را بزنید ۳. ورد را باز کنید و بار اول، وقتی پرسید ماکروها فعال شوند، Yes را بزنید

(در صورت استفاده از فایل ZIP در صفحه Releases، پس از استخراج، install.bat روی ویندوز یا install.command روی مک نیز به‌طور خودکار ابتدا نسخهٔ قبلی را پاک و سپس نسخهٔ جدید را نصب می‌کنند.)

در هر دو سیستم ChatFormatter.dotm در پوشه STARTUP ورد کپی می‌شود، پس ورد آن را در هر اجرا به‌عنوان یک add-in سراسری بارگذاری می‌کند. نصب‌کنندهٔ ویندوز آن پوشه را هم به‌عنوان Trusted Location ثبت می‌کند تا ماکروها بدون پرامپت امنیتی اجرا شوند.

ورد را ری‌استارت کنید. تنظیمات در هر دو سیستم در ~/.chatformatter/settings.ini است.


استفاده

از طریق تب افزونه‌ها (Add-ins) — روش اصلی: ۱. پاسخ را از چت هوش مصنوعی کپی کنید ۲. در ورد جای‌گذاری (Paste) کنید ۳. در نوار بالای ورد به تب افزونه‌ها (Add-ins) بروید و روی Format Chat Text کلیک کنید ۴. اگر جداول هم دارید Yes و در غیر این صورت No را انتخاب کنید

از طریق فهرست ماکروها (Alt+F8 در ویندوز، یا Tools > Macro در مک):

ماکرو عملکرد
FormatChatText قالب‌بندی کل سند (همراه با پرسش دربارهٔ تبدیل جداول)
FormatSelection قالب‌بندی فقط بخش انتخاب‌شدهٔ فعلی
ShowSettings نمایش تنظیمات فعلی

پیش‌نیازها

  • ویندوز یا مک
  • مایکروسافت ورد ۲۰۱۶ یا جدیدتر
  • بدون پایتون، بدون دات‌نت، بدون اینترنت، بدون حق ادمین (مگر اینکه ورد در مسیر محافظت‌شده باشد)

حذف نصب

uninstall.bat (ویندوز) یا uninstall.command (مک) را اجرا کنید. این‌ها قالب و فایل settings.ini شما را حذف می‌کنند؛ رکورد Trusted Location روی ویندوز باقی می‌ماند چون بی‌اثر است.


ساخت از کد منبع

فایل .dotm و نصب‌کننده‌های مستقل در مخزن ذخیره شده‌اند بنابراین اکثر کاربران نیازی به ساخت ندارند. برای بازسازی پس از ویرایش VBA:

python3 tools/build_dotm.py      # بازسازی ChatFormatter.dotm و هر دو فایل اجرایی نصب
python3 tools/package_win.py     # dist/win/ و dist/ChatFormatter-Win-<version>.zip
python3 tools/package_mac.py     # dist/mac/ و dist/ChatFormatter-Mac-<version>.zip

فقط به پایتون ۳ نیاز دارد (olefile اختیاری است). بیلد، پروژهٔ VBA را با یک نویسندهٔ خالص پایتونی MS-OVBA داخل کپی‌ای از tools/seed.dotm می‌نویسد؛ بنابراین نه به ورد نیاز دارد و نه به PowerShell و روی همهٔ سیستم‌ها یکسان کار می‌کند. خودِ قالب مستقل از پلتفرم است: همان .dotm برای ویندوز و مک ارسال می‌شود و فقط نصب‌کننده فرق می‌کند.

قبل از انتشار بررسی کنید:

python3 tests/lint_vba.py src/ChatFormatter.bas src/ThisDocument.cls
python3 tests/test_cases.py
python3 tests/test_dotm_build.py
python3 tests/test_sample.py
python3 tests/test_word_output.py <original.docx> <formatted.docx>

test_word_output.py سندی را که افزونه فرمت کرده با مدل مرجع مقایسه می‌کند؛ برای ساختن فایل دوم یک اجرای واقعی ورد لازم است.


چیدمان مخزن

ChatFormatter-Windows-Installer.bat  نصب‌کننده مستقل و تک‌فایلی (ویندوز)
ChatFormatter-Mac-Installer.command  نصب‌کننده مستقل و تک‌فایلی (مک)
install.bat                          نصب‌کننده نسخه ZIP (ویندوز)
uninstall.bat                        حذف‌کننده یک‌کلیک (ویندوز)
packaging/mac/                       install.command، uninstall.command، README-mac.md
ChatFormatter.dotm                   قالب کامپایل‌شده (چه چیزی ورد بارگذاری می‌کند)
src/ChatFormatter.bas                کل منطق قالب‌بندی، در یک پاس خطی
src/ThisDocument.cls                 راه‌اندازی دکمهٔ تب افزونه‌ها هنگام شروع ورد
tools/vbabuild.py                    فشرده‌ساز MS-OVBA و نویسنده/خواننده CFB
tools/build_dotm.py                  تزریق src/ به tools/seed.dotm
tools/build_installers.py            ساخت فایل‌های نصب مستقل از روی ChatFormatter.dotm
tools/package_win.py                 ساخت ZIP نسخهٔ ویندوز
tools/package_mac.py                 ساخت ZIP نسخهٔ مک
tests/                               مدل مرجع و مجموعه تست‌ها

نحوه بارگذاری افزونه

قالب در پوشه STARTUP ورد قرار دارد، بنابراین ورد آن را در هر اجرا به عنوان یک add-in سراسری بارگذاری می‌کند. ماژول ThisDocument هنگام باز شدن ورد ChatFormatter.AutoExec را اجرا می‌کند و دکمهٔ Format Chat Text را در تب افزونه‌ها (Add-ins) قرار می‌دهد تا بدون تداخل با راست‌کلیک‌های عادی، با یک کلیک کل سند را مرتب کنید.


نکته امنیتی

این یک قالب ماکرو‌دار (.dotm) است. از منبعی که به آن اعتماد دارید نصب کنید. نصب‌کننده پوشه STARTUP ورد را به عنوان Trusted Location علامت‌گذاری می‌کند — این نحوه کار هر add-in وردی است، اما اگر دستگاه را به اشتراک می‌گذارید از آن آگاه باشید.


مجوز

MIT. فایل LICENSE را ببینید.


مشارکت

پیشنهادات، گزارش باگ و Pull Requestها خوش‌آمدند. لطفاً قبل از ارسال PR، تست‌های tests/ را اجرا کنید و قالب را با python3 tools/package_win.py و python3 tools/package_mac.py بسازید.


تحسین

این پروژه برای همه کسانی ساخته شده که می‌خواهند خروجی هوش مصنوعی را به سرعت در اسناد حرفه‌ای تبدیل کنند — بدون دردسر قالب‌بندی دستی.

⭐ حمایت / Support


⭐ If you found this project useful, please give it a star! It helps others discover it and motivates continued development.

What it does: A Microsoft Word add-in that instantly formats AI chat outputs (ChatGPT, Gemini, DeepSeek Markdown, tables & RTL) into professional Word styles from the Add-ins tab (Format Chat Text). Why it exists: To eliminate the hours spent manually cleaning up formatting (bold, tables, headings) after copying AI responses into Word.

⭐ اگر این پروژه برایتان کاربردی بود، لطفاً با دادن ستاره (Star) از آن حمایت کنید! این کار به دیده شدن پروژه کمک کرده و به توسعه‌دهنده برای بهبود و به‌روزرسانی آن انگیزه می‌دهد.

کارایی: یک افزونه مایکروسافت ورد برای فرمت و تبدیل آنی خروجی چت‌های هوش مصنوعی (ChatGPT، Gemini، DeepSeek و...) همراه با جداول، کدهای مارک‌داون و پشتیبانی از راست‌چین (RTL) به قالب‌های استاندارد و استایل‌های حرفه‌ای ورد از طریق دکمه اختصاصی در تب Add-ins. دلیل ایجاد: حذف ساعت‌ها زمان تلف‌شده برای تمیزکاری و اصلاح دستی متن، فونت‌ها، تیترها و جدول‌ها پس از کپی کردن پاسخ‌های هوش مصنوعی در محیط ورد.

About

A Microsoft Word add-in that instantly formats AI chat outputs (ChatGPT, Gemini, DeepSeek Markdown, tables & RTL) into professional Word styles.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages