ParagraphCollection module

class ParagraphCollection.ParagraphCollection

Bases: DocumentSubsetCollection, IParagraphCollection

Represents a collection of paragraphs in a document.

Add(paragraph: IParagraph) int

Adds a paragraph to the end of the collection.

Parameters:

paragraph – The paragraph to add.

Returns:

The index at which the paragraph was added.

Contains(paragraph: IParagraph) bool

Determines whether the collection contains a specific paragraph.

Parameters:

paragraph – The paragraph to check.

Returns:

True if the paragraph is found in the collection, False otherwise.

IndexOf(paragraph: IParagraph) int

Returns the zero-based index of the specified paragraph.

Parameters:

paragraph – The paragraph to find.

Returns:

The index of the paragraph, or -1 if it is not found.

Insert(index: int, paragraph: IParagraph)

Inserts a paragraph into the collection at the specified index.

Parameters:
  • index – The index at which to insert the paragraph.

  • paragraph – The paragraph to insert.

Remove(paragraph: IParagraph)

Removes the specified paragraph from the collection.

Parameters:

paragraph – The paragraph to remove.

RemoveAt(index: int)

Removes the paragraph at the specified index from the collection.

Parameters:

index – The index of the paragraph to remove.

get_Item(index: int) Paragraph

Gets the paragraph at the specified index.

Parameters:

index – The index of the paragraph.

Returns:

The paragraph at the specified index.