Get layout by name

I’m new to Aspose slides and so far have found it to be exactly what I’ve been looking for - looks great!

I’ve been digging through the excellent documentation and examples and learning to build up a simple presentation in C#.NET. For my first question:

Is it possible to get a layout slide by name? I haven’t been able to locate this capability in the documentation yet. For example:

ILayoutSlide myLayout = presentation.Masters[0].LayoutSlides.Add(SlideLayoutType.Custom, "MyLayoutName");


ISlide slide = presentation.Slides.AddEmptySlide(presentation.LayoutSlides.GetByName("MyLayoutName"));

Thanks for any thoughts on this.

-Mark R.

Hi Mark R,

I have observed your comments and like to request you ro please try using below sample code on your side to serve the purpose and then share your kind feedback with us.

Presentation pres = new Presentation();

ILayoutSlide layoutSlide;
ISlideCollection slds = pres.Slides;

ILayoutSlide myLayout = pres.Masters[0].LayoutSlides.Add(SlideLayoutType.Custom, "MyLayoutName");
IMasterLayoutSlideCollection layoutSlides = pres.Masters[0].LayoutSlides;

foreach (ILayoutSlide Layout in layoutSlides)
    if (Layout.Name == "MyLayoutName")
        layoutSlide = Layout;

pres.Save(@"D:\LayoutName_16.3.0.pptx", SaveFormat.Pptx);

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Yes, Ahmad, it works perfectly - exactly as you show (I just changed D: to C: for my hard drive).

Thank you very much for your quick response!

-Mark R.