Hi,
When I change the format of the value axis in the charts to General so that it is not the same as the data cell - the format of the data cell seem to change. Is this expected behaviour?
Thanks,Aarti
Hi,
When I change the format of the value axis in the charts to General so that it is not the same as the data cell - the format of the data cell seem to change. Is this expected behaviour?
Thanks,Aarti
No. It shouldn't.
Could you post your sample code and file to show this problem? I don't find it.
Following is my test code:
Excel excel = new Excel();
Cells cells = excel.Worksheets[0].Cells;
cells["B1"].PutValue(0.151);
cells["B2"].PutValue(0.252);
cells["B3"].PutValue(0.353);
cells["b1"].Style.Number = 9;
cells["b2"].Style.Number = 9;
cells["b3"].Style.Number = 9;
cells["C1"].PutValue(0.11);
cells["C1"].Style.Number = 9;
cells["C2"].PutValue(0.22);
cells["C2"].Style.Number = 9;
cells["C3"].PutValue(0.33);
cells["C3"].Style.Number = 9;
Charts charts = excel.Worksheets[0].Charts;
int chartIndex = charts.Add(ChartType.Column, 10, 4, 22, 10);
Chart chart = charts[chartIndex];
chart.NSeries.Add("B1:C3", true);
chart.ValueAxis.TickLabels.NumberFormat = "0.00";
excel.Save("d:\\test\\abc.xls");
Try this -
The cells D1 to D3 lose their formatting of percentage if the chart value axis is changed. If that part is commented it works fine. Thanks, Aarti
Excel excel = new Excel();
Cells cells = excel.Worksheets[0].Cells;
cells["B1"].PutValue(0.151);
cells["B2"].PutValue(0.252);
cells["B3"].PutValue(0.353);
cells["b1"].Style.Custom = "0.0;(0.0)";
cells["b2"].Style.Custom = "0.0;(0.0)";
cells["b3"].Style.Custom = "0.0;(0.0)";
cells["C1"].PutValue(0.11);
cells["C1"].Style.Custom = "0.0;(0.0)";
cells["C2"].PutValue(0.22);
cells["C2"].Style.Custom = "0.0;(0.0)";
cells["C3"].PutValue(0.33);
cells["C3"].Style.Custom = "0.0;(0.0)";
cells["D1"].PutValue(0.151);
cells["D2"].PutValue(0.252);
cells["D3"].PutValue(0.353);
cells["D1"].Style.Custom = "0.0%;(0.0%)";
cells["D2"].Style.Custom = "0.0%;(0.0%)";
cells["D3"].Style.Custom = "0.0%;(0.0%)";
cells["E1"].Style.Custom = "0.0%;(0.0%)";
cells["E2"].Style.Custom = "0.0%;(0.0%)";
cells["E3"].Style.Custom = "0.0%;(0.0%)";
Charts charts = excel.Worksheets[0].Charts;
int chartIndex = charts.Add(ChartType.Column, 10, 4, 22, 10);
Chart chart = charts[chartIndex];
chart.NSeries.Add("B1:C3", true);
chart.ValueAxis.TickLabels.NumberFormat = "General";
chartIndex = charts.Add(ChartType.Column,25, 4,37, 10);
chart = charts[chartIndex];
chart.NSeries.Add("D1:E3", true);
chart.ValueAxis.TickLabels.NumberFormat = "General";
excel.Save("abc.xls");
Hi,
Can someone please let me know why this issue is occuring with the value-axis or am I doing something wrong? Please also let me know if this identified as a bug or if there is a workaround.
Thanks,
Aarti