Free Support Forum - aspose.com

Percentage Data in Data Sheet

Hi,

I am using MSO charts. and i am trying to make the excel data sheet cell as "percentage" instead of "general" which is by default.

The solution which you provided shows the

chartObj.ValueAxis.NumberFormat = "0%"

But when we check the data in excel sheet it is like ".6", ".7" But we wants these values to be like "60%","70%".In excel sheet if we put data like ".6" , ".7" and then convert the cell type as Percentage. It will automatically convert them into "60%","70%". I need same kind of functionality. Instead of setting the tick lavel value as Percentage.

Please let me know how we can achieve this.

Thanks,

Amit

Hi Amit,


I have worked over the requirements shared by you. Can you please try using the following option on your end.

chartObj.ValueAxis.NumberFormat = "0.0%"

Please share, if I may help you further in this regard.

Many Thanks,

Hi,

Thanks for your response.

The solution which you provided shows the value axis in "%" but i am looking to change the data in excel sheet. It should change the data in the excel sheet not only on value axis.

In your solution when we check the data in excel sheet it is like ".6", ".7" But we wants these values to be like "60%","70%".In excel sheet if we put data like ".6" , ".7" and then convert the cell type as Percentage. It will automatically convert them into "60%","70%". I need same kind of functionality. Instead of setting the tick lavel value as Percentage.

Hi Amit,


I have observed your requirement in detail and like to share that the feature for setting the number format for chart data cells is not available in Aspose.Slides charts at the moment. The only option that is available presently is to set the TickLabel number format your self as shared by me in my former post. I have created an issue with ID SLIDESNET-33823 in our issue tracking system as new feature request so that our development team may investigate the possibility of implementing the desired feature. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Hi,

Any updates on the issue? Can you please provide me the ETA for the issue?

Thanks,

Amit

Hi Amit,


I have verified from our issue tracking system and regret to share that issue has not yet been scheduled for investigation. However, I have requested our development team to schedule the issue for investigation. I will share the further information with you as soon as it will be shared by our development team.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-33823) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi Amit,


I like to share that we have introduced the support for setting the number format for chart data. Now you can use two new properties for modifying cell value format:

byte ChartDataCell.PresetNumberFormat - It Gets or Sets the built-in display format of numbers and dates. Preset number must be in [0…22] or [37…49] (list of presets you can find below)

String ChartDataCell.CustomNumberFormat - Gets or Sets the custom display format of numbers and dates

Presets list:

0 General
1 0
2 0.00
3 #,##0
4 #,##0.00
5 $#,##0;$-#,##0
6 $#,##0;[Red]$-#,##0
7 $#,##0.00;$-#,##0.00
8 $#,##0.00;[Red]$-#,##0.00
9 0%
10 0.00%
11 0.00E+00
12 # ?/?
13 # /
14 m/d/yy
15 d-mmm-yy
16 d-mmm
17 mmm-yy
18 h:mm AM/PM
19 h:mm:ss AM/PM
20 h:mm
21 h:mm:ss
22 m/d/yy h:mm
37 #,##0;-#,##0
38 #,##0;[Red]-#,##0
39 #,##0.00;-#,##0.00
40 #,##0.00;[Red]-#,##0.00
41 _ * #,##0_ ;_ * "_ ;_ @
42 $* #,##0_ ;_ $* "_ ;_ @
43 * #,##0.00_ ;_ * "??_ ;_ @
44 $* #,##0.00_ ;_ $* "??_ ;_ @_
45 mm:ss
46 h :mm:ss
47 mm:ss.0
48 ##0.0E+00
49 @

Please use the following sample code to verify the issue.

PresentationEx pres = new PresentationEx();

ChartEx chart = pres.Slides[0].Shapes.AddChart(ChartTypeEx.ClusteredColumn, 50, 50, 500, 400);

ChartSeriesExCollection series = chart.ChartData.Series;
Assert.IsTrue(series.Count > 0);
foreach (ChartSeriesEx ser in series)
{
foreach (ChartDataCell cell in ser.Values)
{
cell.PresetNumberFormat = 10; //0.00%
}
}

pres.Write(@“PresetNumberFormat.pptx”);

foreach (ChartSeriesEx ser in series)
{
foreach (ChartDataCell cell in ser.Values)
{
cell.CustomNumberFormat = “0.00000”;
}
}

Many Thanks,