Class ErrorCheckOption

ErrorCheckOption class

Error check setting applied on certain ranges.

public class ErrorCheckOption

Methods

NameDescription
AddRange(CellArea)Adds one influenced range by this setting.
GetCountOfRange()Gets the count of ranges that influenced by this setting.
GetRange(int)Gets the influenced range of this setting by given index.
IsErrorCheck(ErrorCheckType)Checks whether given error type will be checked.
RemoveRange(int)Removes one range by given index.
SetErrorCheck(ErrorCheckType, bool)Sets whether given error type will be checked.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

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

            // Get the ErrorCheckOptionCollection from the worksheet
            ErrorCheckOptionCollection opts = worksheet.ErrorCheckOptions;

            // Add a new ErrorCheckOption to the collection
            int optionIdx = opts.Add();
            ErrorCheckOption opt = opts[optionIdx];

            // Set error check options
            opt.SetErrorCheck(ErrorCheckType.InconsistFormula, false);
            opt.SetErrorCheck(ErrorCheckType.InconsistRange, false);
            opt.SetErrorCheck(ErrorCheckType.TextDate, false);
            opt.SetErrorCheck(ErrorCheckType.TextNumber, false);
            opt.SetErrorCheck(ErrorCheckType.Validation, false);

            // Define a cell area and add it to the ErrorCheckOption
            CellArea ca = CellArea.CreateCellArea("A1", "B10");
            opt.AddRange(ca);

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

See Also