We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ErrorCheckOption#isErrorCheck implementation bug

Using Aspose Cells for Java, version 19.11.3.

First, we generate a workbook, using ErrorCheckOption to disable “number stored as text” for A1:A10:

Workbook workbook = new Workbook();
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.get(0);
Cells cells = worksheet.getCells();
for (int row = 0; row < 10; row++) {
    cells.get(row, 0).setValue(String.valueOf(row));

ErrorCheckOptionCollection errorCheckOptions = worksheet.getErrorCheckOptions();
int index = errorCheckOptions.add();
ErrorCheckOption errorCheckOption = errorCheckOptions.get(index);
errorCheckOption.setErrorCheck(ErrorCheckType.TEXT_NUMBER, false);
errorCheckOption.addRange(CellArea.createCellArea(0, 0, 9, 0));

So far so good: Excel does not show the green triangles in the cell corners, and looking in the XLSX file, the expected sub-structure to disable the warning is there.

Next, let’s read the same workbook using Aspose Cells, and check if we can recognize the ErrorCheckOption we created:

Workbook workbook = new Workbook("number-as-string.xlsx");
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.get(0);
ErrorCheckOptionCollection errorCheckOptions = worksheet.getErrorCheckOptions();
for (int i = 0; i < errorCheckOptions.getCount(); i++) {
    ErrorCheckOption errorCheckOption = errorCheckOptions.get(i);
    System.out.println("errorCheckOption.isErrorCheck(ErrorCheckType.TEXT_NUMBER) = " + errorCheckOption.isErrorCheck(ErrorCheckType.TEXT_NUMBER));
    System.out.println("errorCheckOption.getRange(0) = " + errorCheckOption.getRange(0));

The output of the second section of code is as following:

errorCheckOption.isErrorCheck(ErrorCheckType.TEXT_NUMBER) = false
errorCheckOption.getRange(0) = Aspose.Cells.CellArea(A1:A10)[0,0,9,0]

There seems to be a trivial implementation error in ErrorCheckOption#isErrorCheck():

public boolean isErrorCheck(int errorCheckType) {
    return (this.b & errorCheckType) == 0;

I assume that the comparison should use != 0 instead of == 0, to determine if the provided flag is set.

Kind regards,

We are working on this issue and will share our thoughts soon.

We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-43067 - ErrorCheckOption#isErrorCheck implementation


We evaluated your issue further. We found it is not an issue with the APIs rather with your code. Please change the line of code:

errorCheckOption.setErrorCheck(ErrorCheckType.TEXT_NUMBER, false);


errorCheckOption.setErrorCheck(ErrorCheckType.TEXT_NUMBER, true);

it will work fine.

Hi @Amjad_Sahi,

This seems inconsistent with the documentation found here:

That documentation contains a code example, containing the following lines:

// Disable the numbers stored as text option
opt.SetErrorCheck(ErrorCheckType.TextNumber, false);

In my scenario, I want to disable the “Number Stored As String” warning, so I assume I should pass false.

In addition, the API reference seems to suggest this as well:

The documentation for the isCheck argument is as following:

Type: System.Boolean
true if given error type needs to be checked.

Since I want to disable the check, I assume I should pass false.

Am I misunderstanding the documentation linked above?

Thanks in advance,


I think there is a little misunderstanding regarding the isCheck parameter.
Please note, by default, MS Excel will evaluate/check Numbers stored as text in the sheet cells. So, you will notice green triangle (in top left corner) with info (Numbers stored as text). Now come to the parameter, please note:

  1. If you specify isCheck to false, it means Aspose.Cells won’t check the numbers stored as text, so you won’t see the green triangle anymore attached to the worksheet cells. Now when you retrieve the value for “errorCheckOption.isErrorCheck(ErrorCheckType.TEXT_NUMBER)”, it will correctly retrieve “false”.

  2. If you specify “true” for the parameter, it means Aspose.Cells will check the numbers stored as text, so you will see the green triangle attached to the worksheet cells (this is also default behavior of MS Excel (where the relevant option is checked)). Now when you retrieve the value for “errorCheckOption.isErrorCheck(ErrorCheckType.TEXT_NUMBER)”, it will correctly retrieve “true”

Hope, this helps a bit.

Hi @Amjad_Sahi,

The API is a bit counter-intuitive, but after reading your explanation, it does make sense.

Thank you,


You are welcome.