Attached is a chart created in Excel 2016.
I am trying to copy the gradient fill in the Chart Area - can you please supply the required code for this?
Chart.zip (14.1 KB)
Attached is a chart created in Excel 2016.
I am trying to copy the gradient fill in the Chart Area - can you please supply the required code for this?
Chart.zip (14.1 KB)
Thanks for the template file.
See the following sample code on how to apply different types of gradient fill formats to chart area. I used your template file to apply gradient formattings on the existing chart for your reference (you may change the parameter values or other attributes for your needs):
e.g
Sample code:
var workbook = new Workbook("e:\\test2\\Chart.xlsx");
var worksheet = workbook.Worksheets[0];
var chart = worksheet.Charts[0];
//Set one color gradient.
chart.ChartArea.Area.FillFormat.SetOneColorGradient(System.Drawing.Color.LightBlue, 0.4, Aspose.Cells.Drawing.GradientStyleType.FromCenter, 2);
workbook.Save("e:\\test2\\out1oneclorgradientsample1.xlsx");
//Set two color gradient.
chart.ChartArea.Area.FillFormat.SetTwoColorGradient(Color.Gray, Color.LightGray, GradientStyleType.FromCenter, 2);
workbook.Save("e:\\test2\\out1twoclorgradientsample1.xlsx");
//Set present color gradient.
chart.ChartArea.Area.FillFormat.SetPresetColorGradient(GradientPresetType.EarlySunset,GradientStyleType.FromCorner,1);
workbook.Save("e:\\test2\\out1presetclorgradientsample1.xlsx");
Hope, this helps a bit.
Thank you.