public final class XSSFFormulaUtils extends Object
Constructor and Description |
---|
XSSFFormulaUtils(XSSFWorkbook wb) |
Modifier and Type | Method and Description |
---|---|
void |
updateSheetName(int sheetIndex,
String name)
Update sheet name in all formulas and named ranges.
|
public XSSFFormulaUtils(XSSFWorkbook wb)
public void updateSheetName(int sheetIndex, 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 © 2020. All rights reserved.