PersonCollection constructor

PersonCollection()

Initialize a new instance of the PersonCollection class.

def __init__(self):
    ...

PersonCollection(persons) {#person]}

def __init__(self, persons: Iterable[aspose.words.bibliography.Person]):
    ...
ParameterTypeDescription
personsIterable[Person]

PersonCollection(persons)

Initialize a new instance of the PersonCollection class.

def __init__(self, persons: List[aspose.words.bibliography.Person]):
    ...
ParameterTypeDescription
personsList[Person]

Examples

Shows how to work with person collection.

# Create a new person collection.
persons = aw.bibliography.PersonCollection()
person = aw.bibliography.Person('Roxanne', 'Brielle', 'Tejeda_updated')
# Add new person to the collection.
persons.add(person)
self.assertEqual(1, persons.count)
# Remove person from the collection if it exists.
if persons.contains(person):
    persons.remove(person)
self.assertEqual(0, persons.count)
# Create person collection with two persons.
persons = aw.bibliography.PersonCollection(persons=[aw.bibliography.Person('Roxanne_1', 'Brielle_1', 'Tejeda_1'), aw.bibliography.Person('Roxanne_2', 'Brielle_2', 'Tejeda_2')])
self.assertEqual(2, persons.count)
# Remove person from the collection by the index.
persons.remove_at(0)
self.assertEqual(1, persons.count)
# Remove all persons from the collection.
persons.clear()
self.assertEqual(0, persons.count)

See Also