Results 1 to 3 of 3
  1. #1
    YannickL is offline Member
    Join Date
    Jun 2014
    Posts
    7
    Rep Power
    0

    Default Evaluate Formula : Row()

    Hi.
    I have an issue with the evaluation of a formula in an Excel file.
    I use Poi-3.10 to read a .xlsm file and there is a formula "=Row(A1)".

    I use this code :
    Java Code:
    Workbook wb = ExcelApi.openWorkbook("D:\\Doc\\essai.xlsm");
    Sheet sh = wb.getSheet("Feuil1");
    Row row = sh.getRow(0);
    Cell cell = row.getCell(0);
    FormulaEvaluator eval = wb.getCreationHelper().createFormulaEvaluator();
    System.out.println(cell.getCellFormula());
    System.out.println(eval.evaluate(cell).getStringValue());
    The formula I get it : ROW(A1), but the evaluation is null. I don't understand why the evaluation doesn't return "1".
    Any idea why I have the result ?

    Thanks in advance.
    Evaluate Formula : Row()-formula.png
    Last edited by YannickL; 06-03-2014 at 02:52 PM.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    946
    Rep Power
    2

    Default Re: Evaluate Formula : Row()

    Because it's not a string value, but a numeric value: System.out.println(eval.evaluate(cell).getNumberVa lue());
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    YannickL is offline Member
    Join Date
    Jun 2014
    Posts
    7
    Rep Power
    0

    Default Re: Evaluate Formula : Row()

    Quote Originally Posted by SurfMan View Post
    Because it's not a string value, but a numeric value: System.out.println(eval.evaluate(cell).getNumberVa lue());
    Oh yeah, thanks.
    I'm idiot -_-

Similar Threads

  1. problem with infix post fix evaluate
    By alexd in forum New To Java
    Replies: 18
    Last Post: 02-07-2014, 06:08 PM
  2. Replies: 1
    Last Post: 11-22-2010, 09:10 PM
  3. Create program to evaluate prefix expression
    By Debonairj in forum New To Java
    Replies: 1
    Last Post: 08-12-2010, 02:35 AM
  4. Replies: 2
    Last Post: 06-26-2010, 09:18 PM
  5. Evaluate a string expression
    By aparna_pall in forum New To Java
    Replies: 2
    Last Post: 04-10-2010, 03:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •