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 2021/12/08 12:52:27 UTC

[Bug 65730] New: DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

            Bug ID: 65730
           Summary: DataFormatter should format cell values on cells that
                    have formulas but no formula evaluator provided
           Product: POI
           Version: 5.0.x-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: fanningpj@yahoo.com
  Target Milestone: ---

POI does not implement all functions and there are bugs reported regularly. We
have little hope of getting close to total coverage.

This is the method and javadoc that I plan to change:

    /**
     * <p>
     * Returns the formatted value of a cell as a {@code String} regardless
     * of the cell type. If the Excel format pattern cannot be parsed then the
     * cell value will be formatted using a default format.
     * </p>
     * <p>When passed a null or blank cell, this method will return an empty
     * String (""). Formulas in formula type cells will not be evaluated.
     * </p>
     *
     * @param cell The cell
     * @return the formatted cell value as a String
     */
    public String formatCellValue(Cell cell) {
        return formatCellValue(cell, null);
    }

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
I've added DataFormatter setUseCachedValuesForFormulaCells - if there is no
cached value, it returns the cell formula (which is the legacy behaviour). -
r1895699

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
I will follow up with extra test coverage over the coming days.

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
The excel file will usually have a cached value stored on the cell. We can
still fail if this cached value is missing.

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
The current code returns the formula if the formula evaluator is not set - so I
don't want to break backward compatibility.

Maybe better to add a boolean param which says whether to prefer the cached
values.

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #6 from PJ Fanning <fa...@yahoo.com> ---
This issue was raised based on comments in
https://stackoverflow.com/questions/70260410/generic-way-to-parse-excel-files

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
See bug #45404 for the original contribution, which is where the formula logic
first came from

I'd lean towards a boolean when you create the DataFormatter, similar to how we
do for CSV stuff and locales, probably with a getter and setter for later
changes. That's probably easier to use than overriding the format method

If there's no cached value, I guess we return something like #N/A (error type
0x2a)?

-- 
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 65730] DataFormatter should format cell values on cells that have formulas but no formula evaluator provided

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

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