reportlab-styles
यह क्या करती है
यह स्किल बताती है कि ReportLab लाइब्रेरी के तैयार पैराग्राफ़ स्टाइल PDF में कैसे इस्तेमाल करें। यह उन लोगों के लिए है जो Python से PDF दस्तावेज़ बनाते हैं और स्टाइल की एरर से परेशान होते हैं।
कब इस्तेमाल करें
- ✓जब ReportLab स्क्रिप्ट किसी पैराग्राफ़ स्टाइल नाम पर KeyError दे।
- ✓जब आप शीर्षक और मुख्य टेक्स्ट को हाथ से नए स्टाइल नाम बनाए बिना स्टाइल करना चाहें।
- ✓जब आप PDF रिपोर्ट बनाएँ और नमूना स्टाइल का मानक रूप चाहें।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/reportlab-styles/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी ReportLab स्क्रिप्ट स्टाइल पर KeyError के साथ क्रैश हो रही है। अंतर्निहित स्टाइल इस्तेमाल करके इसे ठीक कीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट ReportLab से नमूना स्टाइलशीट लेता है और मौजूदा स्टाइल नाम जैसे Title, Heading1 और Normal इस्तेमाल करता है। वह ऐसा नया स्टाइल नहीं बनाता जिसका नाम शीट में पहले से हो।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
ReportLab Pre-Defined Styles Reference
Overview
ReportLab's reportlab.lib.styles.getSampleStyleSheet() provides a collection of pre-defined paragraph styles. Use these existing styles rather than redefining them to avoid KeyError exceptions.
Available Pre-Defined Styles
The standard stylesheet includes these commonly-used styles:
| Style Name | Purpose |
|---|---|
Normal |
Default body text |
Title |
Document title (large, bold) |
Heading1 |
Level 1 section heading |
Heading2 |
Level 2 section heading |
Heading3 |
Level 3 section heading |
Heading4 |
Level 4 section heading |
Heading5 |
Level 5 section heading |
Heading6 |
Level 6 section heading |
Bullet |
Bulleted list items |
Definition |
Definition list terms |
Italic |
Italicized text |
Code |
Monospace code text |
Correct Usage Pattern
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph
# Get the stylesheet
styles = getSampleStyleSheet()
# Use existing styles directly (CORRECT)
title = Paragraph("My Document Title", styles['Title'])
heading = Paragraph("Section Header", styles['Heading1'])
body = Paragraph("Regular text content", styles['Normal'])
Common Mistake to Avoid
# WRONG - Don't redefine existing style names
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
styles = getSampleStyleSheet()
# This will cause KeyError when you try to use 'Title' later
styles.add(ParagraphStyle(
name='Title', # Overwrites the pre-defined 'Title' style
fontSize=24,
# ... incomplete definition
))
# Later code expecting the full 'Title' style will fail
paragraph = Paragraph("Title Text", styles['Title']) # KeyError!
Best Practices
- Use existing styles as-is when they meet your needs
- Create new style names for custom styles (e.g.,
MyCustomTitle,CustomHeading) - Base custom styles on existing ones when you need modifications:
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
styles = getSampleStyleSheet()
# Create a NEW style with a unique name
custom_title = ParagraphStyle(
name='CustomTitle', # Unique name, doesn't conflict
parent=styles['Title'], # Base it on existing Title
fontSize=28,
spaceAfter=30
)
styles.add(custom_title)
# Now both styles are available
styles['Title'] # Original pre-defined style
styles['CustomTitle'] # Your custom variant
Quick Reference Checklist
- Import
getSampleStyleSheet()fromreportlab.lib.styles - Call
styles = getSampleStyleSheet()once at the start - Access styles via
styles['StyleName'](case-sensitive) - Do NOT add styles with names that already exist in the stylesheet
- Use unique names for any custom styles you create
- Common available styles:
Normal,Title,Heading1-6,Bullet,Code,Italic
अक्सर पूछे जाने वाले सवाल
कौन से स्टाइल पहले से मौजूद हैं?
स्किल Normal, Title, Heading1 से Heading6, Bullet, Definition, Italic और Code सूचीबद्ध करती है।
KeyError किस वजह से आता है?
स्किल बताती है कि यह एरर मौजूदा स्टाइल नाम को दोबारा परिभाषित करने से आता है, इसलिए समाधान है अंतर्निहित नाम इस्तेमाल करना।
क्या मेरे डिज़ाइन के लिए नया स्टाइल चाहिए?
स्किल सुझाती है कि पहले मौजूदा स्टाइल इस्तेमाल करें, और नए स्टाइल सिर्फ़ अलग नाम के साथ जोड़ें।
जानकारी
लेखक का मूल विवरण
Use reportlab's pre-defined styles from getSampleStyleSheet() correctly
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12970
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।