A Paragraph is a block of text inside a TextFrame. Each paragraph owns a collection of Portion objects (character runs) and a ParagraphFormat that controls alignment, spacing, indentation, and bullets.
Package: aspose.slides_foss
Paragraph
Access via text_frame.paragraphs[i] or instantiate directly with Paragraph() to build new content.
Constructor
Properties
| Property | Type | Access | Description |
|---|
text | str | Read/Write | Plain text of all portions joined. Setting this replaces all portions with a single run. |
portions | PortionCollection | Read | Ordered collection of Portion objects. |
paragraph_format | ParagraphFormat | Read | Paragraph-level formatting (alignment, spacing, indent, bullet). |
slide | IBaseSlide | Read | The slide that contains this paragraph. |
presentation | IPresentation | Read | The presentation that contains this paragraph. |
ParagraphCollection
Collection of Paragraph objects inside a TextFrame. Access via text_frame.paragraphs.
| Member | Signature | Description |
|---|
add | add(paragraph) | Append a Paragraph to the end of the text frame. |
insert | insert(index, paragraph) | Insert a Paragraph at the given zero-based index. |
remove_at | remove_at(index) | Remove the paragraph at the given index. |
clear | clear() | Remove all paragraphs. |
__getitem__ | paragraphs[i] | Return the paragraph at zero-based index i. |
__len__ | len(paragraphs) | Number of paragraphs. |
__iter__ | for p in paragraphs | Iterate paragraphs in order. |
ParagraphFormat
Controls paragraph-level layout. Access via paragraph.paragraph_format.
All properties support NaN (Python float('nan')) to mean “not defined / inherit from parent”.
Alignment
| Property | Type | Description |
|---|
alignment | TextAlignment | Horizontal alignment: LEFT, CENTER, RIGHT, JUSTIFY, JUSTIFY_LOW, DISTRIBUTED, or NOT_DEFINED. |
font_alignment | FontAlignment | Vertical position of characters within a line: AUTOMATIC, TOP, CENTER, BOTTOM, BASELINE. |
Spacing
| Property | Type | Description |
|---|
space_within | float | Line spacing. Positive value = percentage of font size; negative = points. NaN = inherit. |
space_before | float | Space before the paragraph. Positive = % of font size; negative = points. NaN = inherit. |
space_after | float | Space after the paragraph. Same encoding as space_before. |
Indentation
| Property | Type | Description |
|---|
margin_left | float | Left margin in points. NaN = inherit. |
margin_right | float | Right margin in points. |
indent | float | First-line or hanging indent in points. Negative = hanging. |
default_tab_size | float | Default tab stop size in points. |
depth | int | Outline level / list depth (0 = top level). |
Flags (NullableBool)
| Property | Description |
|---|
east_asian_line_break | East Asian line-break rules. |
right_to_left | Right-to-left paragraph writing direction. |
latin_line_break | Latin line-break rules. |
hanging_punctuation | Allow punctuation to hang beyond the margin. |
Bullet and Default Format
| Property | Type | Description |
|---|
bullet | BulletFormat | Bullet and numbering settings for this paragraph. |
default_portion_format | PortionFormat | Default character formatting applied when a portion has no explicit format. |
BulletFormat
Access via paragraph.paragraph_format.bullet.
| Property | Type | Description |
|---|
type | BulletType | NONE, SYMBOL, NUMBERED, PICTURE. |
char | str | Bullet character when type = SYMBOL. |
color | ColorFormat | Bullet colour. |
font | FontData | Bullet font. |
font_height | float | Bullet size as a percentage of the text size (e.g., 100.0). |
numbered_bullet_style | NumberedBulletStyle | Numbering style when type = NUMBERED. |
numbered_bullet_start_with | int | Starting number for a numbered list. |
is_bullet_hard_color | NullableBool | Whether the bullet uses an explicit colour rather than inheriting from the text. |
is_bullet_hard_font | NullableBool | Whether the bullet uses an explicit font rather than inheriting. |
Usage Example
Multi-level bulleted list
Justified text with custom line spacing
See Also