๐ซ The Pain Point
Client asks for a quote. You calc in Excel, then copy-paste to Word, then Save as PDF. Manual copy-pasting is slow and risky (wrong price errors).
๐ Agentic Solution
Template Engine: You design the pretty look in Word. The tool fills in the data.
Key Features:
- Dynamic Tables: Automatically expands the table rows if the customer buys 1 item or 100 items.
- Design Freedom: Use MS Word features (colors, logos) to design, no coding layout needed.
โ๏ธ Phase 1: Commander (Quick Fix)
For a single quote.
Prompt:
โI have
data.xlsxandtemplate.docx. Usedocxtplto fill variables{{name}},{{total}}in the template with data from the Excel using the first row. Render toQuote.docx.โ
Result: filled Word doc.
๐๏ธ Phase 2: Architect (Permanent Tool)
For Sales Teams.
Engineering Prompt:
**Role:** Python Document Automation Dev
**Task:** Create a "Quotation Generator Tool".
**Requirements:**
1. **GUI:**
* Input Fields: Customer Name.
* Table Input (or Load from Excel).
* "Generate PDF" button.
2. **Logic:**
* Use `docxtpl` to render the Word template with context.
* Convert to PDF (via `docx2pdf` on Windows).
* Auto-name file `Quote_[Customer]_[Date].pdf`.
3. **Deliverables:** `quote_tool.py`, `template.docx`, `run.bat` (Windows), `run.sh` (Mac).
๐ง Prompt Decoding
- Docxtpl: Drawing a table in Python code (ReportLab) is a nightmare. Using a Word Template (
.docx) separates design from logic. The user can change the logo in Word without touching the code.
๐ ๏ธ Instructions
- Edit
template.docxwith template variable tags. - Copy Prompt -> Paste -> Run.
- Input Data -> Export.