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

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

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



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

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

### استخراج نص من PPT عرض تقديمي باستخدام 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)
```

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

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

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

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

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

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

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

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

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