From 7dac4c1daec7cedba4894742b1f3c25fab434370 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 29 Apr 2022 13:07:00 +0000 Subject: [PATCH] [bug-66039] add more javadoc about setCellFormulaValidation git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1900383 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java | 2 ++ poi/src/main/java/org/apache/poi/ss/usermodel/Cell.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index bc678d2c8d..f5ac4e18b6 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -2485,6 +2485,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su /** * Whether a call to {@link XSSFCell#setCellFormula(String)} will validate the formula or not. + * When enabled (which is the default), this option can lead to formulas being modified by POI formula renderer. * * @param value true if the application will validate the formula is correct * @since 3.17 @@ -2495,6 +2496,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su /** * Whether a call to {@link XSSFCell#setCellFormula(String)} will validate the formula or not. + * When enabled (which is the default), this option can lead to formulas being modified by POI formula renderer. * * @since 3.17 */ diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/Cell.java b/poi/src/main/java/org/apache/poi/ss/usermodel/Cell.java index a4130d51e6..63c358e40c 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/Cell.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/Cell.java @@ -232,10 +232,14 @@ public interface Cell { * *

If the cell was blank, sets value to 0. Otherwise, preserves the value as precalculated.

* + *

In XSSF implementation, there is a XSSFWorkbook.setCellFormulaValidation(boolean) + * setting that can validate (but also in some cases, reformat) the formula.

+ * * @param formula the formula to set, e.g. "SUM(C4:E4)". * If the argument is null then the current formula is removed. * * @see Cell#removeFormula + * @see Workbook#setForceFormulaRecalculation(boolean) * @throws IllegalStateException if this cell is a part of an array formula group containing other cells * @throws FormulaParseException if the formula has incorrect syntax or is otherwise invalid */