开发者

PowerPoint Add-In: Programatically publish Slide as Presentation

开发者 https://www.devze.com 2023-03-23 17:37 出处:网络
I\'m iterating all the slides in a Presentation from with our PowerPoint Add-In and I want to publish every slide in the slide collection to a location BUT I want to be able to specify the name the sl

I'm iterating all the slides in a Presentation from with our PowerPoint Add-In and I want to publish every slide in the slide collection to a location BUT I want to be able to specify the name the slide should be published as.

What I've tested so far is the following with a Presentation named Presentation1.pptx

foreach (Microsoft.Office.Interop.PowerPoint.Slide slide in presentation.Slides){
   // Attempt 1
   slide.Name = slide.SlideNumber.ToString();
   slide.Publish(<location>); //Saves the slide as Presentation1_001.pptx

   // Attempt 2
   slide.Publish(<location>); //Saves the slide as Presentation1_001.pptx

   // Expected result
   slide.Publish(<location>); // Saves the slide as N.pptx where N is slide.SlideNumber
}

Since it saves the Slide as the presentation name I thought that I could change the name of the presentation but the property is read-only. Using slide.Export wont work since that will only work with graphic filters i.e. "png"

Any one know if this is possible, if so how do one do it?

Note: Sure I could just rename the saved files afterwards, rather I don't want to do that.

Help开发者_高级运维 much appreciated!

EDIT: I found the solution to my problem. The following line will do the trick

presentation.Slides[slide.SlideIndex].Export(<location>)


I found the solution to my problem. This line will do the trick.

presentation.Slides[slide.SlideIndex].Export(<path>)
0

精彩评论

暂无评论...
验证码 换一张
取 消