This project has moved and is read-only. For the latest updates, please go here.

Gradient in shapes like rectangle

Feb 14, 2013 at 1:44 AM
So, how can i set a gradient in shapes?

shape.Fill.Style = eFillStyle.GradientFill;
shape.Fill.Color ?
Feb 14, 2013 at 2:51 AM
Have a look at this thread for assigning colors:
Feb 14, 2013 at 3:49 AM
Edited Feb 14, 2013 at 3:51 AM
Hi!! Thanks for your response!!
But i need to add a gradient to a shape... but may be i'll use a full RGB color.

As you can see, the cells hava Color1 and Color2 for gradients but the shapes don't have!

ws.Cells["A1:C3"].Style.Fill.Gradient.Type = ExcelFillGradientType.Linear;
Feb 14, 2013 at 4:41 AM
I tried the following code:

var shape1 = excel_worksheet_2.Drawings.AddShape("shape1", eShapeStyle.RoundRect);
  shape1.SetPosition(0, 5, 5, 5);
  shape1.SetSize(200, 200);
  shape1.Fill.Style = eFillStyle.GradientFill; // <-- error 'not implented' but --> eFillStyle.SolidFill; works
  shape1.Fill.Color = Color.FromArgb(79, 129, 189);
But at run time it fails with an error saying eFillStyle.GradientFill is not implemented. Also I could not find the shape on the worksheet using the other property eFillStyle.SolidFill which does not cause a run time error.