I am working on a Powerpoint addin, that helps with creating agenda slides. I have to insert a slide at a specific location, which is easy using presentation.Slides.AddSlide(index, customlayout). But since I am also using sections, this always inserts the slide inside the first (default) section.
Here's an example structure. I would like to replace Page 1 at it 's current position. For this I would need to insert a slide at slideIndex=2, but as it stands now, the slide will end up below "Header Page".
- Default Section
- Header Page
- Section 1
- Page 1
- Page 2
And here is some code I am using
private static PPT.Slide RefreshDefaultAgendaFormat(PPT.Presentation presentation, PPT.CustomLayout customAgendaLayout, PPT.Slide currentSlide)
{
int tempindex = currentSlide.SlideIndex;
int tempSectionIndex = currentSlide.sectionIndex;
currentSlide.Delete();
currentSlide = presentation.Slides.AddSlide(tempindex, customAgendaLayout);
return currentSlide;
}