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 2019/10/14 19:04:43 UTC

[Bug 63845] New: Forumla not evaluated in 4.1.0

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

            Bug ID: 63845
           Summary: Forumla not evaluated in 4.1.0
           Product: POI
           Version: 4.1.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: joern@muehlencord.de
  Target Milestone: ---

Created attachment 36826
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36826&action=edit
file created using 4.1.0, cell formulas are not calculated when opening the
file

Cell formulas are not evaluated when created with 4.1.0

E.g. cell.setCellFormula("SUM(A3:A5)"); opens as "0" when opening the excel
file. Same source code compiled with 4.0.1 works and shows correct value when
opening.

If editing the formula (F2) sheet and Enter w/o any change, the formula will be
updated to the correct value. Trying to force call formula calculation from
menu does not help to update the cell value. 

Same error / same behavior occurs when copying existing cells to new cells. 

In the attached example cell A11 is the cell.setCellFormlua mentioned above.
Column D is copied from column A using the FormulaParser for the formula cells.
As mentioned, the same code works for 4.0.1 but is broken in 4.1.0

-- 
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 63845] Forumla not evaluated in 4.1.0

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
Can you also share the source code that you use to produce the resulting file
out of the source file?

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #2 from Joern Muehlencord <jo...@muehlencord.de> ---
Created attachment 36828
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36828&action=edit
source file

-- 
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 63845] Forumla not evaluated in 4.1.0

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

Joern Muehlencord <jo...@muehlencord.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #8 from PJ Fanning <fa...@yahoo.com> ---
As a workaround, could you add this before saving the workbook (wb)?

  XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(xb);
  evaluator.evaluateAll();

-- 
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 63845] Forumla not evaluated in 4.1.0

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |regression
                 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 63845] Forumla not evaluated in 4.1.0

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cowwoc2020@gmail.com

--- Comment #12 from Dominik Stadler <do...@gmx.at> ---
*** Bug 63339 has been marked as a duplicate of this bug. ***

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #5 from Joern Muehlencord <jo...@muehlencord.de> ---
Created attachment 36907
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36907&action=edit
Test case

-- 
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 63845] Forumla not evaluated in 4.1.0

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

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

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

--- Comment #11 from Dominik Stadler <do...@gmx.at> ---
I applied a fix via r1875837 which hopefully fixes this, unfortunately it is a
quite complicated how formula values are handled across the different types of
spreadsheets, please verify this locally to ensure it is fixed for you before
we roll this into a release.

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #10 from Dominik Stadler <do...@gmx.at> ---
Using Git bisect points at the following commit causing this:

r1852246

Date:   Sat Jan 26 19:41:25 2019 +0000

    made call Cell.setCellType(CellType.FORMULA) illegall. Deprecated
Cell.setCellType(). Purged all redundant calls from project.

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #4 from Joern Muehlencord <jo...@muehlencord.de> ---
As written, it is basically just 

Cell cell = row.createCell (0, CellType.FORMULA); 
cell.setCellFormula("SUM(A3:A5)");

See attached test test class (I skipped the copy column part just to keep the
test class simple).

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #6 from PJ Fanning <fa...@yahoo.com> ---
Comment on attachment 36826
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36826
file created using 4.1.0, cell formulas are not calculated when opening the
file

there does appear to a diff in behaviour between poi-4.0.0 and poi-4.1.1.

in a similar test, poi-4.1.1 wrote `<c r="B3"
t="n"><f>SUM(A1:A3)</f><v>0.0</v></c>` but poi-4.0.0 wrote `<c
r="B3"><f>SUM(A1:A3)</f></c>`.

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #1 from Joern Muehlencord <jo...@muehlencord.de> ---
Created attachment 36827
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36827&action=edit
file created using 4.0.1

-- 
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 63845] Forumla not evaluated in 4.1.0

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pvladislavs@gmail.com

--- Comment #13 from Dominik Stadler <do...@gmx.at> ---
*** Bug 64768 has been marked as a duplicate of this bug. ***

-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #7 from PJ Fanning <fa...@yahoo.com> ---
in my example, the value should be as the 3 values in the sum are 1,2,3.

-- 
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 63845] Forumla not evaluated in 4.1.0

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |63339


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=63339
[Bug 63339] Setting cached formula result corrupts workbook
-- 
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 63845] Forumla not evaluated in 4.1.0

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

--- Comment #9 from Joern Muehlencord <jo...@muehlencord.de> ---
the workaround helps to get the forumla calculated in both 4.1.0 and 4.1.1.

-- 
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 63845] Forumla not evaluated in 4.1.0

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

Petr Michálek <mi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michalek.petr@gmail.com

-- 
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