public final class IgnoredErrorCollection extends Object implements Iterable<IgnoredError>
A cell is considered to have an error condition when it meets one of the conditions specified in the IgnoredError.getErrorTypes()
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.
Following example shows that cells A1 and B1 both contain numbers stored as text, and this error has been reviewed and specifically flagged to be no longer surfaced as an error to the user.
ExcelFile workbook = new ExcelFile();
ExcelWorksheet worksheet = workbook.addWorksheet("Sheet1");
worksheet.getCell("A1").setValue("00385");
worksheet.getCell("B1").setValue("00387");
worksheet.getIgnoredErrors().add("A1 B1", EnumSet.of(IgnoredErrorTypes.NUMBER_STORED_AS_TEXT));
Modifier and Type | Method and Description |
---|---|
IgnoredError |
add(String appliesTo,
EnumSet<IgnoredErrorTypes> errorTypes)
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. |
void |
clear()
Removes all
IgnoredError s from the IgnoredErrorCollection . |
IgnoredError |
get(int index)
Gets the
IgnoredError at the specified index. |
Iterator<IgnoredError> |
iterator()
Returns an iterator that iterates through the
IgnoredErrorCollection . |
boolean |
remove(IgnoredError ignoredError)
Removes the specified
IgnoredError from the IgnoredErrorCollection . |
void |
remove(int index)
Removes the
IgnoredError at the specified index of the IgnoredErrorCollection . |
int |
size()
Gets the number of
IgnoredError s contained in the IgnoredErrorCollection . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public IgnoredError add(String appliesTo, EnumSet<IgnoredErrorTypes> errorTypes)
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.appliesTo
- The sequence of references to cell ranges over which the newly added ignored error is applied.errorTypes
- The errors which should be ignored.IgnoredError
.IllegalArgumentException
- Parameter appliesTo
is null
or empty string.public void clear()
IgnoredError
s from the IgnoredErrorCollection
.public IgnoredError get(int index)
IgnoredError
at the specified index.index
- The zero-based index of the IgnoredError
to get.IgnoredError
at the specified index.IndexOutOfBoundsException
- index
is less than 0 or is equal to or greater than size()
.public Iterator<IgnoredError> iterator()
IgnoredErrorCollection
.iterator
in interface Iterable<IgnoredError>
IgnoredErrorCollection
.public boolean remove(IgnoredError ignoredError)
IgnoredError
from the IgnoredErrorCollection
.
This method also returns false
if IgnoredError
was not found in the IgnoredErrorCollection
.
ignoredError
- The IgnoredError
to remove from the IgnoredErrorCollection
.true
if IgnoredError
is successfully removed; otherwise, false
.public void remove(int index)
IgnoredError
at the specified index of the IgnoredErrorCollection
.index
- The zero-based index of the IgnoredError
to remove.IndexOutOfBoundsException
- index
is less than 0 or is equal to or greater than size()
.public int size()
IgnoredError
s contained in the IgnoredErrorCollection
.IgnoredError
s contained in the IgnoredErrorCollection
.© GemBox Ltd. — All rights reserved.