]> source.dussan.org Git - poi.git/commitdiff
BUG 37056 & BUG 37058 fixed
authorJason Height <jheight@apache.org>
Fri, 13 Jan 2006 02:19:36 +0000 (02:19 +0000)
committerJason Height <jheight@apache.org>
Fri, 13 Jan 2006 02:19:36 +0000 (02:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@368554 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/model/Sheet.java
src/java/org/apache/poi/hssf/record/UnicodeString.java

index 1c55ab50f50913e74653c7d7655b6995490c9d40..d173ec4350567297fded87edbc618ea6f25e0064 100644 (file)
@@ -228,6 +228,10 @@ public class Sheet implements Model
             {
                 retval.printGridlines = (PrintGridlinesRecord) rec;
             }
+            else if ( rec.getSid() == GridsetRecord.sid )
+            {
+                retval.gridset = (GridsetRecord) rec;
+            }            
             else if ( rec.getSid() == HeaderRecord.sid && bofEofNestingLevel == 1)
             {
                 retval.header = (HeaderRecord) rec;
@@ -1709,6 +1713,12 @@ public class Sheet implements Model
 
     public boolean isGridsPrinted()
     {
+       if (gridset == null) {
+               gridset = (GridsetRecord)createGridset();
+               //Insert the newlycreated Gridset record at the end of the record (just before the EOF)
+               int loc = findFirstRecordLocBySid(EOFRecord.sid);
+               records.add(loc, gridset);              
+       }
         return !gridset.getGridset();
     }
 
@@ -2416,8 +2426,18 @@ public class Sheet implements Model
         return retval;
     }
 
+    /** Returns the ProtectRecord.
+     * If one is not contained in the sheet, then one is created.
+     * @return
+     */
     public ProtectRecord getProtect()
     {
+       if (protect == null) {
+               protect = (ProtectRecord)createProtect();
+               //Insert the newlycreated protect record at the end of the record (just before the EOF)
+               int loc = findFirstRecordLocBySid(EOFRecord.sid);
+               records.add(loc, protect);              
+       }
         return protect;
     }
 
index 9a40687398be126584fd9fcd08a8f1f4311abee5..e9e0afd7a2b190e9c6505afd8c167313e2145975 100644 (file)
@@ -672,7 +672,6 @@ public class UnicodeString
       }
 
         return pos - offset;
-        //jmh return getRecordSize();
     }