public final class XSSFFormulaUtils
extends java.lang.Object
Constructor | Description |
---|---|
XSSFFormulaUtils(XSSFWorkbook wb) |
Modifier and Type | Method | Description |
---|---|---|
void |
updateSheetName(int sheetIndex,
java.lang.String name) |
Update sheet name in all formulas and named ranges.
|
public XSSFFormulaUtils(XSSFWorkbook wb)
public void updateSheetName(int sheetIndex, java.lang.String name)
XSSFWorkbook.setSheetName(int, String)
The idea is to parse every formula and render it back to string with the updated sheet name. The FormulaParsingWorkbook passed to the formula parser is constructed from the old workbook (sheet name is not yet updated) and the FormulaRenderingWorkbook passed to FormulaRenderer#toFormulaString is a custom implementation that returns the new sheet name.
sheetIndex
- the 0-based index of the sheet being changedname
- the new sheet nameCopyright 2018 The Apache Software Foundation or its licensors, as applicable.