Base (Private) Module: objects/_slideobject.py

Purpose:

This module provides the implementation for the SlideObject object.

Platform:

Linux/Windows | Python 3.10+

Developer:

J Berendt

Email:

development@s3dev.uk

Comments:

n/a

class SlideObject(pageno: int = 0, parser: object = None)[source]

Bases: object

This class provides the implementation for the SlideObject.

For each slide in a document (e.g. PowerPoint), an instance of this class is created, populated and appended into the PPTX document’s slides list attribute.

Parameters:
  • pageno (int, optional) – Page number. Defaults to 0.

  • parser (object, optional) – The underlying document parser object. Defaults to None.

Tip

To display the textual contents of a slide, simply call the following, where 42 is the slide to be displayed:

>>> print(*pptx.doc.slides[42].texts, sep='\n\n')
property content: str

Accessor to the textual content of a slide.

Returns:

A concatenated string for all text objects found on the slide; each object separated by a double-newline.

Return type:

str

property images: list

Accessor to a slide’s image objects.

property pageno: int

Accessor to the page number.

Note

This is the page number with regard to the page’s sequence in the overall document. This is not guaranteed to be the page’s number per the document’s page labeling scheme.

property parser: object

Accessor to the document parser’s internal functionality.

Note

The population of this property is determined by the document-type-specific docp parser. If the underlying parsing library has functionality worth preserving and making available to the user, it is stored to this property. Otherwise, this property will remain as None.

property tables: list

Accessor to a slide’s table objects.

property texts: list

Accessor to a slide’s text objects.