A Portion is the smallest independently-formatted unit of text. Every Paragraph contains one or more Portion objects; each portion carries its own PortionFormat (font size, bold, colour, etc.).
Package: aspose.slides_foss
Portion
Constructor
Properties
| Property | Type | Access | Description |
|---|
text | str | Read/Write | Plain text content of this portion. Setting this writes to the underlying <a:t> element and persists immediately. |
portion_format | PortionFormat | Read | Character-level formatting for this portion. All format properties are explicitly set (no inheritance applied). |
slide | IBaseSlide | Read | The slide that contains this portion. |
presentation | IPresentation | Read | The presentation that contains this portion. |
PortionFormat
Access via portion.portion_format. All properties are explicitly set — NOT_DEFINED means inherit from the parent paragraph’s default portion format.
Font Properties
| Property | Type | Description |
|---|
font_height | float | Font size in points. NaN = inherit. |
latin_font | FontData | Western (Latin) typeface. Assign FontData("Arial"). |
east_asian_font | FontData | East Asian typeface. |
complex_script_font | FontData | Complex-script (RTL, Indic) typeface. |
Style Flags (NullableBool)
| Property | Description |
|---|
font_bold | Bold. NullableBool.TRUE / FALSE / NOT_DEFINED. |
font_italic | Italic. |
font_strike_through | Strikethrough (legacy alias). |
font_caps | All-caps rendering. |
font_small_caps | Small-caps rendering. |
Underline
| Property | Type | Description |
|---|
font_underline | TextUnderlineType | Underline style: NONE, SINGLE, DOUBLE, HEAVY, DOTTED, etc. |
underline_line_format | LineFormat | Line format for the underline stroke. |
underline_fill_format | FillFormat | Fill (colour) of the underline. |
Strikethrough
| Property | Type | Description |
|---|
strikethrough_type | TextStrikethroughType | NONE, SINGLE, DOUBLE. |
Colour and Fill
| Property | Type | Description |
|---|
fill_format | FillFormat | Text fill. Set fill_type = FillType.SOLID and solid_fill_color.color to colour the text. |
highlight_color | ColorFormat | Text highlight/background colour. |
Spacing
| Property | Type | Description |
|---|
spacing | float | Character spacing adjustment as a percentage of font size. |
kerning_minimal_size | float | Minimum font size at which kerning is applied, in points. |
Baseline
| Property | Type | Description |
|---|
escapement | int | Superscript/subscript offset as a percentage of the font height. Positive = superscript; negative = subscript. |
baseline | int | Synonym for escapement (older API name). |
Language
| Property | Type | Description |
|---|
language_id | str | BCP 47 language tag (e.g. "en-US", "fr-FR"). |
alternative_language_id | str | Alternative language for text rendering. |
Hyperlink
| Property | Type | Description |
|---|
hyperlink_click | IHyperlink | Click hyperlink. |
hyperlink_mouse_over | IHyperlink | Mouse-over hyperlink. |
hyperlink_manager | IHyperlinkManager | Helper object for adding and removing hyperlinks. |
PortionCollection
Collection of Portion objects inside a Paragraph. Access via paragraph.portions.
| Member | Signature | Description |
|---|
add | add(portion) | Append a Portion to the end of the paragraph. |
insert | insert(index, portion) | Insert a Portion at the given zero-based index. |
remove_at | remove_at(index) | Remove the portion at the given index. |
clear | clear() | Remove all portions from the paragraph. |
__getitem__ | portions[i] | Return the portion at zero-based index i. |
__len__ | len(portions) | Number of portions. |
__iter__ | for p in portions | Iterate portions in order. |
Usage Example
Mixed-format rich text in a single paragraph
See Also