Enum BackgroundType

BackgroundType enumeration

Enumerates cell background pattern types.

public enum BackgroundType

Values

NameValueDescription
DiagonalCrosshatch9Represents diagonal crosshatch pattern.
DiagonalStripe8Represents diagonal stripe pattern.
Gray618Represents 6.25% gray pattern
Gray1217Represents 12.5% gray pattern
Gray254Represents 25% gray pattern.
Gray502Represents 50% gray pattern.
Gray753Represents 75% gray pattern.
HorizontalStripe5Represents horizontal stripe pattern.
None0Represents no background.
ReverseDiagonalStripe7Represents reverse diagonal stripe pattern.
Solid1Represents solid pattern.
ThickDiagonalCrosshatch10Represents thick diagonal crosshatch pattern.
ThinDiagonalCrosshatch16Represents thin diagonal crosshatch pattern.
ThinDiagonalStripe14Represents thin diagonal stripe pattern.
ThinHorizontalCrosshatch15Represents thin horizontal crosshatch pattern.
ThinHorizontalStripe11Represents thin horizontal stripe pattern.
ThinReverseDiagonalStripe13Represents thin reverse diagonal stripe pattern.
ThinVerticalStripe12Represents thin vertical stripe pattern.
VerticalStripe6Represents vertical stripe pattern.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;
    using System.Drawing;

    public class BackgroundTypeDemo
    {
        public static void BackgroundTypeExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access the first worksheet in the workbook
            Worksheet worksheet = workbook.Worksheets[0];
            
            // Access a cell from the worksheet
            Cell cell = worksheet.Cells["A1"];
            
            // Set the value of the cell
            cell.PutValue("Hello, Aspose!");

            // Create a style object
            Style style = cell.GetStyle();
            
            // Set the background pattern type
            style.Pattern = BackgroundType.DiagonalStripe;
            
            // Set the foreground color
            style.ForegroundColor = Color.Red;
            
            // Set the background color
            style.BackgroundColor = Color.Green;
            
            // Apply the style to the cell
            cell.SetStyle(style);
            
            // Save the workbook
            workbook.Save("BackgroundTypeExample.xlsx");
            workbook.Save("BackgroundTypeExample.pdf");



        }
    }
}

See Also