Dear,
I’m using aspose.slide version 7.1 to create a .pptx presentation. I am adding a ClustoredColumn chart to my presentation. When I add custom legends to the columns, open the presentation and try to save it, it crashes. Please find bellow the code I am using:
{
SlideEx sld = pres.Slides[0];
Aspose.Slides.Pptx.ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 100, 100, 400, 400);
chart.ChartTitle.Text.Text = “Sample Title”;
chart.ChartTitle.Text.CenterText = true;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;
ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
chart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, “C1”));
int Id = chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, “Series 1”), chart.Type);
ChartSeriesEx series = chart.ChartData.Series[Id];
series.Labels.ShowLeaderLines = true;
int defaultWorksheetIndex = 0;
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
for (int i = 0; i < 3; i++)
{
DataLabelEx lbl = new DataLabelEx(series);
lbl.TextFrame.Text = (i*10).ToString(); //<-- this line is causing the problem
lbl.Id = i;
series.Labels.Add(lbl);
}
}
When I run this code, I am able to generate the presentation and I can open it successfully. But if I try to change anything in the presentation and try to save, it crashes.
Thank you in advance,
Sami Simon