Exemplo n.º 1
0
        public static SlidePart CloneSlide(this SlidePart templatePart)
        {
            // find the presentationPart: makes the API more fluent
            var presentationPart = templatePart.GetParentParts()
                                   .OfType <PresentationPart>()
                                   .Single();

            // clone slide contents
            Slide currentSlide   = (Slide)templatePart.Slide.CloneNode(true);
            var   slidePartClone = presentationPart.AddNewPart <SlidePart>();

            currentSlide.Save(slidePartClone);

            // copy layout part
            slidePartClone.AddPart(templatePart.SlideLayoutPart);

            return(slidePartClone);
        }