Goal
Export a complete PRD as a formatted Word document. Product managers and executives expect Word files.
Backend
Install python-docx in api/requirements.txt.
Endpoint: GET /api/projects/{slug}/export?format=docx
When format=docx:
- Load all sections ordered by
sort_order
- Build a python-docx Document:
- Title page: project name, description, export date
- Table of contents (built-in TOC field)
- For each section:
- Heading 1: section title
- Status badge as inline text: "[APPROVED]" / "[DRAFT]" etc.
- Content: convert markdown to docx paragraphs via
markdown-it-py AST
- Dependencies listed as italic paragraph
- Appendix: dependency graph as text-based adjacency list
- Return as
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Markdown-to-docx conversion priorities:
- Headings (##, ###) -> Word Heading 2, Heading 3
- Bold, italic -> Run formatting
- Code blocks -> Monospace font with light gray shading
- Bullet lists -> Word bullet list
- Tables -> Word tables
- Links -> Hyperlinks (or plain text with URL)
- Anything unconvertible -> render as plain text (no crashes)
Frontend
Add "Export DOCX" option in the project export dropdown alongside existing PDF and Markdown exports. Triggers a download.
Acceptance Criteria
Goal
Export a complete PRD as a formatted Word document. Product managers and executives expect Word files.
Backend
Install
python-docxinapi/requirements.txt.Endpoint:
GET /api/projects/{slug}/export?format=docxWhen
format=docx:sort_ordermarkdown-it-pyASTapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentMarkdown-to-docx conversion priorities:
Frontend
Add "Export DOCX" option in the project export dropdown alongside existing PDF and Markdown exports. Triggers a download.
Acceptance Criteria