Get wrong value for evaluating the function COUNTIF

The function COUNTIF does not always return identical values as excel.

My test program has the following output:

Aspose version : 2.1.1.1
A2: 999 (expected no value)
A3: 999 (expected value 999)

If you compare the output with the excel file you will see the problem.

Test program:
================================
import java.io.FileInputStream;
import java.io.IOException;

import com.aspose.cells.AsposeLicenseException;
import com.aspose.cells.Cells;
import com.aspose.cells.CellsHelper;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;

public class CountIfTest {

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

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

System.out.println(“Aspose version : " + CellsHelper.getReleaseVersion());

Workbook workbook = new Workbook();

workbook.open(“Excel/COUNTIF_test.xls”);

workbook.calculateFormula();

Cells cells = workbook.getWorksheets().getSheet(“Test”).getCells();

System.out.println(“A2: " + cells.getCell(“A2”).getStringValue()+”\t (expected no value)”);
System.out.println(“A3: " + cells.getCell(“A2”).getStringValue()+”\t (expected value 999)");

}

}

Hi,

Thanks for providing us template file with sample code. We found the issue as you have mentioned. Your issue has been logged into our issue tracking system with an issue id: CELLSJAVA-12032. We will figure it out and get back to you soon.


By the way your last two lines should be:
System.out.println(“A2: " + cells.getCell(“A2”).getStringValue()+”\t (expected no value)");
System.out.println(“A3: " + cells.getCell(“A3”).getStringValue()+”\t (expected value 999)");

Thank you.

Hi,

Please try the attached version.

Thank you.

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


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

This issue is a problem for Aspose version : 7.0.2.0

Sample program output:
-----------------------------
Aspose version : 7.0.2.0
A2: 999 (expected no value)
A3: 999 (expected value 999)


Sample program converted to new API:
------------------------------------------------
package com.ec.frmw.test.aspose;
import java.io.FileInputStream;
import java.io.IOException;

import com.aspose.cells.Cells;
import com.aspose.cells.CellsHelper;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;

public class CountIfTest {

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

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

System.out.println(“Aspose version : " + CellsHelper.getVersion());

Workbook workbook = new Workbook(“Excel/COUNTIF_test.xls”);

workbook.calculateFormula();

Cells cells = workbook.getWorksheets().get(“Test”).getCells();

System.out.println(“A2: " + cells.get(“A2”).getStringValue()+”\t (expected no value)”);
System.out.println(“A3: " + cells.get(“A3”).getStringValue()+”\t (expected value 999)");

}

}

Hi,


Thanks for pointing it out.

I can find the issue as you mentioned using your template file (in his first post of his thread) and updated code. I have logged a ticket with an id: CELLSJAVA-40048. We will look into it soon.

Thank you.

Hi,

Please try the attached version/fix: v7.0.3.3.

We have fixed the issue regarding formulas.


Thank you.

It solves the problem, thank you

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


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