# استخراج النص والصور من ملفات PPTX باستخدام Python

> Python شفرة المصدر لتحليل العرض التقديمي PPTX.

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



## استخراج نص من PPTX العرض التقديمي عبر Python

لمسح النص من العرض التقديمي بأكمله ، استخدم الأسلوب الثابت [GetAllTextFrames](https://reference.aspose.com/slides/python-net/aspose.slides.util/slideutil/) الذي تعرضه فئة SlideUtil. يقوم الكود أدناه بمسح النص ومعلومات التنسيق من العرض التقديمي ، بما في ذلك الشرائح الرئيسية.

### استخراج نص من PPTX عرض تقديمي باستخدام Python

```py

import aspose.slides as slides

#Instatiate Presentation class that represents a PPTX file
with slides.Presentation("pres.pptx") as pptxPresentation:
    # Get an Array of ITextFrame objects from all slides in the PPTX
    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)
```

## كيفية استخراج نص من PPTX عبر Python

هذه هي خطوات تحليل ملفات PPTX.

تحميل PPTX بمثيل عرض تقديمي

الحصول على صفيف من كائنات TextFrame من كل الشرائح في PPTX

حلقة خلال صفيف إطارات النص

تكرار الفقرات في TextFrame الحالي

تكرار خلال الأجزاء في الفقرة الحالية

احصل على نص في الجزء الحالي

## تنسيقات التحليل المدعومة الأخرى
