我正在开发一个Powerpoint插件,它有助于创建议程幻灯片。我必须在一个特定的位置插入一张幻灯片,这很容易使用presentation.Slides.AddSlide(索引,自定义布局)。但是,由于我也在使用区段,所以这总是在第一个(默认)部分中插入幻灯片。
这里是一个示例结构。我想在第1页的当前位置替换它。为此,我需要在slideIndex=2插入一个幻灯片,但就目前的情况而言,幻灯片将在“标题页”下面结束。
下面是一些我正在使用的代码
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;
}发布于 2017-03-23 14:10:26
我通过更改操作顺序并在当前的index+1中添加操作来解决这个问题。
int tempindex = currentSlide.SlideIndex;
int tempSectionIndex = currentSlide.sectionIndex;
PPT.Slide newSlide = presentation.Slides.AddSlide(tempindex + 1, customAgendaLayout);
currentSlide.Delete();
return newSlide;https://stackoverflow.com/questions/42928261
复制相似问题