Free Support Forum - aspose.com

Gradient issues

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

Hi,


Thanks for providing us the template file and sample codes.

1) I have managed to reproduce the issue on my end using your template file and code. I have logged a ticket with an id: CELLSNET-41100 for it. We will soon look into it to figure it out. The same code does not produce similar order for gradient colors.

2) I have also managed to reproduce the second issue on my end using your template file and second code snippet. I have logged a ticket with an id: CELLSNET-41101 for it. We will soon look into it to figure it out. The gradient color is not rendered for the chart series/points.

Once we have any update on any of the above issue, we will let you know here.

Thank you.

Hi,


Please try this fix/version: Aspose.Cells for .NET v7.3.2.3

We fixed your issues regarding setting
gradient color/effects. While setting the gradient color for chart point, please use the
following code segment. By default, Aspose don’t create ChartPointCellection
for Series. <o:p></o:p>

foreach (Series s in c.NSeries)

{

Console.WriteLine(s.Points.Count);

for (int i=0; i < s.Points.Count; i++)

{

ChartPoint p = s.Points[i];

p.Area.FillFormat.Type = FillType.Gradient;

p.Area.FillFormat.SetTwoColorGradient(

Color.Blue, Color.Red, GradientStyleType.Horizontal, 4);

}

}

Thank you.

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


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