python-docx-common-issues
БесплатноБез исполняемых скриптовНе проверенSub-skill of python-docx: Common Issues.
от vamseeachanta★ 21 звезда на GitHubОб этом скилле
Common Issues
Common Issues
1. Font Not Appearing Correctly
# Problem: Font doesn't display in Word
# Solution: Use fonts available on target system
# Check available fonts
def get_available_fonts():
"""List fonts that should work cross-platform."""
return [
'Arial', 'Calibri', 'Times New Roman',
'Georgia', 'Verdana', 'Tahoma',
'Consolas', 'Courier New'
]
# Use fallback fonts
def set_font_with_fallback(run, preferred_font, fallback='Arial'):
run.font.name = preferred_font
# Set East Asian font as fallback
run._element.rPr.rFonts.set(qn('w:eastAsia'), fallback)
2. Table Width Issues
# Problem: Table columns not sized correctly
# Solution: Explicitly set column widths
def set_column_widths(table, widths):
"""Set explicit column widths for table."""
for row in table.rows:
for idx, (cell, width) in enumerate(zip(row.cells, widths)):
cell.width = width
# Usage
widths = [Inches(1), Inches(3), Inches(2)]
set_column_widths(table, widths)
3. Image Not Displaying
# Problem: Image doesn't appear in document
# Solution: Verify image path and format
from pathlib import Path
from PIL import Image
def validate_and_add_image(doc, image_path, width=None):
"""Validate image before adding to document."""
path = Path(image_path)
if not path.exists():
raise FileNotFoundError(f"Image not found: {image_path}")
# Check format
supported_formats = {'.png', '.jpg', '.jpeg', '.gif', '.bmp', '.tiff'}
if path.suffix.lower() not in supported_formats:
raise ValueError(f"Unsupported format: {path.suffix}")
# Validate image can be opened
try:
with Image.open(image_path) as img:
img.verify()
except Exception as e:
raise ValueError(f"Invalid image file: {e}")
# Add to document
if width:
doc.add_picture(str(image_path), width=Inches(width))
else:
doc.add_picture(str(image_path))
4. Style Not Applied
# Problem: Custom style not appearing
# Solution: Ensure style exists before using
def safe_apply_style(paragraph, style_name, doc):
"""Apply style with fallback if not found."""
try:
paragraph.style = style_name
except KeyError:
# Style doesn't exist, create it or use default
if style_name not in [s.name for s in doc.styles]:
# Create minimal style
from docx.enum.style import WD_STYLE_TYPE
doc.styles.add_style(style_name, WD_STYLE_TYPE.PARAGRAPH)
paragraph.style = style_name
Установить python-docx-common-issues в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл python-docx-common-issues?
Sub-skill of python-docx: Common Issues.
Как установить скилл python-docx-common-issues?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python-docx-common-issues запускает скрипты?
Нет, скилл состоит только из инструкций (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