PPT PPTX ODP POT ppsx
Aspose.Slides  for Python via .NET
ODP

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

서버 측 API를 사용하여 PowerPoint에서 텍스트, 이미지, 비디오 및 오디오 파일을 추출하기 위한 고유한 Python 앱을 빌드하세요.

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

전체 프레젠테이션에서 텍스트를 스캔하려면 SlideUtil 클래스에 의해 노출된 GetAllTextFrames 정적 메서드를 사용합니다. 아래 코드는 마스터 슬라이드를 포함하여 프레젠테이션의 텍스트 및 서식 정보를 스캔합니다.

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


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 파일을 구문 분석하는 단계입니다.

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

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

  3. TextFrame 배열을 통해 반복

  4. 현재 TextFrame에서 단락 반복

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

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

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

Python을(를) 사용하여 다음 형식도 스캔할 수 있습니다.