Enum GradientPresetType

GradientPresetType enumeration

Represents gradient preset color type.

public enum GradientPresetType

Values

NameValueDescription
Brass0Brass preset color
CalmWater1Calm Water preset color
Chrome2Chrome preset color
ChromeII3Chrome II preset color
Daybreak4Daybreak preset color
Desert5Desert preset color
EarlySunset6Early Sunset preset color
Fire7Fire preset color
Fog8Fog preset color
Gold9Gold preset color
GoldII10Gold II preset color
Horizon11Horizon preset color
LateSunset12Late Sunset preset color
Mahogany13Mahogany preset color
Moss14Moss preset color
Nightfall15Nightfall preset color
Ocean16Ocean preset color
Parchment17Parchment preset color
Peacock18Peacock preset color
Rainbow19Rainbow preset color
RainbowII20Rainbow II preset color
Sapphire21Sapphire preset color
Silver22Silver preset color
Wheat23Wheat preset color
Unknown24Unknown preset color. Only for the preset color (which is not same as any known preset color) in the template workbook.

Examples

[C#]

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

    public class GradientPresetTypeDemo
    {
        public static void GradientPresetTypeExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();

            // Add a new worksheet to the workbook
            Worksheet worksheet = workbook.Worksheets[0];

            // Add sample data to the worksheet
            worksheet.Cells["A1"].PutValue("Category");
            worksheet.Cells["A2"].PutValue("A");
            worksheet.Cells["A3"].PutValue("B");
            worksheet.Cells["A4"].PutValue("C");

            worksheet.Cells["B1"].PutValue("Value");
            worksheet.Cells["B2"].PutValue(10);
            worksheet.Cells["B3"].PutValue(20);
            worksheet.Cells["B4"].PutValue(30);

            // Add a chart to the worksheet
            int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
            Chart chart = worksheet.Charts[chartIndex];

            // Set the chart data range
            chart.SetChartDataRange("A1:B4", true);

            // Access the chart's category axis
            Axis categoryAxis = chart.CategoryAxis;

            // Access the fill format of the category axis area
            FillFormat fillFormat = categoryAxis.Area.FillFormat;

            // Set a gradient preset color for the fill format
            fillFormat.SetPresetColorGradient(GradientPresetType.Fire, GradientStyleType.Horizontal, 1);

            // Output the gradient preset color type
            Console.WriteLine("Gradient Preset Color: " + fillFormat.PresetColor);

            // Save the workbook
            workbook.Save("GradientPresetTypeExample.xlsx");
            workbook.Save("GradientPresetTypeExample.pdf");
        }
    }
}

See Also