Dears at Aspose!
I am using Aspose.Slides for .net Version 14.10.0.0. I am using Visual Studio 2013 with .net 4.5 working on a Windows 7 PC.
I am loading an existing PowerPoint slide from disk and changing the data in the chart. All is fine except for one value with the wrong NumberFormat. Following is the code I use to reproduce the case and the example slide.
All labels are ok, except for the very first one. It has two values after the decimal point instead of one like the rest!
Thank you very much for your help!
int defaultWorksheetIndex = 0;
var templatePath = Path.Combine(“FOLDEROFTHETEMPLATE”, 2_saeulendiagramm_3year_5groups.pptx);
var pres = new Presentation(templatePath);
var slide = pres.Slides[0];
var chart = (from shape in reportSlide.Shapes
where shape is T && shape.AlternativeText == “diagramm”
select (IChart)shape).Single();
var fact = chart.ChartData.ChartDataWorkbook;
var series = chart.ChartData.Series;
fact.GetCell(defaultWorksheetIndex, 1, 0, “Modified Category 1”);
fact.GetCell(defaultWorksheetIndex, 2, 0, “Modified Category 2”);
fact.GetCell(defaultWorksheetIndex, 3, 0, “Modified Category 3”);
fact.GetCell(defaultWorksheetIndex, 4, 0, “Modified Category 4”);
fact.GetCell(defaultWorksheetIndex, 5, 0, “Modified Category 5”);
fact.GetCell(defaultWorksheetIndex, 0, 1, “New_Series1”);
fact.GetCell(defaultWorksheetIndex, 0, 2, “New_Series2”);
fact.GetCell(defaultWorksheetIndex, 0, 3, “New_Series3”);
var series0 = chart.ChartData.Series[0];
series0.DataPoints[0].Value.Data = 90.3M;
series0.DataPoints[1].Value.Data = 123.3M;
series0.DataPoints[2].Value.Data = 44.3M;
series0.DataPoints[3].Value.Data = 44.3M;
series0.DataPoints[4].Value.Data = 44.3M;
var series1 = chart.ChartData.Series[1];
series1.DataPoints[0].Value.Data = 51.3M;
series1.DataPoints[1].Value.Data = 152.3M;
series1.DataPoints[2].Value.Data = 69.3M;
series1.DataPoints[3].Value.Data = 69.3M;
series1.DataPoints[4].Value.Data = 69.3M;
var series2 = chart.ChartData.Series[2];
series2.DataPoints[0].Value.Data = 68.3M;
series2.DataPoints[1].Value.Data = 147.3M;
series2.DataPoints[2].Value.Data = 54.3M;
series2.DataPoints[3].Value.Data = 54.3M;
series2.DataPoints[4].Value.Data = 54.3M;
Presentation pres = new Presentation();
pres.Slides.AddClone(slide);
pres.Save(@“FORMATPROBLEM.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);