Bug 16835

Summary: HSSFName reference setting
Product: POI Reporter: Luca Billi <lucabilli>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Luca Billi 2003-02-06 10:59:57 UTC
I'm playing with POI HSSF and I'm using the jakarta-poi-1.9.0-dev-20030122 
version instead of release 1.5.1 because I need formulas support.
I've experimented some problems setting reference string in a newly created 
HSSFName. Querying your Bugzilla I found other similar issues. The problem I 
had is just described in bug 16411. But the "answer" was in bug 16315 
description. The actual behaviour is the following:

A reference like sheetName!$B$2:$E$6 appear to be wrongly parsed.
Instead sheetName.$B$2:$E$6 works.

I append a chunk of code illustrating these issues

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("MySheet");
        HSSFName name = wb.createName();
        name.setNameName("MyArea");
        name.setReference("MySheet!$B$2:$E$6");
        System.out.println(name.getReference());
//        System.out.println(name.getSheetName()); // This line would produce 
NullPointerException
        name.setReference("MySheet.$B$2:$E$6");
        System.out.println(name.getReference());
        System.out.println(name.getSheetName());

The output of this chunk is

null!$IU$2:$E$6
MySheet!$B$2:$E$6
MySheet
Comment 1 Danny Mui 2003-02-06 14:43:58 UTC
Addressed in patch: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16557

*** This bug has been marked as a duplicate of 16315 ***