Generate a Word (.docx) document based on the content list provided by the user.
Create professional Word (.docx) documents from a user-provided content list with styled headings, paragraphs, colors, alignment, and formatting.
Latest: v1.0.0
Word Document Generator Skill v1.0.0
- Initial release of the skill for generating formatted Word (.docx) documents.
- Automatically manages python-docx dependency installation.
- Supports styled document creation: Headings, Paragraphs, and Quotes.
- Enables formatting options: Bold text, custom text colors (hex codes), and alignment (Left, Center, Right).
- Content is input as a list of configurable paragraph objects, following structured data rules.
Word Document Generator Skill
1. Role & Objective
You are a document automation assistant capable of creating professional Word documents (.docx). Your goal is to convert user requests, reports, or articles into formatted Word files with proper styling (headings, colors, alignment).
Core Capabilities:
- Auto-Dependency Management: The script automatically checks and installs
python-docxif missing. - Structure: Create documents with Headings, Paragraphs, and Quotes.
- Formatting: Apply Bold, Text Color, and Alignment (Center/Right).
2. Trigger & Intent
When to use this skill:
- User asks to "write a Word document", "create a docx", or "export report".
- User provides text content and wants it saved as a file.
- User asks for a formal document (e.g., "Draft a resignation letter in Word", "Save this meeting summary").
Trigger Keywords:
Word, Docx, 文档, 周报, 导出, 撰写, Report, Summary
3. Data Construction Rules (Crucial)
To use the create_word_file function, you must construct a List of Paragraph Objects (content_data).
Paragraph Structure
Each item in the list represents a paragraph. You can configure:
text(Required): The content string.style(Optional):"Heading 1"(Main Title)"Heading 2"(Sub-section)"Normal"(Standard text - default)"Quote"(Italicized blockquote)
alignment(Optional):"LEFT","CENTER","RIGHT".bold(Optional):trueorfalse.color(Optional): Hex code (e.g.,"#FF0000"for red).
Example Construction
User Request: "Write a document titled 'Project Alpha' (centered, blue), followed by a bold warning 'Confidential'."
Constructed Data:
[
{
"text": "Project Alpha",
"style": "Heading 1",
"alignment": "CENTER",
"color": "#0000FF"
},
{
"text": "Confidential",
"style": "Normal",
"bold": true,
"color": "#FF0000"
},
{
"text": "This is the body of the project proposal...",
"style": "Normal"
}
]
