ASF Bugzilla – Attachment 34953 Details for
Bug 61033
[PATCH] Add Workbook.setCellFormulaValidation to control whether formulas are validated during Cell.setCellFormula or not
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-Add-XSSFWorkbook.setCellFormulaValidation-to-control.patch
0001-Add-XSSFWorkbook.setCellFormulaValidation-to-control.patch (text/plain), 2.96 KB, created by
Travis Burtrum
on 2017-04-26 18:16:25 UTC
(
hide
)
Description:
0001-Add-XSSFWorkbook.setCellFormulaValidation-to-control.patch
Filename:
MIME Type:
Creator:
Travis Burtrum
Created:
2017-04-26 18:16:25 UTC
Size:
2.96 KB
patch
obsolete
>From 34fe9a15dfd76c2088129ae9f9ce8fd477abf71d Mon Sep 17 00:00:00 2001 >From: moparisthebest <admin@moparisthebest.com> >Date: Wed, 26 Apr 2017 12:55:36 -0400 >Subject: [PATCH 1/2] Add XSSFWorkbook.setCellFormulaValidation to control > whether formulas are validated during XSSFCell.setCellFormula or not > >--- > .../org/apache/poi/xssf/usermodel/XSSFCell.java | 8 +++++--- > .../apache/poi/xssf/usermodel/XSSFWorkbook.java | 24 ++++++++++++++++++++++ > 2 files changed, 29 insertions(+), 3 deletions(-) > >diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java >index a39fd47bf..e6d423e53 100644 >--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java >+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java >@@ -561,9 +561,11 @@ public final class XSSFCell implements Cell { > return; > } > >- XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb); >- //validate through the FormulaParser >- FormulaParser.parse(formula, fpb, formulaType, wb.getSheetIndex(getSheet()), getRowIndex()); >+ if(wb.getCellFormulaValidation()) { >+ XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb); >+ //validate through the FormulaParser >+ FormulaParser.parse(formula, fpb, formulaType, wb.getSheetIndex(getSheet()), getRowIndex()); >+ } > > CTCellFormula f = CTCellFormula.Factory.newInstance(); > f.setStringValue(formula); >diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java >index fecad97bc..45988e13a 100644 >--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java >+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java >@@ -209,6 +209,11 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { > private MissingCellPolicy _missingCellPolicy = MissingCellPolicy.RETURN_NULL_AND_BLANK; > > /** >+ * Whether a call to {@link XSSFCell#setCellFormula(String)} will validate the formula or not. >+ */ >+ private boolean cellFormulaValidation = true; >+ >+ /** > * array of pictures for this workbook > */ > private List<XSSFPictureData> pictures; >@@ -2470,4 +2475,23 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { > > return oleId; > } >+ >+ /** >+ * Whether a call to {@link XSSFCell#setCellFormula(String)} will validate the formula or not. >+ * >+ * @param value true if the application will validate the formula is correct >+ * @since 3.17 >+ */ >+ public void setCellFormulaValidation(final boolean value) { >+ this.cellFormulaValidation = value; >+ } >+ >+ /** >+ * Whether a call to {@link XSSFCell#setCellFormula(String)} will validate the formula or not. >+ * >+ * @since 3.17 >+ */ >+ public boolean getCellFormulaValidation() { >+ return this.cellFormulaValidation; >+ } > } >-- >2.12.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61033
:
34946
| 34953 |
34954