Enum ColorType

ColorType enumeration

Represents all color type

public enum ColorType

Values

NameValueDescription
Automatic0Automatic color.
AutomaticIndex1It’s automatic color,but the displayed color depends the setting of the OS System.
RGB2The RGB color.
IndexedColor3The color index in the color palette.
Theme4The theme color.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class CellsClassColorTypeDemo
    {
        public static void Run()
        {
            try
            {
                // Create a new workbook for demonstration
                Workbook workbook = new Workbook();
                Worksheet worksheet = workbook.Worksheets[0];

                // Demonstrate using ColorType enum values
                ColorType automatic = ColorType.Automatic;
                ColorType rgb = ColorType.RGB;
                ColorType theme = ColorType.Theme;

                // Display the enum values
                Console.WriteLine($"Automatic color type value: {(int)automatic}");
                Console.WriteLine($"RGB color type value: {(int)rgb}");
                Console.WriteLine($"Theme color type value: {(int)theme}");

                // Create a cell and set its value
                Cell cell = worksheet.Cells["A1"];
                cell.PutValue("ColorType Demo");

                // Create a style and apply it to the cell
                Style style = workbook.CreateStyle();
                style.Font.Color = System.Drawing.Color.Black;
                cell.SetStyle(style);

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

                Console.WriteLine("ColorType demonstration completed successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error in ColorType demonstration: {ex.Message}");
            }
        }
    }
}

See Also