IgnoredErrorCollection Class
Represents a collection of an ignored errors in the worksheet.
public sealed class IgnoredErrorCollection : IEnumerable<IgnoredError>, IEnumerable
Public NotInheritable Class IgnoredErrorCollection
Implements IEnumerable(Of IgnoredError), IEnumerable
- Inheritance:
- System.ObjectIgnoredErrorCollection
Remarks
A cell is considered to have an error condition when it meets one of the conditions specified in the ErrorTypes member. For example, if a cell is formatted as text but contains a numeric value, this is considered to be a potential error because the number won't be treated as a number, for example, in calculations.
Note that this is simply a guess by the implementing application, and a recommendation to the user. Cells with the errors specified in IgnoredErrorTypes may have perfectly valid reasons for being in such a state, for example a cell formatted as text which contains numeric Postal Codes or Order numbers. It is useful to format these cells as text so that leading zeros remain as part of the value instead of being removed.
Properties
Count
Gets the number of IgnoredErrors contained in the IgnoredErrorCollection.
Property Value
- System.Int32
The number of IgnoredErrors contained in the IgnoredErrorCollection.
Item[Int32]
Gets the IgnoredError at the specified index.
public IgnoredError this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As IgnoredError
Parameters
index
- System.Int32
The zero-based index of the IgnoredError to get.
Property Value
The IgnoredError at the specified index.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than 0 or is equal to or greater than Count.
Methods
Add(String, IgnoredErrorTypes)
Adds a new instance of an IgnoredError which instructs application to ignore all errors specified in the errorTypes
parameter on the sequence of references to cell ranges specified in the appliesTo
parameter.
public IgnoredError Add(string appliesTo, IgnoredErrorTypes errorTypes)
Public Function Add(appliesTo As String, errorTypes As IgnoredErrorTypes) As IgnoredError
Parameters
appliesTo
- System.String
The sequence of references to cell ranges over which the newly added ignored error is applied.
errorTypes
- IgnoredErrorTypes
The errors which should be ignored.
Returns
A newly created and added IgnoredError.
Exceptions
- System.ArgumentException
Parameter appliesTo
is null or System.String.Empty.
Clear()
Removes all IgnoredErrors from the IgnoredErrorCollection.
GetEnumerator()
Returns an enumerator that iterates through the IgnoredErrorCollection.
public IEnumerator<IgnoredError> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of IgnoredError)
Returns
- System.Collections.Generic.IEnumerator<IgnoredError>
An enumerator that can be used to iterate through the IgnoredErrorCollection.
Remove(IgnoredError)
Removes the specified IgnoredError from the IgnoredErrorCollection.
public bool Remove(IgnoredError ignoredError)
Public Function Remove(ignoredError As IgnoredError) As Boolean
Parameters
ignoredError
- IgnoredError
The IgnoredError to remove from the IgnoredErrorCollection.
Returns
- System.Boolean
true if IgnoredError is successfully removed; otherwise, false. This method also returns false if IgnoredError was not found in the IgnoredErrorCollection.
RemoveAt(Int32)
Removes the IgnoredError at the specified index of the IgnoredErrorCollection.
Parameters
index
- System.Int32
The zero-based index of the IgnoredError to remove.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than 0 or is equal to or greater than Count.