# Extraheer tekst en afbeeldingen uit PPT-bestanden met behulp van Python

> Python broncode om PPT presentatie te ontleden.

Source: https://products.aspose.com/slides/nl/python-net/parser/ppt/
Updated: 2023-05-01



## Extraheer tekst uit PPT presentatie via Python

Gebruik de statische methode [GetAllTextFrames](https://reference.aspose.com/slides/python-net/aspose.slides.util/slideutil/) die wordt weergegeven door de klasse SlideUtil om de tekst van de hele presentatie te scannen. De onderstaande code scant de tekst en opmaakinformatie van een presentatie, inclusief de basisdia's.

### Tekst extraheren uit PPT-presentatie met behulp van Python

```py

import aspose.slides as slides

#Instatiate Presentation class that represents a PPT file
with slides.Presentation("pres.ppt") as pptxPresentation:
    # Get an Array of ITextFrame objects from all slides in the PPT
    textFramesPPTX = slides.util.SlideUtil.get_all_text_frames(pptxPresentation, True)

    # Loop through the Array of TextFrames
    for i in range(len(textFramesPPTX)):
	    # Loop through paragraphs in current ITextFrame
        for para in textFramesPPTX[i].paragraphs:
            # Loop through portions in the current IParagraph
            for port in para.portions:
			    # Display text in the current portion
                print(port.text)

    			# Display font height of the text
                print(port.portion_format.font_height)

			    # Display font name of the text
                if port.portion_format.latin_font != None:
                    print(port.portion_format.latin_font.font_name)
```

## Tekst extraheren uit PPT via Python

Dit zijn de stappen om PPT bestanden te parseren.

Laad PPT met een instantie van Presentation

Krijg een reeks TextFrame-objecten van alle dia's in de PPT

Loop door de array van TextFrames

Doorloop alinea's in het huidige TextFrame

Doorloop gedeelten in de huidige alinea

Krijg tekst in het huidige gedeelte

## Andere ondersteunde ontleedformaten
