Bug 49896 - issue with getCellFormula() - Excel workbook name and path in vlookup functions
Summary: issue with getCellFormula() - Excel workbook name and path in vlookup functions
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.5-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks: 45970
  Show dependency tree
 
Reported: 2010-09-08 07:39 UTC by Rahul Kini
Modified: 2012-02-10 08:27 UTC (History)
0 users



Attachments
File dst2.xls - contains a column2 with cell values linked to anohter workbook src1.xls (17.00 KB, application/vnd.ms-excel)
2010-09-08 23:49 UTC, Rahul Kini
Details
Src1.xls is referred to from dst2.xls (16.00 KB, application/vnd.ms-excel)
2010-09-08 23:50 UTC, Rahul Kini
Details

Note You need to log in before you can comment on or make changes to this bug.
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