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

Free Support Forum - aspose.com

If tests when having emty cells are not evaluated as in excel

When we have the formula

  • =IF(A1=""; “Empty”; “Not empty”)

This is evaluated as in Excel if we
  • Have a value
  • Explicitly set value to emty string ““

It is not evaluated as in Excel if we
  • clear the cell in Excel
  • clear the cell by code: inputs.getCells().getCell(“A1”).clearContent();

Test code:

import java.io.FileInputStream;
import java.io.IOException;

import com.aspose.cells.AsposeLicenseException;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class EmptyIfTest {

public static void main(String[] args) throws IOException, AsposeLicenseException {

License lic = new License();
lic.setLicense(new FileInputStream(“lib/Aspose.Cells.lic”));

Workbook workbook = new Workbook();


Worksheet inputs = workbook.getWorksheets().getSheet(“Inputs”);



System.out.println("A1: "+inputs.getCells().getCell(“A1”).getValue());
System.out.println("B1: "+inputs.getCells().getCell(“B1”).getValue());
System.out.println("B1 formula: " + inputs.getCells().getCell(“B1”).getFormula());

System.out.println("A2: "+inputs.getCells().getCell(“A2”).getValue());
System.out.println("B2: "+inputs.getCells().getCell(“B2”).getValue());
System.out.println("B2 formula: " + inputs.getCells().getCell(“B2”).getFormula());

System.out.println("A3: "+inputs.getCells().getCell(“A3”).getValue());
System.out.println("B3: "+inputs.getCells().getCell(“B3”).getValue());
System.out.println("B3 formula: " + inputs.getCells().getCell(“B3”).getFormula());




If you compare the output with the Result.xls file you will find the B1 cell evaluated to “Empty” in the excel spreadsheet but to “Not empty” in the console output.


Thank you for considering Aspose.

Well, Cell.clearContent() sets the value of a cell as null (not “”). That is why “B1” cells value comes as “Not Empty”. Anyways, we will further look into your issue and get back to you soon. Also, I have added your issue to our issue tracking system with issue id CELLSJAVA-11665.

Thank You & Best Regards,

<span style=“font-size: 10pt; font-family: “Segoe UI”;”><o:p></o:p>


Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. We have fixed the issue for comparing empty string "" with empty cells.

Thank You & Best Regards,

Now it works fine. Thank you

The issues you have found earlier (filed as 11665) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.