https://bz.apache.org/bugzilla/show_bug.cgi?id=67778

            Bug ID: 67778
           Summary: null pointer Exception for Area3Dpxg type in
                    ExternalReference in Formula Evaluation
           Product: POI
           Version: 5.2.3-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: qjch...@126.com
  Target Milestone: ---

Created attachment 39150
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39150&action=edit
the main Excle

public static void main(String[] args) {

        ZipSecureFile.setMinInflateRatio(-1.0d);

        String path = "\\apache
POI\\apachePOI\\src\\main\\resources\\test_template.xlsx";
        try{
            OutputStream os = new FileOutputStream(new File("\\apache
POI\\apachePOI\\src\\main\\resources\\extRef\\test_template_2.xlsx"));
            Workbook workbook = new XSSFWorkbook(new FileInputStream(path));
            FormulaEvaluator mainWorkbookEvaluator =
workbook.getCreationHelper().createFormulaEvaluator();
            File file = new File("\\apache
POI\\apachePOI\\src\\main\\resources\\extRef\\test1.xlsx");
            Map<String, FormulaEvaluator> formulaEvaluatorHashMap = new
HashMap<String, FormulaEvaluator>();
            formulaEvaluatorHashMap.put("report1.xlsx", mainWorkbookEvaluator);
            formulaEvaluatorHashMap.put("test1.xlsx",
WorkbookFactory.create(file).getCreationHelper().createFormulaEvaluator());
           
mainWorkbookEvaluator.setupReferencedWorkbooks(formulaEvaluatorHashMap);
            mainWorkbookEvaluator.evaluateAll();
            workbook.setForceFormulaRecalculation(false);
            workbook.write(os);
        }catch (Exception e) {
            e.printStackTrace();
        }
    }


java.lang.NullPointerException
        at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.cacheExternalWorkbookCells(BaseXSSFFormulaEvaluator.java:99)
        at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:62)
        at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateFormulaCell(BaseFormulaEvaluator.java:184)
        at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateAllFormulaCells(BaseFormulaEvaluator.java:277)
        at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateAll(XSSFFormulaEvaluator.java:100)

in BaseFormulaEvaluator.java:96 ,XSSFWorkbook externalWorkbook =(XSSFWorkbook)
xssfCell.getSheet().getWorkbook().getCreationHelper().getReferencedWorkbooks().get(externalSheet.getWorkbookName());
 getReferencedWorkbooks().size()=0,so externalWorkbook is null

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to