Using Aspose.Slides.dll for .Net 4.0 Framework version 7.3.0.0
Created initial PPTX file with PowerPoint 2010.
Steps to recreate error:
Create a pptx or pptm file in powerpoint with 1 or more slides.
Add a Chart (a bar chart for example) to the slide.
-Use a native powerpoint chart. Just insert a chart and use the dummy data powerpoint provides.
-Not an OLE Chart Object
-Not a chart created in excel with its data linked to the excel sheet.
Now try to make a copy of the slide using:
SlideExCollection slides = pres.Slides;
slides.AddClone[pres.Slides[0]];
Save the file.
When opening up the output file you will get a “Repair” question, as the file is corrupt.
From my tests it appears that the AddClone and InsertClone functions work to make a copy of all types of slides except for slides that contain native powerpoint charts. It will work on slides with charts as OLE object charts and charts that have their source linked to an external excel file.
To direct attention to a possible fix I believe that the AddClone function may not be properly copying all of the data parts/paragraphs in the xml for the chart.
Detailed code example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using Aspose.Slides;
using Aspose.Slides.Pptx;
using Aspose.Slides.Pptx.Charts;
using Aspose.Slides.Effects;
using Aspose.Slides.Export;
using Aspose.Slides.Import;
using Aspose.Slides.Odp;
using Aspose.Slides.Util;
using Aspose.Slides.Warnings;
namespace AsposeBug {
static class Program {
///
/// The main entry point for the application.
///
[STAThread]
static void Main() {
Assembly assembly;
Version ver;
//powerpoint
Aspose.Slides.License lic = new Aspose.Slides.License();
lic.SetLicense(“Aspose.Total.lic”);
Console.WriteLine("\nPowerPoint Components Registered");
assembly = Assembly.LoadFrom(“Aspose.Slides.dll”);
ver = assembly.GetName().Version;
Console.WriteLine("Version: " + ver);
PresentationEx pres = new PresentationEx(“Presentation1.pptx”);
SlideExCollection slides = pres.Slides;
slides.AddClone(pres.Slides[0]);
pres.Save(“Presentation2.pptx”, SaveFormat.Pptx);
}
}
}