poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27852] New: - POI wrongly reports a name for a cell formula that references a name
Date Mon, 22 Mar 2004 17:09:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27852>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27852

POI wrongly reports a name for a cell formula that references a name

           Summary: POI wrongly reports a name for a cell formula that
                    references a name
           Product: POI
           Version: 2.0FINAL
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: brice.copy@cern.ch


POI reports invalid HSSFName that are in fact VB functions. This somehow causes
an EmptyStackException. There does not seem to be any workaround to this problem.

VB functions can accept a Name as their parameter (=a VB object of type Range).
You can reference such a VB function in a formula, like any other built-in excel
function.

When POI opens a workbook containing cells that use a formula referencing a
name, it reports a name for each formula referencing a name. Of course, the
reported HSSFName object is invalid, as its field_13_name_definition member is
an empty stack, while the field_13_raw_name_definition is null.

>From the HSSF usermodel package, there is no way to tell the difference between
a valid HSSFName (referencing a name defined in the excel workbook) and an
invalid one (referencing a function that uses a name as its argument).

When trying to access an invalid HSSFName, the following exception occurs :

java.util.EmptyStackException

	java.lang.Object java.util.Stack.peek()

		Stack.java:82

	java.lang.String
org.apache.poi.hssf.record.NameRecord.getAreaReference(org.apache.poi.hssf.model.Workbook)

		NameRecord.java:705

	java.lang.String org.apache.poi.hssf.usermodel.HSSFName.getReference()

		HSSFName.java:126


TO REPRODUCE THIS BUG :

- Save the provided test case (an excel file defining two simple functions and
two names)
- Open the test case with the attached java test case.
- If you debug, you will notice that POI reports four HSSFName objects (while
only two are defined in the excel file) 
- The test case should fail with an EmptyStackException - because POI does not
check the validity of the HSSFName object before getting its reference)

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org


Mime
View raw message