Hello,
I am trying to copy shapes from one master + layout slides in one presentation to another master + layout slides in another presentation. I am able to get the shapes in the same location (X, Y) co-ordinate as well as text / paragraph. What does not get copied is the TextStyles like Font/Size/Bullet style, etc. Can you please suggest how can I achieve that?
Here’s my code
private Presentation copyShapesInMaster(Presentation srcPres, Presentation applyToPres)
{
applyToPres.Masters[0].Shapes.Clear();
foreach (IShape shape in srcPres.Masters[0].Shapes)
{
applyToPres.Masters[0].Shapes.AddClone(shape);
}
foreach (ILayoutSlide layoutSlide in applyToPres.LayoutSlides)
{
layoutSlide.Shapes.Clear();
}
foreach (ILayoutSlide layoutSlide in srcPres.LayoutSlides)
{
var applyToLayoutSlide = applyToPres.LayoutSlides.GetByType(layoutSlide.LayoutType);
if (applyToLayoutSlide != null)
{
applyToLayoutSlide.ShowMasterShapes = layoutSlide.ShowMasterShapes;
foreach (IShape shape in layoutSlide.Shapes)
{
applyToLayoutSlide.Shapes.AddClone(shape);
}
}
}
return applyToPres;
}