# Python을 사용하여 ODP 파일에서 텍스트 및 이미지 추출

> ODP 프레젠테이션을 구문 분석하기 위한 Python 소스 코드입니다.

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



## Python을 통해 ODP 프레젠테이션에서 텍스트 추출

전체 프레젠테이션에서 텍스트를 스캔하려면 SlideUtil 클래스에 의해 노출된 [GetAllTextFrames](https://reference.aspose.com/slides/python-net/aspose.slides.util/slideutil/) 정적 메서드를 사용합니다. 아래 코드는 마스터 슬라이드를 포함하여 프레젠테이션의 텍스트 및 서식 정보를 스캔합니다.

### Python을 사용하여 ODP 프레젠테이션에서 텍스트 추출

```py

import aspose.slides as slides

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

## Python을 통해 ODP에서 텍스트를 추출하는 방법

다음은 ODP 파일을 구문 분석하는 단계입니다.

프레젠테이션 인스턴스로 ODP 로드

ODP의 모든 슬라이드에서 TextFrame 개체의 배열을 가져옵니다.

TextFrame 배열을 통해 반복

현재 TextFrame에서 단락 반복

현재 단락의 부분을 반복합니다.

현재 부분에서 텍스트 가져오기

## 기타 지원되는 구문 분석 형식
