Free Support Forum - aspose.com

IChartDataCell.PresetNumberFormat stopped working in 18.3 (Slides.net)

I have the same exact chart in 2 different version of Aspose.Slides.dll (17.7 and 18.3). Both use this code snippet to set the PresetNumberFormat for an IChartDataCell:


IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn,10.0, 10.0, 375, 230);

IChartDataWorkbook wb = chart.ChartData.ChartDataWorkbook;
IChartDataCell _cell = wb.GetCell(0, 0, 1);
_cell.PresetNumberFormat = Convert.ToByte(5);

18.3.png (2.8 KB)
17.7.png (3.4 KB)

…as you can see from the screen shots attached, the chart in Version 17.7 formats the chart correctly. The Version 18.3 chart does not.
Tried several workarounds, but none worked. Pls advise…

@Dork.Scott,

I have observed the two comparison images shared by you and request you to please provide a working sample code to generate the chart along with source presentation (if used) so that we may use that to generate the chart and help you further in this regard.

Before sharing the information with us, I suggest you to please visit this API reference link for PresetNumberFormat enumerator values.

When you use 5 as PresetNumberFormat value, it means you are using, “$#,##0;$-#,##0” format and Aspose.Slides for .NET 18.3 is rightly showing the values.It may be a bug in 17.7 version. For percentage, you need to set 10 as PresetNumberFormat value.

Yes I know. I mistakenly changed in to 5 for copy/paste of code. It is not working for EITHER.
With setting it to either 5 or 10, the chart looks exactly the same.

@Dork.Scott,

I have observed your comments. Can you please provide a working sample code to generate the chart along with source presentation (if used) so that we may use that to generate the chart and help you further in this regard.

Never mind about this. Seems as though changing the PresetNumberFormat works differently in version 17.7 than in 18.3, but I found a workaround (had to set it again in a different area of my code) and now all is right with the world.

Thanks anyway.

@Dork.Scott,

It’s good to listen that things are sorted on your end. Please share, if we may help you further in this regard.