Enum FillType

FillType enumeration

Fill format type.

public enum FillType

Values

NameValueDescription
Automatic0Represents automatic formatting type.
None1Represents none formatting type.
Solid2Solid fill format.
Gradient3Gradient fill format.
Texture4Texture fill format(includes picture fill).
Pattern5Pattern fill format.
Group6Inherit the fill properties of the group.

Examples

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

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

            // Add a rectangle shape
            Shape rectangle = worksheet.Shapes.AddRectangle(1, 0, 1, 1, 100, 150);
            
            // Set gradient fill type
            rectangle.Fill.FillType = FillType.Gradient;
            rectangle.Fill.SetTwoColorGradient(Color.LightBlue, Color.DarkBlue, GradientStyleType.Horizontal, 1);

            // Add a text box
            Shape textBox = worksheet.Shapes.AddTextBox(1, 0, 10, 10, 100, 150);
            textBox.Text = "Gradient Fill Example";
            
            // Set gradient fill type for text box
            textBox.Fill.FillType = FillType.Gradient;
            textBox.Fill.SetTwoColorGradient(Color.LightGreen, Color.DarkGreen, GradientStyleType.Vertical, 1);

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

See Also