/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ @Override public void evaluateAll() { evaluateAllFormulaCells(_book, this); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(HSSFWorkbook wb) { evaluateAllFormulaCells(wb, new HSSFFormulaEvaluator(wb)); }
@Override public PoiWorkbook refreshFormulas() { HSSFFormulaEvaluator.evaluateAllFormulaCells(workbook); return this; }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ @Override public void evaluateAll() { evaluateAllFormulaCells(_book, this); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public void evaluateAll() { evaluateAllFormulaCells(_book, this); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public void evaluateAll() { HSSFFormulaEvaluator.evaluateAllFormulaCells(_book); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public void evaluateAll() { evaluateAllFormulaCells(_book, this); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(XSSFWorkbook wb) { HSSFFormulaEvaluator.evaluateAllFormulaCells((Workbook)wb); } /**
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(HSSFWorkbook wb) { evaluateAllFormulaCells(wb, new HSSFFormulaEvaluator(wb)); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(HSSFWorkbook wb) { evaluateAllFormulaCells(wb, new HSSFFormulaEvaluator(wb)); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(HSSFWorkbook wb) { evaluateAllFormulaCells(wb, new HSSFFormulaEvaluator(wb)); }
private Workbook getWorkBook() throws IOException { Workbook excelWorkbook; String extension = file.getName().toUpperCase(ENGLISH); try (FileInputStream excelFile = new FileInputStream(file)) { if (extension.endsWith(Extension.XLSX.value) || extension.endsWith(Extension.XLSM.value)) { excelWorkbook = new XSSFWorkbook(excelFile); XSSFFormulaEvaluator.evaluateAllFormulaCells(excelWorkbook); } else if (extension.endsWith(Extension.XLS.value)) { excelWorkbook = new HSSFWorkbook(excelFile); HSSFFormulaEvaluator.evaluateAllFormulaCells(excelWorkbook); } else { FileFormatException e = new FileFormatException(format("%s is not a valid excel file.", file.getName())); LOGGER.error(e.getMessage()); throw e; } } catch (Exception e) { LOGGER.error(e.getMessage()); throw e; } return excelWorkbook; }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(Workbook wb) { FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); evaluateAllFormulaCells(wb, evaluator); } private static void evaluateAllFormulaCells(Workbook wb, FormulaEvaluator evaluator) {
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public static void evaluateAllFormulaCells(Workbook wb) { FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); evaluateAllFormulaCells(wb, evaluator); } private static void evaluateAllFormulaCells(Workbook wb, FormulaEvaluator evaluator) {