繁体   English   中英

Powerpoint VSTO如何将幻灯片插入部分

[英]Powerpoint VSTO how to insert slide into section

我正在开发一个Powerpoint插件,它有助于创建议程幻灯片。 我必须在特定位置插入一张幻灯片,使用presentation.Slides.AddSlide(index,customlayout)很容易。 但是由于我也在使用节,所以总是将幻灯片插入第一个(默认)节中。

这是一个示例结构。 我想将Page 1替换为当前位置。 为此,我需要在slideIndex = 2处插入一张幻灯片,但就目前而言,该幻灯片将最终显示在“标题页”下方。

  • 默认部分
    • 标题页
  • 第一节
    • 第1页
    • 第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;
    }

我设法通过更改操作顺序并将其添加到当前索引+1处来解决该问题。

    int tempindex = currentSlide.SlideIndex;
    int tempSectionIndex = currentSlide.sectionIndex;
    PPT.Slide newSlide = presentation.Slides.AddSlide(tempindex + 1, customAgendaLayout);
    currentSlide.Delete();
    return newSlide;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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