1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

python-pptxのマニュアルにはない何気にニッチなスライドの削除

Last updated at Posted at 2021-04-14

python-pptxのマニュアルにはない何気にニッチなスライドの削除は以下でできるはずです。
 スライドのリスト作成
 →プレゼンテーションとスライドとの関連削除
 →スライドの削除 という流れ

〜とスライド2枚目(ページ1)のスライド削除〜

※prs等を定義

xml_slides = prs.slides._sldIdLst
slides = list(xml_slides)

rId = prs.slides.sldIdLst[1].rId
prs.part.drop_rel(rId)

xml_slides.remove(slides[1])

※prs.save(prsのパス)

〜もしくは関数としてスライド2枚目(ページ1)のスライド削除〜

delete_slide(presentation, index)
xml_slides = presentation.slides._sldIdLst
slides = list(xml_slides)
rId = presentation.slides.sldIdLst[index].rId
presentation.part.drop_rel(rId)
xml_slides.remove(slides[index])

※prs等を定義

delete_slide(prs, 1)

※prs.save(prsのパス)

shiracamusさんありがとうございます😊

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?