First patch changes name check in getSheet that Excel aparently expects
to be case sensitive (I'm using an Excell workbook saved out of Excel
2002).

The second changes "private getWorkbook" to "public getWorkbook".  The
reason is that in formula parsing you need to pass in a workbook to
resolve forumla references to other sheets.  If you start with a
HFSSWorkbook right out a file, there's no way to get at the Workbook
since the method is private.  Made it public and formula parsing seems
to work a lot better now.  

I can submit my little example formula parser if you like.

Eric 
Index: jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
===================================================================
RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java,v
retrieving revision 1.7
diff -u -r1.7 HSSFWorkbook.java
--- jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java	23 Apr 2002 22:24:41 -0000	1.7
+++ jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java	12 Jul 2002 01:56:41 -0000
@@ -316,7 +316,8 @@
     }
 
     /**
-     * Get sheet with the given name
+     * Get sheet with the given name ignoring case.  Sheet references in 
+     * formulas don't appear to be case sensitive.
      * @param name of the sheet
      * @return HSSFSheet with the name provided or null if it does not exist
      */
@@ -329,7 +330,7 @@
         {
             String sheetname = workbook.getSheetName(k);
 
-            if (sheetname.equals(name))
+            if (sheetname.equalsIgnoreCase(name))
             {
                 retval = (HSSFSheet) sheets.get(k);
             }
@@ -539,12 +540,19 @@
         return workbook.getSSTString(index);
     }
 
-    Workbook getWorkbook()
-    {
+    /** gets the internal workbook representation of this HFSSWorkbook
+      * @retun internal workbook
+      */
+    public Workbook getWorkbook()
+    {
+        // Changed this to a public function.  Formula parsing isn't 
+	// very usefull if you start with a HSSFWorkbook and want to
+	// parse the formulas, especially if they use references to
+	// other sheets in the workbook.
         return workbook;
     }
     
-    /** gets the total number of named ranges in the workboko
+    /** gets the total number of named ranges in the workbook
      * @return number of named ranges
      */    
     public int getNumberOfNames(){

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to