Class AutomaticFill

AutomaticFill class

represents automatic fill.

public class AutomaticFill : Fill

Methods

NameDescription
override Equals(object)/(Inherited from Fill.)
override GetHashCode()Gets the hash code.(Inherited from Fill.)

Examples

[C#]

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

namespace Demos
{
    public class AutomaticFillDemo
    {
        public static void RunDemo()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Add some sample data
            sheet.Cells["A1"].PutValue("Hello");
            sheet.Cells["A2"].PutValue("World");

            // Add a shape to the worksheet
            Shape shape = sheet.Shapes.AddShape(MsoDrawingType.Rectangle, 2, 0, 2, 0, 100, 200);

            // Set the fill format of the shape to AutomaticFill
            shape.Fill.FillType = FillType.Automatic;

            // Save the workbook
            workbook.Save("AutomaticFillDemo.xlsx");

            shape.Fill.FillType = FillType.Pattern;
            shape.Fill.Pattern = FillPattern.SolidDiamond;
            shape.Fill.PatternFill.ForegroundColor = System.Drawing.Color.Red;
            shape.Fill.PatternFill.BackgroundColor = System.Drawing.Color.Green;

            workbook.Save("PatternFillDemo2.xlsx");
            workbook.Save("PatternFillDemo2.pdf");
        }
    }
}

See Also