- name
- pptx-editor
- description
- Create, read, edit, and manipulate PowerPoint presentations (.pptx) with full formatting, layouts, charts, images, speaker notes, and template support
- enabled
- true
## Instructions
When the user asks you to create, read, edit, or manipulate a PowerPoint presentation (.pptx), follow the workflows below.
### 1. Determine the Operation
| User Intent | Operation | Script |
|-------------|-----------|--------|
| Create a new presentation | **Create** | `scripts/create_pptx.py` |
| Read / extract content from a .pptx | **Read** | `scripts/read_pptx.py` |
| Edit an existing presentation | **Edit** | `scripts/edit_pptx.py` |
| Merge multiple presentations | **Merge** | `scripts/merge_pptx.py` |
| Convert .pptx to other formats | **Convert** | `scripts/convert_pptx.py` |
| Apply or use a template | **Template** | `scripts/template_fill.py` |
| Inspect presentation structure | **Inspect** | `scripts/inspect_pptx.py` |
### 2. Creating Presentations
Use `scripts/create_pptx.py` to build a new .pptx from a JSON content specification.
**Content specification format:**
```json
{
"output_path": "/tmp/presentation.pptx",
"metadata": {
"title": "Presentation Title",
"author": "Author Name",
"subject": "Subject"
},
"slide_width_inches": 13.333,
"slide_height_inches": 7.5,
"slides": [
{
"layout": "title",
"title": "Main Title",
"subtitle": "Subtitle or tagline",
"notes": "Speaker notes for this slide"
},
{
"layout": "title_content",
"title": "Slide Title",
"content": [
{
"type": "text",
"text": "Regular paragraph text",
"bold": false,
"font_size": 18,
"color": "#333333"
},
{
"type": "bullet_list",
"items": [
"First bullet point",
"Second bullet point",
"Third bullet point"
],
"level": 0,
"font_size": 16
},
{
"type": "numbered_list",
"items": ["Step one", "Step two", "Step three"]
}
],
"notes": "Speaker notes here"
},
{
"layout": "two_column",
"title": "Comparison Slide",
"left_content": [
{"type": "text", "text": "Left column heading", "bold": true},
{"type": "bullet_list", "items": ["Point A", "Point B"]}
],
"right_content": [
{"type": "text", "text": "Right column heading", "bold": true},
{"type": "bullet_list", "items": ["Point C", "Point D"]}
]
},
{
"layout": "blank",
"shapes": [
{
"type": "textbox",
"text": "Custom positioned text",
"left_inches": 1.0,
"top_inches": 1.0,
"width_inches": 5.0,
"height_inches": 1.5,
"font_size": 24,
"bold": true,
"color": "#2E74B5",
"alignment": "center"
},
{
"type": "image",
"path": "/tmp/chart.png",
"left_inches": 1.0,
"top_inches": 3.0,
"width_inches": 8.0
},
{
"type": "rectangle",
"left_inches": 0.5,
"top_inches": 0.5,
"width_inches": 12.0,
"height_inches": 6.5,
"fill_color": "#F2F2F2",
"border_color": "#2E74B5",
"border_width": 2
},
{
"type": "line",
"start_x": 1.0,
"start_y": 4.0,
"end_x": 12.0,
"end_y": 4.0,
"color": "#CCCCCC",
"width": 1.5
}
]
},
{
"layout": "title_content",
"title": "Data Table",
"content": [
{
"type": "table",
"headers": ["Metric", "Q1", "Q2", "Q3", "Q4"],
"rows": [
["Revenue", "$10M", "$12M", "$15M", "$18M"],
["Growth", "5%", "8%", "12%", "15%"]
],
"header_bg_color": "#2E74B5",
"header_font_color": "#FFFFFF",
"font_size": 12,
"left_inches": 1.0,
"top_inches": 2.0,
"width_inches": 11.0,
"height_inches": 3.0
}
]
},
{
"layout": "section_header",
"title": "Section Break Title",
"subtitle": "Optional section description"
},
{
"layout": "title_only",
"title": "Title Only Slide",
"shapes": [
{
"type": "image",
"path": "/tmp/diagram.png",
"left_inches": 1.5,
"top_inches": 2.0,
"width_inches": 10.0
}
]
}
]
}
```
**Available layouts:**
| Layout | Description | Placeholders |
|--------|-------------|-------------|
| `title` | Title slide | title, subtitle |
| `title_content` | Title + body area | title, content |
| `section_header` | Section divider | title, subtitle |
| `two_column` | Two-column layout | title, left_content, right_content |
| `title_only` | Title + blank area | title, shapes |
| `blank` | Fully blank | shapes |
| `comparison` | Side-by-side comparison | title, left_title, left_content, right_title, right_content |
| `content_caption` | Content with caption | title, content, caption |
**Guidelines for creating presentations:**
- Use professional defaults (Calibri, dark text on light backgrounds) unless specified otherwise
- Limit text per slide — prefer bullet points over paragraphs
- 6-8 words per bullet, 6-8 bullets max per slide
- Use a consistent color scheme throughout
- Include speaker notes with additional context and talking points
- Always start with a title slide and end with a closing/Q&A slide
- Always save output to `/tmp/` directory
- After creating, provide the file path and offer to share via `file-sharing`
### 3. Reading Presentations
Use `scripts/read_pptx.py` to extract content from existing .pptx files.
**Extraction modes:**
| Mode | Description | Use Case |
|------|-------------|----------|
| `text` | Plain text from all slides | Quick content review |
| `structured` | JSON with slides, shapes, formatting | Detailed analysis |
| `notes` | Speaker notes only | Preparing to present |
| `outline` | Titles and bullet points | Content overview |
| `images` | Extract embedded images | Image retrieval |
| `tables` | Extract table data | Data extraction |
**Usage:**
```bash
python scripts/read_pptx.py /tmp/presentation.pptx --mode structured
```
**Guidelines for reading:**
- Default to `outline` mode for summary requests
- Use `structured` mode when the user needs formatting details or layout info
- Use `notes` mode for speaker notes extraction
- Use `tables` mode for extracting tabular data
- Extract images to `/tmp/pptx_images/` when requested
- Report slide count and provide a brief outline before dumping full content
### 4. Editing Presentations
Use `scripts/edit_pptx.py` to modify existing .pptx files.
**Supported edit operations:**
```json
{
"input_path": "/tmp/original.pptx",
"output_path": "/tmp/edited.pptx",
"operations": [
{
"action": "find_replace",
"find": "old text",
"replace": "new text"
},
{
"action": "add_slide",
"position": 3,
"layout": "title_content",
"title": "New Slide Title",
"content": [
{"type": "bullet_list", "items": ["Point 1", "Point 2"]}
]
},
{
"action": "delete_slide",
"slide_index": 5
},
{
"action": "reorder_slide",
"from_index": 2,
"to_index": 5
},
{
"action": "duplicate_slide",
"slide_index": 1
},
{
"action": "update_slide_title",
"slide_index": 0,
"title": "Updated Title"
},
{
"action": "update_notes",
"slide_index": 2,
"notes": "Updated speaker notes for this slide"
},
{
"action": "add_image",
"slide_index": 1,
"image_path": "/tmp/photo.png",
"left_inches": 2.0,
"top_inches": 2.5,
"width_inches": 6.0
},
{
"action": "add_textbox",
"slide_index": 1,
"text": "Annotation text",
"left_inches": 8.0,
"top_inches": 5.0,
"width_inches": 4.0,
"height_inches": 1.0,
"font_size": 14,
"bold": true
},
{
"action": "add_table",
"slide_index": 2,
"headers": ["Name", "Value"],
"rows": [["A", "1"]],
"left_inches": 1.0,
"top_inches": 2.5,
"width_inches": 10.0,
"height_inches": 2.0
},
{
"action": "add_shape",
"slide_index": 3,
"shape_type": "rectangle",
"left_inches": 1.0,
"top_inches": 1.0,
"width_inches": 4.0,
"height_inches": 2.0,
"fill_color": "#2E74B5",
"text": "Box Label",
"font_color": "#FFFFFF"
},
{
"action": "set_background",
"slide_index": 0,
"color": "#1A1A2E"
},
{
"action": "update_metadata",
"title": "New Presentation Title",
"author": "New Author"
}
]
}
```
**Guidelines for editing:**
- Always save to a **new file** by default to preserve the original
- Show the user what changes will be made before applying
- Slide indices are 0-based
- For find/replace, report how many occurrences were found
- Preserve all existing formatting that isn't being explicitly changed
### 5. Merging Presentations
在 GitHub 查看