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

--- Comment #3 from wuchu <qjch...@126.com> ---
Finally,I add addExternalWorkbook function in XSSFWorkbook.java  to add
ExternalWorkbook to XSSFCreationHelper.referencedWorkbooks  and add some codes:

   formulaEvaluatorHashMap.put("test1.xlsx",
WorkbookFactory.create(file).getCreationHelper().createFormulaEvaluator());
((XSSFWorkbook)workbook).addExternalWorkbook("test1.xlsx",                     
             
WorkbookFactory.create(file).getCreationHelper().createFormulaEvaluator()));

  then that's OK.
  But in BaseXSSFFormulaEvaluator.cacheExternalWorkbookCells(),there not check
the row is null or cell is null .and there will throw null Exception.
so there add if check: 
     int nullRowCont = 0;
                        for (int rowIndex = firstRow; rowIndex <= lastRow;
rowIndex++) {
                            XSSFRow row = sheet.getRow(rowIndex);
                            int firstColumn = area3DPxg.getFirstColumn();
                            int lastColumn = area3DPxg.getLastColumn();

//                            System.out.println("+++++row+++:"+rowIndex+"
**row**:"+row);
                            if(null!=row) {
                                for (int cellIndex = firstColumn; cellIndex <=
lastColumn; cellIndex++) {
//                                    System.out.println("*****cellIndex*****:"
+ cellIndex);
                                    XSSFCell cell = row.getCell(cellIndex);

//                                    System.out.println("*****cellvalue*$$$$:"
+ cell);
                                    String cellValue = "";
                                    String cellR = "";
                                    if (null != cell) {
                                        cellValue = cell.getRawValue();
                                        cellR = new
CellReference(cell).formatAsString(false);
                                       
externalLinksTable.cacheData(sheet.getSheetName(), (long) rowIndex + 1, cellR,
cellValue);
                                    }

                                }
                            }else {
                                nullRowCont++;
                            }
                            if(nullRowCont>20){
                                break;
                            }

                        }

-- 
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