Free Support Forum - aspose.com

Wrong chart when cloning a slide

Hi, we are cloning a slide containing a chart from a presentation to another one.

var p1 = new Presentation("Presentation1.pptx");
var p2 = new Presentation("Presentation2.pptx");
foreach (var sl in p1.Slides)
{
    p2.Slides.InsertClone(p2.Slides.Count, sl);
}
p2.Save("Presentation2.pptx");

We used the previous code and found this issue: the chart in Presentation1 does not have leading lines, but the cloned one in Presentation2 does.

Is there a way to fix this issue?

Attached the presentations for test. Attachments.zip (1.6 MB)

@davidepedrocca,

The sample code that you have shared has syntax error while saving. Please try using following sample code as I have not found any missing chart in cloned presentation.

		public static void testCloningIssue()
        {
			String path = @"C:\Users\mudas\Downloads\Attachments\";
			var p1 = new Presentation(path+"Presentation1.pptx");
			var p2 = new Presentation();
			p2.SlideSize.SetSize(p1.SlideSize.Size.Width, p1.SlideSize.Size.Height, SlideSizeScaleType.EnsureFit);
			foreach (var sl in p1.Slides)
			{
				p2.Slides.InsertClone(p2.Slides.Count, sl);
			}
			p2.Slides.RemoveAt(0);
			p2.Save(path+"Presentation2.pptx",SaveFormat.Pptx);
		}

Presentation2.zip (855.9 KB)

Sorry for the syntax error. This is the fixed code.

var p1 = new Presentation("Presentation1.pptx");
var p2 = new Presentation("Presentation2.pptx");
foreach (var sl in p1.Slides)
{
    p2.Slides.InsertClone(p2.Slides.Count, sl);
}
p2.Save("Presentation2.pptx", SaveFormat.Pptx);

However the issue is reproducible also with your code.

This image explains better what is the issue. PowerPointIssue.png (56.6 KB)

@davidepedrocca,

I have created a ticket with ID SLIDESNET-42116 in our issue tracking system to address the issue related to labels in cloned presentation. We will share the feedback with you as soon as the issue will be fixed.

The issues you have found earlier (filed as SLIDESNET-42116) have been fixed in this update.