Hello,
forgive the question if it has already been asked, but I haven’t been able to find the answer if it exists.
I am using an older version of Aspose Slides and am wondering if there is an easier way with the newer versions to clone a slide that has multiple text frames (shapes), paragraphs and paragraph portions with different styling other than copying each paragraph and subsequent portion and then stitching them back together to make an exact clone?
It seems that this could have been achieved by now. Granted my company stopped paying for Aspose which is why we are stuck on an older version. If the argument is good enough then they may be convinced to start paying again.
@ericezee,
Thank you for your question.
With the new versions of Aspose.Slides, you can easily clone a slide with all its contents like this:
using var presentation = new Presentation("example.pptx");
var firstSlide = presentation.Slides[0];
// Clone the first slide and add the clone to the end.
presentation.Slides.AddClone(firstSlide);
Documents: Clone Slides
API Reference: AddClone methods
@Andrey_Potapov,
Thanks for your response. Just to clarify, and I should have put this in my original question. But, are you saying that the AddClone() method now supports the exact “cloning” of a slide?
We are currently doing it like the following snippet, but if a text frame has a paragraph with multiple portions it is applying the styling from the first portion to all portions in the paragraph. If the paragraph starts with red, bold, 18 pt font and the rest of the paragraph is regular, black, 14 pt font it makes the entire paragraph red, bold, 18 pt.
foreach (ISlide slide in pptAttachment.Slides)
{
IMasterSlide sourceMasterSlide = slide.LayoutSlide.MasterSlide;
IMasterSlide destMasterSlide = pptxDoc.Masters.AddClone(sourceMasterSlide);
pptxDoc.Slides.AddClone(slide, destMasterSlide, true);
}
pptAttachment is the source Presentation
pptxDoc is the destination Presentation
@ericezee,
Thank you for the additional information. You can test your results using the latest version of Aspose.Slides in evaluation mode. If the issue persists, please share the following data and information:
- input and output presentation files (you can zip the files and upload them here)
- Aspose.Slides version you used