When doing a Shapes.AddClone of a chart type, the return object in some cases is different from the object we are cloning. returns a pictureframe object.
Here are all the ChartTypes that are returning a PictureFrame object type when cloned.
Treemap, Sunburst, Histogram, BoxAndWhisker, Waterfall, Funnel, Map
using Aspose.Slides.Net - version 22.7
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
StringBuilder sbInvalidCharts = new StringBuilder();
Presentation presentation = new Presentation();
ISlide slides = presentation.Slides[0];
foreach (ChartType _charttype in Enum.GetValues(typeof(ChartType)))
{
try
{
IChart tmpchart = slides.Shapes.AddChart(_charttype, 100, 100, 400, 400);
IShape cloneShape = slides.Shapes.AddClone(tmpchart);
if (cloneShape.GetType() != typeof(Aspose.Slides.Charts.Chart))
{
sbInvalidCharts.AppendLine($"{_charttype.ToString()} {cloneShape.GetType()}");
}
}
catch (Exception ex)
{
var error = ex.Message;
continue;
}
}
textBox1.Text = (sbInvalidCharts.ToString());
}