Bug 64032 - FormulaEvaluator executes IFERROR function bug
Summary: FormulaEvaluator executes IFERROR function bug
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 4.1.1-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-25 10:03 UTC by 蒋勇兵
Modified: 2020-12-30 22:07 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 蒋勇兵 2019-12-25 10:03:08 UTC
When I used the FormulaEvaluator to executes a formula,I found a bug.

The formula is 'IFERROR(VLOOKUP(C3,'2019.1'!$C$2:$AX$37,48,0),-0.001)','2019.1' in the formula is the name of the sheet I want to operate.

But when an error occurs('2019.1' doesnt exist),poi throw following exception information:

org.apache.poi.ss.formula.CollaboratingWorkbooksEnvironment$WorkbookNotFoundException: Could not resolve external workbook name '2019.1'. Workbook environment has not been set up.

Why not return -0.001 as defined in IFFERROR returned ?
Comment 1 Dominik Stadler 2020-12-30 22:07:14 UTC
There is a method for all formula-evaluators to ignore such missing workbooks, see BaseFormulaEvaluator#setIgnoreMissingWorkbooks().

Please try to use this method to configure how Apache POI behaves here. 

Please reopen tihs issue if this does not solve it in your case together with more information to reproduce it, i.e. ideally a self-contained piece of code which reproduces the situation that you encounter.