chart.Walls.ForegroundColor = Color.Gray gives server error

i get the server error as object reference not set when i do chart.Walls.ForegroundColor = Color.Gray i knowwall is used for charts that are 3d but what the property to set wall color as grey when the chart is not 3d as at design time i cannot decide wiether my chart will be 3d or not infact it can be both at the sametime

Looking forward for the solution i am using the latest dll for .Net using



Dim chartIndex As Integer = sheet.Charts.Add(getgraphtype(strGraphUrl), ends + 2, 1, ends + 22, 10)

'Accessing the instance of the newly added chart

Dim chart As Charts.Chart = sheet.Charts(chartIndex)

'Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"

'chart.NSeries.Add("B3:C5", True)
chart.NSeries.Add("D" & start1 + 3 & ":D" & ends + 1 & "", True)

chart.NSeries.CategoryData = "B" & start1 + 3 & ":B" & ends + 1 & ""
chart.ValueAxis.MinValue = 0
chart.ValueAxis.MaxValue = 1
chart.NSeries.IsColorVaried = True
Dim chartarea As Charts.ChartArea = chart.ChartArea
chartarea.Area.Formatting = Charts.FormattingType.Custom

'chartarea.Area.FillFormat.Texture = TextureType.WhiteMarble
Dim v As Integer
For v = 0 To v > chart.NSeries.Count
chart.NSeries(0).DataLabels.ShowValue = True
'chart.NSeries(0).DataLabels.IsPercentageShown = True
chart.PlotArea.Border.IsVisible = False

chart.Walls.ForegroundColor = Color.White

Public Function getgraphtype(ByVal strUrl As String) As Aspose.Cells.Charts.ChartType
Dim str As String : Dim i As Integer
If strUrl = "" Then
Return Charts.ChartType.Bar
i = strUrl.ToLower.IndexOf("&reptype")
str = strUrl.Substring(i + 9, (strUrl.IndexOf("&", i + 1)) - i - 9)
Select Case str.ToLower()
Case "pie"
Return Aspose.Cells.Charts.ChartType.Pie
Case "vbar"
Return Aspose.Cells.Charts.ChartType.Column
Case "hbar"
Return Aspose.Cells.Charts.ChartType.Bar
Case "area"
Return Aspose.Cells.Charts.ChartType.Area
Case "bubble"
Return Aspose.Cells.Charts.ChartType.Bubble
Case "cylinder"
Return Aspose.Cells.Charts.ChartType.Cylinder
Case "range"
Return Aspose.Cells.Charts.ChartType.CylindricalBar
Case "radar"
Return Aspose.Cells.Charts.ChartType.Radar
Case "donut"
Return Aspose.Cells.Charts.ChartType.Doughnut
End Select
End If
Return Aspose.Cells.Charts.ChartType.Column
End Function

This message was posted using Aspose.Live 2 Forum


Well, you will find “Object reference not set…” exception on the line:
chart.Walls.ForegroundColor = Color.White
because there is no wall for a 2D chart that you are creating.
Well, I think we need to provide a method to check if a chart is 3D or 2D type, so you may check a chart type before using the line. I have logged your feature request with an id: CELLSNET-25404. We will look into it soon.

Thank you.

Hello Amjad,

Just tell me the way to set the wall color when the chart in not 3d i can check in my code wither the chart is 3d or not but the problem is when the chart is not 3d then how to set the wall color

Thanks & Regards

Lakdawala Zaid

Hello Amjad,
i am attaching an excel file in which there is a chart all i want in that Grey part that is the plotarea part which in in something like black/Grey color to white

Thanks & Regards
Lakdawala Zaid


As I said before there is no wall for 2D chart types. The Walls and Floors are only existed in 3D chart types.

Now come to your chart in your template file you attached. This chart is 2D Clustered Bar. As you need to set the plot area color, so you may use:
chart.PlotArea.Area.ForegroundColor = Color.White;

Thank you.

Thanks for the solution it really worked one more thing i would like u to ask is how much backward compatible is aspose like we were first using aspose 4.0.1 in which we use to use style as

cell(1,2).style… that way
now suddenly in new realease all the property change and now 1st we need to define that style and then set it also like name for CylindricalBar was CylindericalBar so its real pain changing code for new dll
Kindly tell me is that will again happen for new releases of aspose or u people will make sure that new releases are backward compatible

Thanks & Regards
Lakdawala Zaid


We always try our best that our new versions are backward compatible with older versions and we do not change the API model much. But, you know sometimes we have to do it (not all the times though), e.g we might need to enhance the API structure to organize it more or internal API model for performance grounds. The Cell.GetStyle() and Cell.SetStyle() instead of Cell.Style attribute is a case in this regard.
For CylindricalBar —> CylindericalBar , this is exceptional case as former name has typo error, so we needed to fix it.

Thank you.


Please download Aspose.Cells
for .NET v5.3.1.2

We have added Chart.Is3D property to check whether the chart is a 3d chart.

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

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