5

Python を使用して、パワーポイント ファイルの各スライドのタイトルを取得しようとしています。Python でプレゼンテーション パッケージを使用していますが、タイトルを指定するものが見つかりませんでした。パワーポイント ファイルの内容を返すこのコードがあります。タイトルを指定する必要があります。

from pptx import Presentation

prs = Presentation("pp.pptx")

# text_runs will be populated with a list of strings,
# one for each text run in presentation
text_runs = []

for slide in prs.slides:
    for shape in slide.shapes:
        if not shape.has_text_frame:
            continue
        for paragraph in shape.text_frame.paragraphs:
            for run in paragraph.runs:
                text_runs.append(run.text)
4

2 に答える 2