diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java index d2d135b3e2..67a7a3dbb8 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java @@ -138,9 +138,9 @@ public final class XSSFCell extends CellBase { /** * Copy cell value, formula and style, from srcCell per cell copy policy * If srcCell is null, clears the cell value and cell style per cell copy policy - * + * * This does not shift references in formulas. Use {@link org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter} to shift references in formulas. - * + * * @param srcCell The cell to take value, formula and style from * @param policy The policy for copying the information, see {@link CellCopyPolicy} * @throws IllegalArgumentException if copy cell style and srcCell is from a different workbook @@ -190,12 +190,12 @@ public final class XSSFCell extends CellBase { setBlank(); } } - + // Copy CellStyle if (policy.isCopyCellStyle()) { setCellStyle(srcCell == null ? null : srcCell.getCellStyle()); } - + final Hyperlink srcHyperlink = (srcCell == null) ? null : srcCell.getHyperlink(); if (policy.isMergeHyperlink()) { @@ -444,7 +444,7 @@ public final class XSSFCell extends CellBase { // existing behavior - create a new XSSFEvaluationWorkbook for every call return getCellFormula(null); } - + /** * package/hierarchy use only - reuse an existing evaluation workbook if available for caching * @@ -513,7 +513,7 @@ public final class XSSFCell extends CellBase { * To set the precalculated value use {@link #setCellValue(double)} or {@link #setCellValue(String)} *

*

- * Note, if there are any shared formulas, his will invalidate any + * Note, if there are any shared formulas, his will invalidate any * {@link FormulaEvaluator} instances based on this workbook. *

* @@ -539,11 +539,7 @@ public final class XSSFCell extends CellBase { private void setFormula(String formula, FormulaType formulaType) { XSSFWorkbook wb = _row.getSheet().getWorkbook(); if (formulaType == FormulaType.ARRAY && formula == null) { - wb.onDeleteFormula(this); - if (_cell.isSetF()) { - _row.getSheet().onDeleteFormula(this, null); - _cell.unsetF(); - } + removeFormulaImpl(); return; } @@ -630,7 +626,7 @@ public final class XSSFCell extends CellBase { * *

To change the style of a cell without affecting other cells that use the same style, * use {@link org.apache.poi.ss.util.CellUtil#setCellStyleProperties(Cell, java.util.Map)}

- * + * * @param style reference contained in the workbook. * If the value is null then the style information is removed causing the cell to used the default workbook style. * @throws IllegalArgumentException if style belongs to a different styles source (most likely because style is from a different Workbook) @@ -649,7 +645,7 @@ public final class XSSFCell extends CellBase { _cell.setS(idx); } } - + /** * POI currently supports these formula types: *