python-pptx-4-table-creation
БесплатноБез исполняемых скриптовНе проверенSub-skill of python-pptx: 4. Table Creation.
от vamseeachanta★ 21 звезда на GitHubОб этом скилле
4. Table Creation
4. Table Creation
"""
Create and format tables in PowerPoint presentations.
"""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RgbColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.oxml.ns import qn
from pptx.oxml import parse_xml
from typing import List, Any
def set_cell_color(cell, color_hex: str) -> None:
"""Set cell background color."""
cell.fill.solid()
cell.fill.fore_color.rgb = RgbColor(
int(color_hex[0:2], 16),
int(color_hex[2:4], 16),
int(color_hex[4:6], 16)
)
def create_table_slide(
prs: Presentation,
title: str,
headers: List[str],
data: List[List[Any]],
col_widths: List[float] = None
) -> None:
"""Create a slide with a formatted table."""
slide = prs.slides.add_slide(prs.slide_layouts[5]) # Title only
slide.shapes.title.text = title
rows = len(data) + 1 # +1 for header
cols = len(headers)
# Default column widths
if col_widths is None:
total_width = 11
col_widths = [total_width / cols] * cols
# Create table
table_width = sum(col_widths)
left = Inches((13.333 - table_width) / 2) # Center table
top = Inches(1.8)
width = Inches(table_width)
height = Inches(0.5 * rows)
table = slide.shapes.add_table(rows, cols, left, top, width, height).table
# Set column widths
for i, w in enumerate(col_widths):
table.columns[i].width = Inches(w)
# Style header row
for i, header in enumerate(headers):
cell = table.cell(0, i)
cell.text = header
set_cell_color(cell, '2F5496')
# Format text
para = cell.text_frame.paragraphs[0]
para.font.bold = True
para.font.size = Pt(12)
para.font.color.rgb = RgbColor(255, 255, 255)
para.alignment = PP_ALIGN.CENTER
cell.vertical_anchor = MSO_ANCHOR.MIDDLE
# Add data rows
for row_idx, row_data in enumerate(data, start=1):
for col_idx, value in enumerate(row_data):
cell = table.cell(row_idx, col_idx)
cell.text = str(value)
# Alternate row colors
if row_idx % 2 == 0:
set_cell_color(cell, 'D6DCE5')
# Format text
para = cell.text_frame.paragraphs[0]
para.font.size = Pt(11)
para.alignment = PP_ALIGN.CENTER
cell.vertical_anchor = MSO_ANCHOR.MIDDLE
def create_table_presentation(output_path: str) -> None:
"""Create presentation with various table examples."""
prs = Presentation()
# Simple data table
headers = ['Product', 'Q1', 'Q2', 'Q3', 'Q4', 'Total']
data = [
['Widget A', '$150K', '$180K', '$220K', '$250K', '$800K'],
['Widget B', '$80K', '$95K', '$110K', '$130K', '$415K'],
['Widget C', '$200K', '$220K', '$260K', '$290K', '$970K'],
['Total', '$430K', '$495K', '$590K', '$670K', '$2.19M'],
]
create_table_slide(
prs,
"Quarterly Sales Summary",
headers,
data,
col_widths=[2, 1.5, 1.5, 1.5, 1.5, 1.5]
)
# Comparison table
headers = ['Feature', 'Basic Plan', 'Pro Plan', 'Enterprise']
data = [
['Users', '5', '25', 'Unlimited'],
['Storage', '10 GB', '100 GB', '1 TB'],
['Support', 'Email', '24/7 Chat', 'Dedicated'],
['Price/mo', '$9', '$29', '$99'],
]
create_table_slide(
prs,
"Pricing Comparison",
headers,
data,
col_widths=[3, 2.5, 2.5, 2.5]
)
# Schedule/Timeline table
headers = ['Phase', 'Start', 'End', 'Status', 'Owner']
data = [
['Planning', 'Jan 1', 'Jan 15', 'Complete', 'Team A'],
['Development', 'Jan 16', 'Mar 31', 'In Progress', 'Team B'],
['Testing', 'Apr 1', 'Apr 30', 'Pending', 'Team C'],
['Launch', 'May 1', 'May 15', 'Pending', 'Team D'],
]
create_table_slide(
prs,
"Project Timeline",
headers,
data,
col_widths=[2.5, 1.5, 1.5, 2, 2]
)
prs.save(output_path)
print(f"Table presentation saved to {output_path}")
create_table_presentation("table_presentation.pptx")
Установить python-pptx-4-table-creation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл python-pptx-4-table-creation?
Sub-skill of python-pptx: 4. Table Creation.
Как установить скилл python-pptx-4-table-creation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python-pptx-4-table-creation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic