Enum ValidationAlertType

ValidationAlertType enumeration

Represents the data validation alert style.

public enum ValidationAlertType

Values

NameValueDescription
Information0Information alert style.
Stop1Stop alert style.
Warning2Warning alert style.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class ValidationAlertTypeDemo
    {
        public static void ValidationAlertTypeExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Define a cell area for validation
            CellArea area = CellArea.CreateCellArea(0, 0, 1, 1);

            // Add a validation to the worksheet
            ValidationCollection validations = worksheet.Validations;
            int validationIndex = validations.Add(area);
            Validation validation = validations[validationIndex];

            // Set validation properties
            validation.Type = ValidationType.WholeNumber;
            validation.Operator = OperatorType.Between;
            validation.Formula1 = "3";
            validation.Formula2 = "1234";
            validation.AlertStyle = ValidationAlertType.Stop; // Using the ValidationAlertType enum
            validation.ErrorTitle = "Invalid Input";
            validation.ErrorMessage = "Please enter a number between 3 and 1234.";
            validation.ShowError = true;

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

            return;
        }
    }
}

See Also