Shape.Fill

Shape.Fill property

Returns a FillFormat object that contains fill formatting properties for the specified shape.

public FillFormat Fill { get; }

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Drawing;

namespace AsposeCellsExamples
{
    public class ShapePropertyFillDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add a rectangle shape with correct parameters
            Shape shape = worksheet.Shapes.AddRectangle(1, 0, 1, 100, 200, 0);

            // Get the fill format of the shape
            FillFormat fillFmt = shape.Fill;

            // Set solid fill with color
            fillFmt.SolidFill.Color = System.Drawing.Color.Red;

            // Set transparency
            fillFmt.Transparency = 0.5;

            // Save the workbook
            workbook.Save("ShapeFillDemo.xlsx");
        }
    }
}

See Also