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

Free Support Forum - aspose.com

Change the color of an Excel shape

hello,


I have spent some time looking for a simple way to do it, but could not find it.

I want to change the color of some shapes in an Excel worksheet. What is the simplest way of doing that ?

thnak you for your much appreciated help.

guido

Hi,

We are not sure which shapes or objects you are talking about. Please see the document on how to create, format different drawing objects (shapes) and controls (form controls) via Aspose.Cells APIs:
Adding Cell Controls in Worksheets

If you still have any confusion, please elaborate your issue in details, we will check it soon. Also provide your template file containing your desired shapes that you want to apply formatting etc.

Thank you.

Hi Guido,

Thanks for your posting and using Aspose.Cells.

You can use the following code to change the color of Excel shape. I have attached the source and output xlsx file generated by the code for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Shape shape = worksheet.Shapes[0];


shape.Fill.Type = FillType.Solid;

shape.Fill.SolidFill.Color = Color.Yellow;


workbook.Save(“output.xlsx”);

thanks. That worked perfectly.