Cloning slide not copying master slide

Hi

When I cloned a slide from one presentation to another presentation, it copied the slide without the master slide. Because of this, I am not able to apply the master slide of the first presentation to the second presentation.

The following code snippet is used to clone the slide and change the master,

Slide clonedSlide = masterTemplate.CloneSlide(masterTemplate.GetSlideByPosition(1), presentation.Slides.LastSlidePosition + 1, presentation, sList);
Slide masterSlide = presentation.GetSlideById(clonedSlide.MasterId);
foreach (Slide slide in presentation.Slides)
{
slide.ChangeMaster(masterSlide);
}

I have attached the master template for which I am getting this issue. Please help me to resolve this issue.

Thanks
Vijay

Hello Vijay,

Most probably you didn’t create new separate sList object for this source/target pair of presentations.

Alexey Zhilin,

You are correct. Using a new SortedList object, solves this issue.

Thanks
Vijay