最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python-pptx - Getting an unwanted slide at the start when using a custom template - Stack Overflow

programmeradmin1浏览0评论

The company I work for has a standard PowerPoint template. I'm trying to use this template with python-pptx. However, I'm getting an unwanted slide at the start of my slide deck and I can't figure out what I'm doing wrong.

My first attempt was a simple:

prs = Presentation('companyTemplate.potx')

but this gave several errors.

I then read the manual (yeah, I know) and realized I should have converted the .potx file into a standard PowerPoint .pptx file.

My second attempt was:

prs = Presentation('companyTemplate.pptx')

This worked but my desired PowerPoint slide deck had the entire template PowerPoint at the start.

At this point, I created a new, blank, PowerPoint using the default PowerPoint template and switched to Slide Master view.

  • I then opened the companyTemplate PowerPoint
  • Switched to Slide Master view in the companyTemplate PowerPoint
  • Copied the first "slide" in this Slide Master view to the open, blank, PowerPoint.
  • Deleted the original Slide Master from the new, blank, PowerPoint
  • Closed the Slide Master view
  • Saved this newly-modified PowerPoint as my new companyTemplate.pptx file.

This works but, as noted at the start, I'm getting a single unwanted slide at the start of my desired slide deck.

It's easy enough to delete this unwanted slide but I'd like to keep it from appearing in the first place.

When I use the default presentation in python-pptx, I don't get an unwanted slide at the start, so I figure there has to be a way to do what I want. I just can't figure out how.

For what it's worth, the unwanted slide is the last "slide" in Slide Master view, and is labeled "Blank". It's also the slide that appears if I open my own personal companyTemplate.pptx PowerPoint file.

The company I work for has a standard PowerPoint template. I'm trying to use this template with python-pptx. However, I'm getting an unwanted slide at the start of my slide deck and I can't figure out what I'm doing wrong.

My first attempt was a simple:

prs = Presentation('companyTemplate.potx')

but this gave several errors.

I then read the manual (yeah, I know) and realized I should have converted the .potx file into a standard PowerPoint .pptx file.

My second attempt was:

prs = Presentation('companyTemplate.pptx')

This worked but my desired PowerPoint slide deck had the entire template PowerPoint at the start.

At this point, I created a new, blank, PowerPoint using the default PowerPoint template and switched to Slide Master view.

  • I then opened the companyTemplate PowerPoint
  • Switched to Slide Master view in the companyTemplate PowerPoint
  • Copied the first "slide" in this Slide Master view to the open, blank, PowerPoint.
  • Deleted the original Slide Master from the new, blank, PowerPoint
  • Closed the Slide Master view
  • Saved this newly-modified PowerPoint as my new companyTemplate.pptx file.

This works but, as noted at the start, I'm getting a single unwanted slide at the start of my desired slide deck.

It's easy enough to delete this unwanted slide but I'd like to keep it from appearing in the first place.

When I use the default presentation in python-pptx, I don't get an unwanted slide at the start, so I figure there has to be a way to do what I want. I just can't figure out how.

For what it's worth, the unwanted slide is the last "slide" in Slide Master view, and is labeled "Blank". It's also the slide that appears if I open my own personal companyTemplate.pptx PowerPoint file.

Share asked Mar 3 at 21:36 BobInBaltimoreBobInBaltimore 4675 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I figured out the problem.

It was a classic "User Error" issue. I still had one (blank) slide left in the PowerPoint template file. That's what was showing up as the unwanted slide at the start of the slide deck.

Once I deleted that blank slide, so that all the PowerPoint template file had was the Slide Master (but no actual slides), everything worked as expected.

发布评论

评论列表(0)

  1. 暂无评论