简体   繁体   中英

PowerPoint Add-In: Programatically publish Slide as Presentation

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 ie "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>)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM