We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Vertical lines in chart losing colors from template

I need some help with Apsose Cells for .Net. Our version of Aspose Total is 17.4.0.0.

I open up an Excel template from the database via a memory stream. After I replace the data section of the graph with new data, columns “A” – “G” the new XLS opens up, the data plots correctly, but the vertical lines lost their colors (Orange and Black) that was set in the original template. Looking at the new XLS file, it appears that the color fill is set to automatic.

If I just open and close the template, no data manipulation, the vertical lines appear with the correct color. If I comment out just the code that changes the vertical line data, columns “F” and “G”, the vertical lines retain their original colors, so the issue comes from changing columns “F” and “G” data.

Here is the code that sets the NSeries values:

chart = sheet.Charts[0];
// Add Category Data and Second category Data
chart.NSeries.CategoryData = “=PB Graph!$A$3:$A$” + row;
chart.NSeries.SecondCategoryData = “=PB Graph!$G$3:$G$” + row;
// What the Template data looks like
chart.NSeries[1].Values = “=PB Graph!$B$3:$B$” + row;
chart.NSeries[2].Values = “=PB Graph!$C$3:$C$” + row;
chart.NSeries[3].Values = “=PB Graph!$E$3:$E$” + row;
chart.NSeries[4].Values = “=PB Graph!$D$3:$D$” + row;
chart.NSeries[0].Values = “=PB Graph!$F$3:$F$” + row;

I tried to set the color of the vertical lines with the following code, but had ot luck:

//chart.NSeries[0].Points[0].Area.FillFormat.FillType = FillType.Solid;
//chart.NSeries[0].Points[0].Area.FillFormat.SolidFill.Color = System.Drawing.Color.Orange;
//chart.NSeries[0].Points[1].Area.FillFormat.FillType = FillType.Solid;
//chart.NSeries[0].Points[1].Area.FillFormat.SolidFill.Color = System.Drawing.Color.Blue;

What do I need to do to retain the original vertical line colors from the original template?

ThanksPlanningBudgetGraphIssues.zip (26.3 KB)

@molenik,

Thanks for providing us template file, sample code segment and details.

Please try our latest fix/version: Aspose.Cells for .NET v17.9.7

I have tested your scenario/ case a bit using your template file with v17.9.7, it works Ok.

If you still find the issue with v17.9.7, kindly do create a simple console demo application, zip it and post us here to reproduce the issue, we will check it soon.