---
Product: Aspose.Slides
Platform: java
Page Type: reference
Canonical URL: https://reference.aspose.org/slides/java/paragraphcollection
---

# ParagraphCollection

## Overview

`ParagraphCollection` is a class in Aspose.Slides FOSS for Java.
Inherits from: `BaseCollection<IParagraph>`, `IParagraphCollection`, `ISlideComponent`, and 1 more.

Represents a collection of paragraphs.

This class declares 22 methods for ParagraphCollection objects in Java programs.
Available methods include: `ParagraphCollection`, `add`, `asIEnumerable`, `asIPresentationComponent`, `asISlideComponent`, `clear`, `contains`, `count`, `get`, `getParagraphs`, `getPresentation`, `getSlide`, and 8 additional methods.
Public members are accessible to any Java application after installing the Aspose.Slides FOSS for Java package.
Properties: `paragraphs`, `presentation`, `readOnly`, `slide`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `paragraphs` | `List<IParagraph>` | Read | Builds and returns the list of paragraphs. |
| `readOnly` | `boolean` | Read | Gets the read only. |
| `slide` | `IBaseSlide` | Read | Gets the slide. |
| `presentation` | `IPresentation` | Read | Gets the presentation. |

## Methods

| Signature | Description |
|-----------|-------------|
| `ParagraphCollection()` | Creates an empty ParagraphCollection. |
| `ParagraphCollection(paragraphs: List<IParagraph>)` | Creates a ParagraphCollection with the given initial paragraphs. |
| `initInternal(txbodyElement: Element, slidePart: Object, parentSlide: IBaseSlide)` → `ParagraphCollection` | Initialises this collection from an OOXML text-body element. |
| `initInternal(txbodyElement: Element, slidePart: Object, parentSlide: IBaseSlide, saveCallback: Runnable)` → `ParagraphCollection` | Initialises this collection from an OOXML text-body element, with a callback to invoke after every mutation. |
| `getParagraphs()` → `List<IParagraph>` | Builds and returns the list of paragraphs. |
| `get(index: int)` → `IParagraph` | Calls get(index) on this ParagraphCollection instance. |
| `size()` → `int` | Calls size on this ParagraphCollection instance. |
| `count()` → `int` | Returns the number of paragraphs (alias of size) |
| `isReadOnly()` → `boolean` | Returns true if read only is set. |
| `asISlideComponent()` → `ISlideComponent` | Returns the collection as an ISlideComponent |
| `asIEnumerable()` → `Iterable<IParagraph>` | Returns an Iterable over the paragraphs |
| `asIPresentationComponent()` → `IPresentationComponent` | Returns the collection as an IPresentationComponent |
| `getSlide()` → `IBaseSlide` | Returns the slide. |
| `getPresentation()` → `IPresentation` | Returns the presentation. |
| `add(value: IParagraph)` | Appends a paragraph to the end of the collection |
| `insert(index: int, value: IParagraph)` | Calls insert(index, value) on this ParagraphCollection instance. |
| `indexOf(item: IParagraph)` → `int` | Returns the index of the given paragraph or -1 if absent |
| `contains(item: IParagraph)` → `boolean` | Returns true if the collection includes the specified paragraph |
| `clear()` | {@inheritDoc} * 

The collection can be emptied: a text body with no paragraph is not valid, but the empty paragraph that keeps it valid is put in at serialization time — see {@link org.aspose.slides.foss.internal.pptx.TextBodies}. |
| `removeAt(index: int)` | Removes the paragraph at the given index |
| `remove(item: IParagraph)` → `boolean` | Deletes the specified paragraph and returns success status |
| `iterator()` → `Iterator<IParagraph>` | Provides an iterator over the paragraphs |

## See Also

- [Aspose.Slides — Enterprise API Reference](https://reference.aspose.com/slides/)