pptx-python-pptx-shapes-and-tables
/pptx-python-pptx-shapes-and-tables
Use this skill when constructing cards, containers, callout pills, connectors, and styled data tables programmatically via python-pptx.
- Author
- nextboxis ↗
- Repository
- library-skill-agents ↗
- Licence
- MIT
- Last repository change
- 28.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when constructing cards, containers, callout pills, connectors, and styled data tables programmatically via python-pptx.
Original author description
Use this skill when constructing cards, containers, callout pills, connectors, and styled data tables programmatically via python-pptx.
How it works
- When to use
- Design principles
- Step-by-step workflow
- Specifics & examples
- Common mistakes
- Review checklist
- Related skills
SKILL.md preview
---
name: pptx-python-pptx-shapes-and-tables
description: Use this skill when constructing cards, containers, callout pills, connectors, and styled data tables programmatically via python-pptx.
---
# python-pptx Shapes and Tables
## When to use
Use this skill when assembling modular card grids, background surface containers, status badges, and styled tabular scorecards in python-pptx.
## Design principles
- **Shape Type Semantics**: Use `MSO_SHAPE.ROUNDED_RECTANGLE` for cards and badges; use `MSO_SHAPE.RECTANGLE` for surface backgrounds.
- **Zero Default Borders**: Python-pptx adds black borders to shapes by default; explicitly set `line.color` or set `line.fill.background()` to remove.
- **Strict Margin Reset**: Reset text box internal margins (`margin_top = Inches(0)`, etc.) when precise vertical alignment is required.
- **Table Cell Padding**: Adjust table cell vertical anchors and margins to prevent cramped text.
## Step-by-step workflow
1. **Create card container**:
- `shape = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, left, top, width, height)`.
2. **Apply surface styling**:
- `shape.fill.solid()`; set color to `#FFFFFF` or `#F8FAFC`.
- `shape.line.color.rgb = RGBColor(226, 232, 240)` with width 1 pt.
3. **Add structured table**:
- `table_shape = slide.shapes.add_table(rows, cols, left, top, width, height)`.
4. **Format table headers**:
- Iterate through row 0 cells, applying dark background fill `#0F172A` and white bold font.
5. **Format data rows**:
- Iterate alternating zebra rows `#FFFFFF` and `#F8FAFC`; right-align numeric cells.
## Specifics & examples
- **Runnable Card and Table Construction**:
```python
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.500)
slide = prs.slides.add_slide(prs.slide_layouts[6])
# 1. Add background card container
card = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.8), Inches(1.8), Inches(11.733), Inches(4.8))
card.fill.solid()
card.fill.fore_color.rgb = RGBColor(248, 250, 252)
card.line.color.rgb = RGBColor(226, 232, 240)
# 2. Add 4x3 Table inside card
table_shape = slide.shapes.add_table(4, 3, Inches(1.2), Inches(2.2), Inches(10.933), Inches(3.8))
table = table_shape.table
table.columns[0].width = Inches(4.933)
table.columns[1].width = Inches(3.000)
table.columns[2].width = Inches(3.000)
# Format header
headers = ["Component", "Throughput", "Latency P99"]
for idx, text in enumerate(headers):
cell = table.cell(0, idx)
cell.fill.solid()
cell.fill.fore_color.rgb = RGBColor(15, 23, 42)
p = cell.text_frame.paragraphs[0]
p.text = text
p.font.bold = True
p.font.size = Pt(13)
p.font.color.rgb = RGBColor(255, 255, 255)
prs.save("table_demo.pptx")
```
## Common mistakes
- Leaving default bright blue fills and black borders on python-pptx generated shapes.
- Allowing table cells to auto-wrap into vertical single-character columns due to inadequate column widths.
- Failing to set text alignment explicitly, leaving numbers left-aligned and messy.
## Review checklist
- [ ] Card shapes use rounded corners with clean subtle borders (`#E2E8F0`).
- [ ] Default shape borders and fills are explicitly overridden.
- [ ] Table headers feature dark slate background with bold white text.
- [ ] Numeric table columns are right-aligned.
## Related skills
- pptx-table-design-and-formatting
- pptx-shape-based-custom-smartart
- pptx-python-pptx-foundations
- pptx-code-layout-helpers-and-design-tokens
Versions
The database has no other skills named pptx-python-pptx-shapes-and-tables.
Database snapshot: 13.11.2026 · package version ee8560193bdd (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100pptx-python-pptx-charts-and-images
Use this skill when rendering native charts, series styling, and cropping high-resolution images programmatically via python-pptx. - 100powerpoint
Creates, edits, and reads PowerPoint (.pptx) files programmatically with the python-pptx library. Use when a user asks to generate a PPTX, modify slides, extract text from a presentation, add charts or tables to PowerPoint, build slides from data, convert content to PPTX, or… - 100pptx-python-pptx-foundations
Use this skill when initializing presentations, configuring 16:9 widescreen dimensions, and manipulating slides via python-pptx. - 100pptx-generator
Create PowerPoint (.pptx) decks - layouts, text, tables, charts, images, and brand templates - using python-pptx. Use whenever the deliverable is a presentation file. - 95pptx-skill
Create, edit, and extract content from PowerPoint (.pptx) files; use when you need to generate slides programmatically, update existing decks, or export slide previews. - 100pptx
Read, create, or edit PowerPoint .pptx decks — build slides from an outline, extract slide text/speaker notes, edit shapes/tables/charts, replace images, or export to PDF/images. Use whenever a .pptx (or .ppt) file is an input or output, or the user mentions a deck, slides, or a presentation.