You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/03/23 22:56:25 UTC

[Bug 62216] New: SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

            Bug ID: 62216
           Summary: SXSSFCell.setCellErrorValue turns a formula cell into
                    an error cell, unlike XSSF
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SXSSF
          Assignee: dev@poi.apache.org
          Reporter: gallon.fizik@gmail.com
  Target Milestone: ---

A fix for this seems to be a one-liner. In source

@Override
public void setCellErrorValue(byte value)
{
    ensureType(CellType.ERROR);
    if(_value.getType()==CellType.FORMULA)
        ((ErrorFormulaValue)_value).setPreEvaluatedValue(value);
    else
        ((ErrorValue)_value).setValue(value);
}


ensureType(CellType.ERROR);

is to be replaced by 

ensureTypeOrFormulaType(CellType.ERROR);

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
I added the suggested change using
https://svn.apache.org/viewvc?view=revision&revision=1828144

Would it be possible to get a test case for regression purposes?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
Hi Gallon,
That test passes even without the change in
https://svn.apache.org/viewvc?view=revision&revision=1828144

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

--- Comment #4 from gallon.fizik@gmail.com <ga...@gmail.com> ---
(In reply to PJ Fanning from comment #3)
> Hi Gallon,
> That test passes even without the change in
> https://svn.apache.org/viewvc?view=revision&revision=1828144

That's weird. With poi 3.17 it fails for me with
java.lang.IllegalStateException: Cannot get a FORMULA value from a ERROR cell.

It passes with an XSSFWorkbook, though.

When I have time, I can check out trunk and try it myself.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

--- Comment #2 from gallon.fizik@gmail.com <ga...@gmail.com> ---
(In reply to PJ Fanning from comment #1)
> I added the suggested change using
> https://svn.apache.org/viewvc?view=revision&revision=1828144
> 
> Would it be possible to get a test case for regression purposes?

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaError;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class SXSSFCellTest {
    @Test
    public void test62216() {
        Cell instance = new
SXSSFWorkbook().createSheet().createRow(0).createCell(0);

        String formula = "2";
        instance.setCellFormula(formula);
        instance.setCellErrorValue(FormulaError.NAME.getCode());

        String result = instance.getCellFormula();
        assertEquals(formula, result);
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62216] SXSSFCell.setCellErrorValue turns a formula cell into an error cell, unlike XSSF

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62216

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
The test case works with and without the change with poi trunk (4.0.0 pre
release) but does fail with 3.17 code base.
I've added the test case to trunk.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org