Bug 49896

Summary: issue with getCellFormula() - Excel workbook name and path in vlookup functions
Product: POI Reporter: Rahul Kini <rahuld14>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.5-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Bug Depends on:    
Bug Blocks: 45970    
Attachments: File dst2.xls - contains a column2 with cell values linked to anohter workbook src1.xls
Src1.xls is referred to from dst2.xls

Description Rahul Kini 2010-09-08 07:39:24 UTC
=> Create an excel file, say destn.xls with a column which has reference to another excel file say source.xls (Give complete path to the source.xls - something like - "=VLOOKUP(A1,'C:\[Source.XLS]Sheet1'!$A$2:$B$3,2,0)") 
=> Execute the following code:
java.io.FileInputStream fs= new java.io.FileInputStream("C:/test/Destn.xls");
org.apache.poi.ss.usermodel.Workbook wb = org.apache.poi.ss.usermodel.WorkbookFactory.create(fs);
org.apache.poi.ss.usermodel.Sheet sheet = wb.getSheetAt(0);
Row row = sheet.getRow(1);
org.apache.poi.ss.usermodel.Cell cell = row.getCell(1);//assuming this cell has the vlookup formula in your excel file
if(cell != null && cell.getCellType()==Cell.CELL_TYPE_FORMULA)
{
	System.out.println("Cell formula:"+cell.getCellFormula());
}

It gives result as VLOOKUP(A1,'[Source.XLS]Sheet1'!A:B,2,0)
The issue is because org.apache.poi.hssf.record.SupBookRecord.decodeFileName(String) does not seem to be implemented fully
Comment 1 Rahul Kini 2010-09-08 23:49:54 UTC
Created attachment 26005 [details]
File dst2.xls - contains a column2 with cell values linked to anohter workbook src1.xls
Comment 2 Rahul Kini 2010-09-08 23:50:47 UTC
Created attachment 26006 [details]
Src1.xls is referred to from dst2.xls
Comment 3 Yegor Kozlov 2012-02-03 08:51:23 UTC
The patch in Bug 52576 fully implements SupBookRecord.decodeFileName.
Comment 4 Yegor Kozlov 2012-02-10 08:27:56 UTC
The problem should be fixed in r1242701

Yegor