Two issues with gradients.
First, the result of this code is different in XLS and XLSX formats (colours are reversed):
Workbook wb = new Workbook(“src.xlsx”);
Worksheet ws = wb.Worksheets[0];
Chart c = ws.Charts[0];
foreach (Series s in c.NSeries)
{
s.Area.FillFormat.Type = FillType.Gradient;
s.Area.FillFormat.SetTwoColorGradient(
Color.Blue, Color.Red, GradientStyleType.Horizontal, 4);
}
wb.Save(“output.xls”);
wb.Save(“output.xlsx”);
Second, this code doesn’t produce a gradient at all:
Workbook wb = new Workbook(“src.xlsx”);
Worksheet ws = wb.Worksheets[0];
Chart c = ws.Charts[0];
foreach (Series s in c.NSeries)
{
foreach (ChartPoint p in s.Points)
{
p.Area.FillFormat.Type = FillType.Gradient;
p.Area.FillFormat.SetTwoColorGradient(
Color.Blue, Color.Red, GradientStyleType.Horizontal, 4);
}
}
wb.Save(“output.xls”);
wb.Save(“output.xlsx”);
Thanks.
Shaun