You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/11/27 21:54:04 UTC

svn commit: r885006 - in /poi/trunk/src: java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/record/formula/ java/org/apache/poi/ss/util/ ooxml/java/org/apache/poi/xssf/usermodel/

Author: josh
Date: Fri Nov 27 20:54:03 2009
New Revision: 885006

URL: http://svn.apache.org/viewvc?rev=885006&view=rev
Log:
minor changes - initial work on bugzilla 48292 (support for array formulas)

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java
    poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java?rev=885006&r1=885005&r2=885006&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java Fri Nov 27 20:54:03 2009
@@ -24,7 +24,7 @@
 /**
  * Common base class for {@link SharedFormulaRecord}, {@link ArrayRecord} and
  * {@link TableRecord} which are have similarities.
- * 
+ *
  * @author Josh Micich
  */
 public abstract class SharedValueRecordBase extends StandardRecord {
@@ -32,6 +32,9 @@
 	private CellRangeAddress8Bit _range;
 
 	protected SharedValueRecordBase(CellRangeAddress8Bit range) {
+		if (range == null) {
+			throw new IllegalArgumentException("range must be supplied.");
+		}
 		_range = range;
 	}
 
@@ -46,6 +49,9 @@
 		_range = new CellRangeAddress8Bit(in);
 	}
 
+	/**
+	 * @return the range of cells that this record is shared across.  Never <code>null</code>.
+	 */
 	public final CellRangeAddress8Bit getRange() {
 		return _range;
 	}
@@ -85,13 +91,13 @@
 	 */
 	public final boolean isInRange(int rowIx, int colIx) {
 		CellRangeAddress8Bit r = _range;
-		return r.getFirstRow() <= rowIx 
+		return r.getFirstRow() <= rowIx
 			&& r.getLastRow() >= rowIx
-			&& r.getFirstColumn() <= colIx 
+			&& r.getFirstColumn() <= colIx
 			&& r.getLastColumn() >= colIx;
 	}
 	/**
-	 * @return <code>true</code> if (rowIx, colIx) describes the first cell in this shared value 
+	 * @return <code>true</code> if (rowIx, colIx) describes the first cell in this shared value
 	 * object's range ({@link #getRange()})
 	 */
 	public final boolean isFirstCell(int rowIx, int colIx) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java?rev=885006&r1=885005&r2=885006&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java Fri Nov 27 20:54:03 2009
@@ -30,41 +30,42 @@
 public final class ExpPtg extends ControlPtg {
     private final static int  SIZE = 5;
     public final static short sid  = 0x1;
-    private final short            field_1_first_row;
-    private final short            field_2_first_col;
+    private final int field_1_first_row;
+    private final int field_2_first_col;
 
-    public ExpPtg(LittleEndianInput in) 
-    {
+    public ExpPtg(LittleEndianInput in) {
       field_1_first_row = in.readShort();
       field_2_first_col = in.readShort();
     }
 
+    public ExpPtg(int firstRow, int firstCol) {
+      this.field_1_first_row = firstRow;
+      this.field_2_first_col = firstCol;
+    }
+
     public void write(LittleEndianOutput out) {
         out.writeByte(sid + getPtgClass());
         out.writeShort(field_1_first_row);
         out.writeShort(field_2_first_col);
     }
 
-    public int getSize()
-    {
+    public int getSize() {
         return SIZE;
     }
 
-    public short getRow() {
+    public int getRow() {
       return field_1_first_row;
     }
 
-    public short getColumn() {
+    public int getColumn() {
       return field_2_first_col;
     }
 
-    public String toFormulaString()
-    {
+    public String toFormulaString() {
         throw new RecordFormatException("Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula by ValueRecordsAggregate, but it wasn't");
     }
 
-    public String toString()
-    {
+    public String toString() {
         StringBuffer buffer = new StringBuffer("[Array Formula or Shared Formula]\n");
         buffer.append("row = ").append(getRow()).append("\n");
         buffer.append("col = ").append(getColumn()).append("\n");

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java?rev=885006&r1=885005&r2=885006&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java Fri Nov 27 20:54:03 2009
@@ -6,7 +6,7 @@
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+	   http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,13 +18,14 @@
 package org.apache.poi.ss.util;
 
 import org.apache.poi.ss.SpreadsheetVersion;
+import org.apache.poi.ss.usermodel.Cell;
 
 
 /**
  * See OOO documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address'<p/>
- * 
+ *
  * Common subclass of 8-bit and 16-bit versions
- * 
+ *
  * @author Josh Micich
  */
 public abstract class CellRangeAddressBase {
@@ -41,44 +42,44 @@
 		_lastCol = lastCol;
 	}
 
-    /**
-     * Validate the range limits against the supplied version of Excel
-     *
-     * @param ssVersion the version of Excel to validate against
-     * @throws IllegalArgumentException if the range limits are outside of the allowed range
-     */
-    public void validate(SpreadsheetVersion ssVersion) {
-        validateRow(_firstRow, ssVersion);
+	/**
+	 * Validate the range limits against the supplied version of Excel
+	 *
+	 * @param ssVersion the version of Excel to validate against
+	 * @throws IllegalArgumentException if the range limits are outside of the allowed range
+	 */
+	public void validate(SpreadsheetVersion ssVersion) {
+		validateRow(_firstRow, ssVersion);
 		validateRow(_lastRow, ssVersion);
-        validateColumn(_firstCol, ssVersion);
+		validateColumn(_firstCol, ssVersion);
 		validateColumn(_lastCol, ssVersion);
 	}
-    /**
-     * Runs a bounds check for row numbers
-     * @param row
-     */
-    private static void validateRow(int row, SpreadsheetVersion ssVersion) {
-        int maxrow = ssVersion.getLastRowIndex();
-        if (row > maxrow) throw new IllegalArgumentException("Maximum row number is " + maxrow);
-        if (row < 0) throw new IllegalArgumentException("Minumum row number is 0");
-    }
-
-    /**
-     * Runs a bounds check for column numbers
-     * @param column
-     */
-    private static void validateColumn(int column, SpreadsheetVersion ssVersion) {
-        int maxcol = ssVersion.getLastColumnIndex();
-        if (column > maxcol) throw new IllegalArgumentException("Maximum column number is " + maxcol);
-        if (column < 0)    throw new IllegalArgumentException("Minimum column number is 0");
-    }
+	/**
+	 * Runs a bounds check for row numbers
+	 * @param row
+	 */
+	private static void validateRow(int row, SpreadsheetVersion ssVersion) {
+		int maxrow = ssVersion.getLastRowIndex();
+		if (row > maxrow) throw new IllegalArgumentException("Maximum row number is " + maxrow);
+		if (row < 0) throw new IllegalArgumentException("Minumum row number is 0");
+	}
+
+	/**
+	 * Runs a bounds check for column numbers
+	 * @param column
+	 */
+	private static void validateColumn(int column, SpreadsheetVersion ssVersion) {
+		int maxcol = ssVersion.getLastColumnIndex();
+		if (column > maxcol) throw new IllegalArgumentException("Maximum column number is " + maxcol);
+		if (column < 0)	throw new IllegalArgumentException("Minimum column number is 0");
+	}
 
 
-    //TODO use the correct SpreadsheetVersion
-    public final boolean isFullColumnRange() {
+	//TODO use the correct SpreadsheetVersion
+	public final boolean isFullColumnRange() {
 		return _firstRow == 0 && _lastRow == SpreadsheetVersion.EXCEL97.getLastRowIndex();
 	}
-    //TODO use the correct SpreadsheetVersion
+	//TODO use the correct SpreadsheetVersion
 	public final boolean isFullRowRange() {
 		return _firstCol == 0 && _lastCol == SpreadsheetVersion.EXCEL97.getLastColumnIndex();
 	}
@@ -111,6 +112,11 @@
 		return _lastRow;
 	}
 
+	public boolean isInRange(int rowInd, int colInd) {
+		return _firstRow <= rowInd  &&  rowInd <= _lastRow &&
+				_firstCol <= colInd && colInd <= _lastCol;
+	}
+
 	/**
 	 * @param firstCol column number for the upper left hand corner
 	 */
@@ -138,12 +144,12 @@
 	public final void setLastRow(int lastRow) {
 		_lastRow = lastRow;
 	}
-    /**
-     * @return the size of the range (number of cells in the area).
-     */
-    public int getNumberOfCells() {
-        return (_lastRow - _firstRow + 1) * (_lastCol - _firstCol + 1);
-    }
+	/**
+	 * @return the size of the range (number of cells in the area).
+	 */
+	public int getNumberOfCells() {
+		return (_lastRow - _firstRow + 1) * (_lastCol - _firstCol + 1);
+	}
 
 	public final String toString() {
 		CellReference crA = new CellReference(_firstRow, _firstCol);

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=885006&r1=885005&r2=885006&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Fri Nov 27 20:54:03 2009
@@ -888,7 +888,7 @@
                 int sstIndex = Integer.parseInt(_cell.getV());
                 XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
                 String text = rt.getString();
-                return Boolean.valueOf(text);
+                return Boolean.parseBoolean(text);
             case CELL_TYPE_NUMERIC:
                 return Double.parseDouble(_cell.getV()) != 0;
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=885006&r1=885005&r2=885006&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Fri Nov 27 20:54:03 2009
@@ -39,6 +39,7 @@
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
 import org.apache.poi.ss.SpreadsheetVersion;
+import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Footer;
 import org.apache.poi.ss.usermodel.Header;
@@ -364,8 +365,8 @@
 
     /**
      * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
-     * @param colSplit	  Horizonatal position of split.
-     * @param rowSplit	  Vertical position of split.
+     * @param colSplit      Horizonatal position of split.
+     * @param rowSplit      Vertical position of split.
      */
     public void createFreezePane(int colSplit, int rowSplit) {
         createFreezePane( colSplit, rowSplit, colSplit, rowSplit );
@@ -373,9 +374,9 @@
 
     /**
      * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
-     * @param colSplit	  Horizonatal position of split.
-     * @param rowSplit	  Vertical position of split.
-     * @param topRow		Top row visible in bottom pane
+     * @param colSplit      Horizonatal position of split.
+     * @param rowSplit      Vertical position of split.
+     * @param topRow        Top row visible in bottom pane
      * @param leftmostColumn   Left column visible in right pane.
      */
     public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) {
@@ -430,12 +431,12 @@
 
     /**
      * Creates a split pane. Any existing freezepane or split pane is overwritten.
-     * @param xSplitPos	  Horizonatal position of split (in 1/20th of a point).
-     * @param ySplitPos	  Vertical position of split (in 1/20th of a point).
-     * @param topRow		Top row visible in bottom pane
+     * @param xSplitPos      Horizonatal position of split (in 1/20th of a point).
+     * @param ySplitPos      Vertical position of split (in 1/20th of a point).
+     * @param topRow        Top row visible in bottom pane
      * @param leftmostColumn   Left column visible in right pane.
-     * @param activePane	Active pane.  One of: PANE_LOWER_RIGHT,
-     *					  PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
+     * @param activePane    Active pane.  One of: PANE_LOWER_RIGHT,
+     *                      PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
      * @see org.apache.poi.ss.usermodel.Sheet#PANE_LOWER_LEFT
      * @see org.apache.poi.ss.usermodel.Sheet#PANE_LOWER_RIGHT
      * @see org.apache.poi.ss.usermodel.Sheet#PANE_UPPER_LEFT
@@ -1333,125 +1334,125 @@
     }
 
     public void setColumnGroupCollapsed(int columnNumber, boolean collapsed) {
-    	if (collapsed) {
-    		collapseColumn(columnNumber);
-    	} else {
-    		expandColumn(columnNumber);
-    	}
+        if (collapsed) {
+            collapseColumn(columnNumber);
+        } else {
+            expandColumn(columnNumber);
+        }
     }
 
     private void collapseColumn(int columnNumber) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	CTCol col = columnHelper.getColumn(columnNumber, false);
-    	int colInfoIx = columnHelper.getIndexOfColumn(cols, col);
-    	if (colInfoIx == -1) {
-    		return;
-    	}
-    	// Find the start of the group.
-    	int groupStartColInfoIx = findStartOfColumnOutlineGroup(colInfoIx);
-
-    	CTCol columnInfo = cols.getColArray(groupStartColInfoIx);
-
-    	// Hide all the columns until the end of the group
-    	int lastColMax = setGroupHidden(groupStartColInfoIx, columnInfo
-    			.getOutlineLevel(), true);
+        CTCols cols = worksheet.getColsArray(0);
+        CTCol col = columnHelper.getColumn(columnNumber, false);
+        int colInfoIx = columnHelper.getIndexOfColumn(cols, col);
+        if (colInfoIx == -1) {
+            return;
+        }
+        // Find the start of the group.
+        int groupStartColInfoIx = findStartOfColumnOutlineGroup(colInfoIx);
+
+        CTCol columnInfo = cols.getColArray(groupStartColInfoIx);
+
+        // Hide all the columns until the end of the group
+        int lastColMax = setGroupHidden(groupStartColInfoIx, columnInfo
+                .getOutlineLevel(), true);
 
-    	// write collapse field
-    	setColumn(lastColMax + 1, null, 0, null, null, Boolean.TRUE);
+        // write collapse field
+        setColumn(lastColMax + 1, null, 0, null, null, Boolean.TRUE);
 
     }
 
     private void setColumn(int targetColumnIx, Short xfIndex, Integer style,
-    		Integer level, Boolean hidden, Boolean collapsed) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	CTCol ci = null;
-    	int k = 0;
-    	for (k = 0; k < cols.sizeOfColArray(); k++) {
-    		CTCol tci = cols.getColArray(k);
-    		if (tci.getMin() >= targetColumnIx
-    				&& tci.getMax() <= targetColumnIx) {
-    			ci = tci;
-    			break;
-    		}
-    		if (tci.getMin() > targetColumnIx) {
-    			// call column infos after k are for later columns
-    			break; // exit now so k will be the correct insert pos
-    		}
-    	}
-
-    	if (ci == null) {
-    		// okay so there ISN'T a column info record that covers this column
-    		// so lets create one!
-    		CTCol nci = CTCol.Factory.newInstance();
-    		nci.setMin(targetColumnIx);
-    		nci.setMax(targetColumnIx);
-    		unsetCollapsed(collapsed, nci);
-    		this.columnHelper.addCleanColIntoCols(cols, nci);
-    		return;
-    	}
-
-    	boolean styleChanged = style != null
-    	&& ci.getStyle() != style;
-    	boolean levelChanged = level != null
-    	&& ci.getOutlineLevel() != level;
-    	boolean hiddenChanged = hidden != null
-    	&& ci.getHidden() != hidden;
-    	boolean collapsedChanged = collapsed != null
-    	&& ci.getCollapsed() != collapsed;
-    	boolean columnChanged = levelChanged || hiddenChanged
-    	|| collapsedChanged || styleChanged;
-    	if (!columnChanged) {
-    		// do nothing...nothing changed.
-    		return;
-    	}
-
-    	if (ci.getMin() == targetColumnIx && ci.getMax() == targetColumnIx) {
-    		// ColumnInfo ci for a single column, the target column
-    		unsetCollapsed(collapsed, ci);
-    		return;
-    	}
-
-    	if (ci.getMin() == targetColumnIx || ci.getMax() == targetColumnIx) {
-    		// The target column is at either end of the multi-column ColumnInfo
-    		// ci
-    		// we'll just divide the info and create a new one
-    		if (ci.getMin() == targetColumnIx) {
-    			ci.setMin(targetColumnIx + 1);
-    		} else {
-    			ci.setMax(targetColumnIx - 1);
-    			k++; // adjust insert pos to insert after
-    		}
-    		CTCol nci = columnHelper.cloneCol(cols, ci);
-    		nci.setMin(targetColumnIx);
-    		unsetCollapsed(collapsed, nci);
-    		this.columnHelper.addCleanColIntoCols(cols, nci);
-
-    	} else {
-    		// split to 3 records
-    		CTCol ciStart = ci;
-    		CTCol ciMid = columnHelper.cloneCol(cols, ci);
-    		CTCol ciEnd = columnHelper.cloneCol(cols, ci);
-    		int lastcolumn = (int) ci.getMax();
-
-    		ciStart.setMax(targetColumnIx - 1);
-
-    		ciMid.setMin(targetColumnIx);
-    		ciMid.setMax(targetColumnIx);
-    		unsetCollapsed(collapsed, ciMid);
-    		this.columnHelper.addCleanColIntoCols(cols, ciMid);
-
-    		ciEnd.setMin(targetColumnIx + 1);
-    		ciEnd.setMax(lastcolumn);
-    		this.columnHelper.addCleanColIntoCols(cols, ciEnd);
-    	}
+            Integer level, Boolean hidden, Boolean collapsed) {
+        CTCols cols = worksheet.getColsArray(0);
+        CTCol ci = null;
+        int k = 0;
+        for (k = 0; k < cols.sizeOfColArray(); k++) {
+            CTCol tci = cols.getColArray(k);
+            if (tci.getMin() >= targetColumnIx
+                    && tci.getMax() <= targetColumnIx) {
+                ci = tci;
+                break;
+            }
+            if (tci.getMin() > targetColumnIx) {
+                // call column infos after k are for later columns
+                break; // exit now so k will be the correct insert pos
+            }
+        }
+
+        if (ci == null) {
+            // okay so there ISN'T a column info record that covers this column
+            // so lets create one!
+            CTCol nci = CTCol.Factory.newInstance();
+            nci.setMin(targetColumnIx);
+            nci.setMax(targetColumnIx);
+            unsetCollapsed(collapsed, nci);
+            this.columnHelper.addCleanColIntoCols(cols, nci);
+            return;
+        }
+
+        boolean styleChanged = style != null
+        && ci.getStyle() != style;
+        boolean levelChanged = level != null
+        && ci.getOutlineLevel() != level;
+        boolean hiddenChanged = hidden != null
+        && ci.getHidden() != hidden;
+        boolean collapsedChanged = collapsed != null
+        && ci.getCollapsed() != collapsed;
+        boolean columnChanged = levelChanged || hiddenChanged
+        || collapsedChanged || styleChanged;
+        if (!columnChanged) {
+            // do nothing...nothing changed.
+            return;
+        }
+
+        if (ci.getMin() == targetColumnIx && ci.getMax() == targetColumnIx) {
+            // ColumnInfo ci for a single column, the target column
+            unsetCollapsed(collapsed, ci);
+            return;
+        }
+
+        if (ci.getMin() == targetColumnIx || ci.getMax() == targetColumnIx) {
+            // The target column is at either end of the multi-column ColumnInfo
+            // ci
+            // we'll just divide the info and create a new one
+            if (ci.getMin() == targetColumnIx) {
+                ci.setMin(targetColumnIx + 1);
+            } else {
+                ci.setMax(targetColumnIx - 1);
+                k++; // adjust insert pos to insert after
+            }
+            CTCol nci = columnHelper.cloneCol(cols, ci);
+            nci.setMin(targetColumnIx);
+            unsetCollapsed(collapsed, nci);
+            this.columnHelper.addCleanColIntoCols(cols, nci);
+
+        } else {
+            // split to 3 records
+            CTCol ciStart = ci;
+            CTCol ciMid = columnHelper.cloneCol(cols, ci);
+            CTCol ciEnd = columnHelper.cloneCol(cols, ci);
+            int lastcolumn = (int) ci.getMax();
+
+            ciStart.setMax(targetColumnIx - 1);
+
+            ciMid.setMin(targetColumnIx);
+            ciMid.setMax(targetColumnIx);
+            unsetCollapsed(collapsed, ciMid);
+            this.columnHelper.addCleanColIntoCols(cols, ciMid);
+
+            ciEnd.setMin(targetColumnIx + 1);
+            ciEnd.setMax(lastcolumn);
+            this.columnHelper.addCleanColIntoCols(cols, ciEnd);
+        }
     }
 
     private void unsetCollapsed(boolean collapsed, CTCol ci) {
-    	if (collapsed) {
-    		ci.setCollapsed(collapsed);
-    	} else {
-    		ci.unsetCollapsed();
-    	}
+        if (collapsed) {
+            ci.setCollapsed(collapsed);
+        } else {
+            ci.unsetCollapsed();
+        }
     }
 
     /**
@@ -1463,188 +1464,188 @@
      * @return the column index of the last column in the outline group
      */
     private int setGroupHidden(int pIdx, int level, boolean hidden) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	int idx = pIdx;
-    	CTCol columnInfo = cols.getColArray(idx);
-    	while (idx < cols.sizeOfColArray()) {
-    		columnInfo.setHidden(hidden);
-    		if (idx + 1 < cols.sizeOfColArray()) {
-    			CTCol nextColumnInfo = cols.getColArray(idx + 1);
-
-    			if (!isAdjacentBefore(columnInfo, nextColumnInfo)) {
-    				break;
-    			}
-
-    			if (nextColumnInfo.getOutlineLevel() < level) {
-    				break;
-    			}
-    			columnInfo = nextColumnInfo;
-    		}
-    		idx++;
-    	}
-    	return (int) columnInfo.getMax();
+        CTCols cols = worksheet.getColsArray(0);
+        int idx = pIdx;
+        CTCol columnInfo = cols.getColArray(idx);
+        while (idx < cols.sizeOfColArray()) {
+            columnInfo.setHidden(hidden);
+            if (idx + 1 < cols.sizeOfColArray()) {
+                CTCol nextColumnInfo = cols.getColArray(idx + 1);
+
+                if (!isAdjacentBefore(columnInfo, nextColumnInfo)) {
+                    break;
+                }
+
+                if (nextColumnInfo.getOutlineLevel() < level) {
+                    break;
+                }
+                columnInfo = nextColumnInfo;
+            }
+            idx++;
+        }
+        return (int) columnInfo.getMax();
     }
 
     private boolean isAdjacentBefore(CTCol col, CTCol other_col) {
-    	return (col.getMax() == (other_col.getMin() - 1));
+        return (col.getMax() == (other_col.getMin() - 1));
     }
 
     private int findStartOfColumnOutlineGroup(int pIdx) {
-    	// Find the start of the group.
-    	CTCols cols = worksheet.getColsArray(0);
-    	CTCol columnInfo = cols.getColArray(pIdx);
-    	int level = columnInfo.getOutlineLevel();
-    	int idx = pIdx;
-    	while (idx != 0) {
-    		CTCol prevColumnInfo = cols.getColArray(idx - 1);
-    		if (!isAdjacentBefore(prevColumnInfo, columnInfo)) {
-    			break;
-    		}
-    		if (prevColumnInfo.getOutlineLevel() < level) {
-    			break;
-    		}
-    		idx--;
-    		columnInfo = prevColumnInfo;
-    	}
-    	return idx;
+        // Find the start of the group.
+        CTCols cols = worksheet.getColsArray(0);
+        CTCol columnInfo = cols.getColArray(pIdx);
+        int level = columnInfo.getOutlineLevel();
+        int idx = pIdx;
+        while (idx != 0) {
+            CTCol prevColumnInfo = cols.getColArray(idx - 1);
+            if (!isAdjacentBefore(prevColumnInfo, columnInfo)) {
+                break;
+            }
+            if (prevColumnInfo.getOutlineLevel() < level) {
+                break;
+            }
+            idx--;
+            columnInfo = prevColumnInfo;
+        }
+        return idx;
     }
 
     private int findEndOfColumnOutlineGroup(int colInfoIndex) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	// Find the end of the group.
-    	CTCol columnInfo = cols.getColArray(colInfoIndex);
-    	int level = columnInfo.getOutlineLevel();
-    	int idx = colInfoIndex;
-    	while (idx < cols.sizeOfColArray() - 1) {
-    		CTCol nextColumnInfo = cols.getColArray(idx + 1);
-    		if (!isAdjacentBefore(columnInfo, nextColumnInfo)) {
-    			break;
-    		}
-    		if (nextColumnInfo.getOutlineLevel() < level) {
-    			break;
-    		}
-    		idx++;
-    		columnInfo = nextColumnInfo;
-    	}
-    	return idx;
+        CTCols cols = worksheet.getColsArray(0);
+        // Find the end of the group.
+        CTCol columnInfo = cols.getColArray(colInfoIndex);
+        int level = columnInfo.getOutlineLevel();
+        int idx = colInfoIndex;
+        while (idx < cols.sizeOfColArray() - 1) {
+            CTCol nextColumnInfo = cols.getColArray(idx + 1);
+            if (!isAdjacentBefore(columnInfo, nextColumnInfo)) {
+                break;
+            }
+            if (nextColumnInfo.getOutlineLevel() < level) {
+                break;
+            }
+            idx++;
+            columnInfo = nextColumnInfo;
+        }
+        return idx;
     }
 
     private void expandColumn(int columnIndex) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	CTCol col = columnHelper.getColumn(columnIndex, false);
-    	int colInfoIx = columnHelper.getIndexOfColumn(cols, col);
-
-    	int idx = findColInfoIdx((int) col.getMax(), colInfoIx);
-    	if (idx == -1) {
-    		return;
-    	}
-
-    	// If it is already expanded do nothing.
-    	if (!isColumnGroupCollapsed(idx)) {
-    		return;
-    	}
-
-    	// Find the start/end of the group.
-    	int startIdx = findStartOfColumnOutlineGroup(idx);
-    	int endIdx = findEndOfColumnOutlineGroup(idx);
-
-    	// expand:
-    	// colapsed bit must be unset
-    	// hidden bit gets unset _if_ surrounding groups are expanded you can
-    	// determine
-    	// this by looking at the hidden bit of the enclosing group. You will
-    	// have
-    	// to look at the start and the end of the current group to determine
-    	// which
-    	// is the enclosing group
-    	// hidden bit only is altered for this outline level. ie. don't
-    	// uncollapse contained groups
-    	CTCol columnInfo = cols.getColArray(endIdx);
-    	if (!isColumnGroupHiddenByParent(idx)) {
-    		int outlineLevel = columnInfo.getOutlineLevel();
-    		boolean nestedGroup = false;
-    		for (int i = startIdx; i <= endIdx; i++) {
-    			CTCol ci = cols.getColArray(i);
-    			if (outlineLevel == ci.getOutlineLevel()) {
-    				ci.unsetHidden();
-    				if (nestedGroup) {
-    					nestedGroup = false;
-    					ci.setCollapsed(true);
-    				}
-    			} else {
-    				nestedGroup = true;
-    			}
-    		}
-    	}
-    	// Write collapse flag (stored in a single col info record after this
-    	// outline group)
-    	setColumn((int) columnInfo.getMax() + 1, null, null, null,
-    			Boolean.FALSE, Boolean.FALSE);
+        CTCols cols = worksheet.getColsArray(0);
+        CTCol col = columnHelper.getColumn(columnIndex, false);
+        int colInfoIx = columnHelper.getIndexOfColumn(cols, col);
+
+        int idx = findColInfoIdx((int) col.getMax(), colInfoIx);
+        if (idx == -1) {
+            return;
+        }
+
+        // If it is already expanded do nothing.
+        if (!isColumnGroupCollapsed(idx)) {
+            return;
+        }
+
+        // Find the start/end of the group.
+        int startIdx = findStartOfColumnOutlineGroup(idx);
+        int endIdx = findEndOfColumnOutlineGroup(idx);
+
+        // expand:
+        // colapsed bit must be unset
+        // hidden bit gets unset _if_ surrounding groups are expanded you can
+        // determine
+        // this by looking at the hidden bit of the enclosing group. You will
+        // have
+        // to look at the start and the end of the current group to determine
+        // which
+        // is the enclosing group
+        // hidden bit only is altered for this outline level. ie. don't
+        // uncollapse contained groups
+        CTCol columnInfo = cols.getColArray(endIdx);
+        if (!isColumnGroupHiddenByParent(idx)) {
+            int outlineLevel = columnInfo.getOutlineLevel();
+            boolean nestedGroup = false;
+            for (int i = startIdx; i <= endIdx; i++) {
+                CTCol ci = cols.getColArray(i);
+                if (outlineLevel == ci.getOutlineLevel()) {
+                    ci.unsetHidden();
+                    if (nestedGroup) {
+                        nestedGroup = false;
+                        ci.setCollapsed(true);
+                    }
+                } else {
+                    nestedGroup = true;
+                }
+            }
+        }
+        // Write collapse flag (stored in a single col info record after this
+        // outline group)
+        setColumn((int) columnInfo.getMax() + 1, null, null, null,
+                Boolean.FALSE, Boolean.FALSE);
     }
 
     private boolean isColumnGroupHiddenByParent(int idx) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	// Look out outline details of end
-    	int endLevel = 0;
-    	boolean endHidden = false;
-    	int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
-    	if (endOfOutlineGroupIdx < cols.sizeOfColArray()) {
-    		CTCol nextInfo = cols.getColArray(endOfOutlineGroupIdx + 1);
-    		if (isAdjacentBefore(cols.getColArray(endOfOutlineGroupIdx),
-    				nextInfo)) {
-    			endLevel = nextInfo.getOutlineLevel();
-    			endHidden = nextInfo.getHidden();
-    		}
-    	}
-    	// Look out outline details of start
-    	int startLevel = 0;
-    	boolean startHidden = false;
-    	int startOfOutlineGroupIdx = findStartOfColumnOutlineGroup(idx);
-    	if (startOfOutlineGroupIdx > 0) {
-    		CTCol prevInfo = cols.getColArray(startOfOutlineGroupIdx - 1);
-
-    		if (isAdjacentBefore(prevInfo, cols
-    				.getColArray(startOfOutlineGroupIdx))) {
-    			startLevel = prevInfo.getOutlineLevel();
-    			startHidden = prevInfo.getHidden();
-    		}
-
-    	}
-    	if (endLevel > startLevel) {
-    		return endHidden;
-    	}
-    	return startHidden;
+        CTCols cols = worksheet.getColsArray(0);
+        // Look out outline details of end
+        int endLevel = 0;
+        boolean endHidden = false;
+        int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
+        if (endOfOutlineGroupIdx < cols.sizeOfColArray()) {
+            CTCol nextInfo = cols.getColArray(endOfOutlineGroupIdx + 1);
+            if (isAdjacentBefore(cols.getColArray(endOfOutlineGroupIdx),
+                    nextInfo)) {
+                endLevel = nextInfo.getOutlineLevel();
+                endHidden = nextInfo.getHidden();
+            }
+        }
+        // Look out outline details of start
+        int startLevel = 0;
+        boolean startHidden = false;
+        int startOfOutlineGroupIdx = findStartOfColumnOutlineGroup(idx);
+        if (startOfOutlineGroupIdx > 0) {
+            CTCol prevInfo = cols.getColArray(startOfOutlineGroupIdx - 1);
+
+            if (isAdjacentBefore(prevInfo, cols
+                    .getColArray(startOfOutlineGroupIdx))) {
+                startLevel = prevInfo.getOutlineLevel();
+                startHidden = prevInfo.getHidden();
+            }
+
+        }
+        if (endLevel > startLevel) {
+            return endHidden;
+        }
+        return startHidden;
     }
 
     private int findColInfoIdx(int columnValue, int fromColInfoIdx) {
-    	CTCols cols = worksheet.getColsArray(0);
+        CTCols cols = worksheet.getColsArray(0);
 
-    	if (columnValue < 0) {
-    		throw new IllegalArgumentException(
-    				"column parameter out of range: " + columnValue);
-    	}
-    	if (fromColInfoIdx < 0) {
-    		throw new IllegalArgumentException(
-    				"fromIdx parameter out of range: " + fromColInfoIdx);
-    	}
-
-    	for (int k = fromColInfoIdx; k < cols.sizeOfColArray(); k++) {
-    		CTCol ci = cols.getColArray(k);
-
-    		if (containsColumn(ci, columnValue)) {
-    			return k;
-    		}
-
-    		if (ci.getMin() > fromColInfoIdx) {
-    			break;
-    		}
+        if (columnValue < 0) {
+            throw new IllegalArgumentException(
+                    "column parameter out of range: " + columnValue);
+        }
+        if (fromColInfoIdx < 0) {
+            throw new IllegalArgumentException(
+                    "fromIdx parameter out of range: " + fromColInfoIdx);
+        }
+
+        for (int k = fromColInfoIdx; k < cols.sizeOfColArray(); k++) {
+            CTCol ci = cols.getColArray(k);
+
+            if (containsColumn(ci, columnValue)) {
+                return k;
+            }
 
-    	}
-    	return -1;
+            if (ci.getMin() > fromColInfoIdx) {
+                break;
+            }
+
+        }
+        return -1;
     }
 
     private boolean containsColumn(CTCol col, int columnIndex) {
-    	return col.getMin() <= columnIndex && columnIndex <= col.getMax();
+        return col.getMin() <= columnIndex && columnIndex <= col.getMax();
     }
 
     /**
@@ -1655,20 +1656,20 @@
      * @return a boolean represented if the column is collapsed
      */
     private boolean isColumnGroupCollapsed(int idx) {
-    	CTCols cols = worksheet.getColsArray(0);
-    	int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
-    	int nextColInfoIx = endOfOutlineGroupIdx + 1;
-    	if (nextColInfoIx >= cols.sizeOfColArray()) {
-    		return false;
-    	}
-    	CTCol nextColInfo = cols.getColArray(nextColInfoIx);
-
-    	CTCol col = cols.getColArray(endOfOutlineGroupIdx);
-    	if (!isAdjacentBefore(col, nextColInfo)) {
-    		return false;
-    	}
+        CTCols cols = worksheet.getColsArray(0);
+        int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
+        int nextColInfoIx = endOfOutlineGroupIdx + 1;
+        if (nextColInfoIx >= cols.sizeOfColArray()) {
+            return false;
+        }
+        CTCol nextColInfo = cols.getColArray(nextColInfoIx);
 
-    	return nextColInfo.getCollapsed();
+        CTCol col = cols.getColArray(endOfOutlineGroupIdx);
+        if (!isAdjacentBefore(col, nextColInfo)) {
+            return false;
+        }
+
+        return nextColInfo.getCollapsed();
     }
 
     /**
@@ -1796,162 +1797,162 @@
      *                boolean value for collapse
      */
     public void setRowGroupCollapsed(int rowIndex, boolean collapse) {
-    	if (collapse) {
-    		collapseRow(rowIndex);
-    	} else {
-    		expandRow(rowIndex);
-    	}
+        if (collapse) {
+            collapseRow(rowIndex);
+        } else {
+            expandRow(rowIndex);
+        }
     }
 
     /**
      * @param rowIndex the zero based row index to collapse
      */
     private void collapseRow(int rowIndex) {
-    	XSSFRow row = getRow(rowIndex);
-    	if (row != null) {
-    		int startRow = findStartOfRowOutlineGroup(rowIndex);
-
-    		// Hide all the columns until the end of the group
-    		int lastRow = writeHidden(row, startRow, true);
-    		if (getRow(lastRow) != null) {
-    			getRow(lastRow).getCTRow().setCollapsed(true);
-    		} else {
-    			XSSFRow newRow = createRow(lastRow);
-    			newRow.getCTRow().setCollapsed(true);
-    		}
-    	}
+        XSSFRow row = getRow(rowIndex);
+        if (row != null) {
+            int startRow = findStartOfRowOutlineGroup(rowIndex);
+
+            // Hide all the columns until the end of the group
+            int lastRow = writeHidden(row, startRow, true);
+            if (getRow(lastRow) != null) {
+                getRow(lastRow).getCTRow().setCollapsed(true);
+            } else {
+                XSSFRow newRow = createRow(lastRow);
+                newRow.getCTRow().setCollapsed(true);
+            }
+        }
     }
 
     /**
      * @param rowIndex the zero based row index to find from
      */
     private int findStartOfRowOutlineGroup(int rowIndex) {
-    	// Find the start of the group.
-    	int level = getRow(rowIndex).getCTRow().getOutlineLevel();
-    	int currentRow = rowIndex;
-    	while (getRow(currentRow) != null) {
-    		if (getRow(currentRow).getCTRow().getOutlineLevel() < level)
-    			return currentRow + 1;
-    		currentRow--;
-    	}
-    	return currentRow;
+        // Find the start of the group.
+        int level = getRow(rowIndex).getCTRow().getOutlineLevel();
+        int currentRow = rowIndex;
+        while (getRow(currentRow) != null) {
+            if (getRow(currentRow).getCTRow().getOutlineLevel() < level)
+                return currentRow + 1;
+            currentRow--;
+        }
+        return currentRow;
     }
 
     private int writeHidden(XSSFRow xRow, int rowIndex, boolean hidden) {
-    	int level = xRow.getCTRow().getOutlineLevel();
-    	for (Iterator<Row> it = rowIterator(); it.hasNext();) {
-    		xRow = (XSSFRow) it.next();
-    		if (xRow.getCTRow().getOutlineLevel() >= level) {
-    			xRow.getCTRow().setHidden(hidden);
-    			rowIndex++;
-    		}
+        int level = xRow.getCTRow().getOutlineLevel();
+        for (Iterator<Row> it = rowIterator(); it.hasNext();) {
+            xRow = (XSSFRow) it.next();
+            if (xRow.getCTRow().getOutlineLevel() >= level) {
+                xRow.getCTRow().setHidden(hidden);
+                rowIndex++;
+            }
 
-    	}
-    	return rowIndex;
+        }
+        return rowIndex;
     }
 
     /**
      * @param rowNumber the zero based row index to expand
      */
     private void expandRow(int rowNumber) {
-    	if (rowNumber == -1)
-    		return;
-    	XSSFRow row = getRow(rowNumber);
-    	// If it is already expanded do nothing.
-    	if (!row.getCTRow().isSetHidden())
-    		return;
-
-    	// Find the start of the group.
-    	int startIdx = findStartOfRowOutlineGroup(rowNumber);
-
-    	// Find the end of the group.
-    	int endIdx = findEndOfRowOutlineGroup(rowNumber);
-
-    	// expand:
-    	// collapsed must be unset
-    	// hidden bit gets unset _if_ surrounding groups are expanded you can
-    	// determine
-    	// this by looking at the hidden bit of the enclosing group. You will
-    	// have
-    	// to look at the start and the end of the current group to determine
-    	// which
-    	// is the enclosing group
-    	// hidden bit only is altered for this outline level. ie. don't
-    	// un-collapse contained groups
-    	if (!isRowGroupHiddenByParent(rowNumber)) {
-    		for (int i = startIdx; i < endIdx; i++) {
-    			if (row.getCTRow().getOutlineLevel() == getRow(i).getCTRow()
-    					.getOutlineLevel()) {
-    				getRow(i).getCTRow().unsetHidden();
-    			} else if (!isRowGroupCollapsed(i)) {
-    				getRow(i).getCTRow().unsetHidden();
-    			}
-    		}
-    	}
-    	// Write collapse field
-    	getRow(endIdx).getCTRow().unsetCollapsed();
+        if (rowNumber == -1)
+            return;
+        XSSFRow row = getRow(rowNumber);
+        // If it is already expanded do nothing.
+        if (!row.getCTRow().isSetHidden())
+            return;
+
+        // Find the start of the group.
+        int startIdx = findStartOfRowOutlineGroup(rowNumber);
+
+        // Find the end of the group.
+        int endIdx = findEndOfRowOutlineGroup(rowNumber);
+
+        // expand:
+        // collapsed must be unset
+        // hidden bit gets unset _if_ surrounding groups are expanded you can
+        // determine
+        // this by looking at the hidden bit of the enclosing group. You will
+        // have
+        // to look at the start and the end of the current group to determine
+        // which
+        // is the enclosing group
+        // hidden bit only is altered for this outline level. ie. don't
+        // un-collapse contained groups
+        if (!isRowGroupHiddenByParent(rowNumber)) {
+            for (int i = startIdx; i < endIdx; i++) {
+                if (row.getCTRow().getOutlineLevel() == getRow(i).getCTRow()
+                        .getOutlineLevel()) {
+                    getRow(i).getCTRow().unsetHidden();
+                } else if (!isRowGroupCollapsed(i)) {
+                    getRow(i).getCTRow().unsetHidden();
+                }
+            }
+        }
+        // Write collapse field
+        getRow(endIdx).getCTRow().unsetCollapsed();
     }
 
     /**
      * @param row the zero based row index to find from
      */
     public int findEndOfRowOutlineGroup(int row) {
-    	int level = getRow(row).getCTRow().getOutlineLevel();
-    	int currentRow;
-    	for (currentRow = row; currentRow < getLastRowNum(); currentRow++) {
-    		if (getRow(currentRow) == null
-    				|| getRow(currentRow).getCTRow().getOutlineLevel() < level) {
-    			break;
-    		}
-    	}
-    	return currentRow;
+        int level = getRow(row).getCTRow().getOutlineLevel();
+        int currentRow;
+        for (currentRow = row; currentRow < getLastRowNum(); currentRow++) {
+            if (getRow(currentRow) == null
+                    || getRow(currentRow).getCTRow().getOutlineLevel() < level) {
+                break;
+            }
+        }
+        return currentRow;
     }
 
     /**
      * @param row the zero based row index to find from
      */
     private boolean isRowGroupHiddenByParent(int row) {
-    	// Look out outline details of end
-    	int endLevel;
-    	boolean endHidden;
-    	int endOfOutlineGroupIdx = findEndOfRowOutlineGroup(row);
-    	if (getRow(endOfOutlineGroupIdx) == null) {
-    		endLevel = 0;
-    		endHidden = false;
-    	} else {
-    		endLevel = getRow(endOfOutlineGroupIdx).getCTRow().getOutlineLevel();
-    		endHidden = getRow(endOfOutlineGroupIdx).getCTRow().getHidden();
-    	}
-
-    	// Look out outline details of start
-    	int startLevel;
-    	boolean startHidden;
-    	int startOfOutlineGroupIdx = findStartOfRowOutlineGroup(row);
-    	if (startOfOutlineGroupIdx < 0
-    			|| getRow(startOfOutlineGroupIdx) == null) {
-    		startLevel = 0;
-    		startHidden = false;
-    	} else {
-    		startLevel = getRow(startOfOutlineGroupIdx).getCTRow()
-    		.getOutlineLevel();
-    		startHidden = getRow(startOfOutlineGroupIdx).getCTRow()
-    		.getHidden();
-    	}
-    	if (endLevel > startLevel) {
-    		return endHidden;
-    	}
-    	return startHidden;
+        // Look out outline details of end
+        int endLevel;
+        boolean endHidden;
+        int endOfOutlineGroupIdx = findEndOfRowOutlineGroup(row);
+        if (getRow(endOfOutlineGroupIdx) == null) {
+            endLevel = 0;
+            endHidden = false;
+        } else {
+            endLevel = getRow(endOfOutlineGroupIdx).getCTRow().getOutlineLevel();
+            endHidden = getRow(endOfOutlineGroupIdx).getCTRow().getHidden();
+        }
+
+        // Look out outline details of start
+        int startLevel;
+        boolean startHidden;
+        int startOfOutlineGroupIdx = findStartOfRowOutlineGroup(row);
+        if (startOfOutlineGroupIdx < 0
+                || getRow(startOfOutlineGroupIdx) == null) {
+            startLevel = 0;
+            startHidden = false;
+        } else {
+            startLevel = getRow(startOfOutlineGroupIdx).getCTRow()
+            .getOutlineLevel();
+            startHidden = getRow(startOfOutlineGroupIdx).getCTRow()
+            .getHidden();
+        }
+        if (endLevel > startLevel) {
+            return endHidden;
+        }
+        return startHidden;
     }
 
     /**
      * @param row the zero based row index to find from
      */
     private boolean isRowGroupCollapsed(int row) {
-    	int collapseRow = findEndOfRowOutlineGroup(row) + 1;
-    	if (getRow(collapseRow) == null) {
-			return false;
-		}
-    	return getRow(collapseRow).getCTRow().getCollapsed();
+        int collapseRow = findEndOfRowOutlineGroup(row) + 1;
+        if (getRow(collapseRow) == null) {
+            return false;
+        }
+        return getRow(collapseRow).getCTRow().getCollapsed();
     }
 
     /**
@@ -1959,7 +1960,7 @@
      * fraction.  For example to express a zoom of 75% use 3 for the numerator
      * and 4 for the denominator.
      *
-     * @param numerator	 The numerator for the zoom magnification.
+     * @param numerator     The numerator for the zoom magnification.
      * @param denominator   The denominator for the zoom magnification.
      * @see #setZoom(int)
      */
@@ -2081,7 +2082,7 @@
     public void showInPane(short toprow, short leftcol) {
         CellReference cellReference = new CellReference(toprow, leftcol);
         String cellRef = cellReference.formatAsString();
-		getPane().setTopLeftCell(cellRef);
+        getPane().setTopLeftCell(cellRef);
     }
 
     public void ungroupColumn(int fromColumn, int toColumn) {
@@ -2361,307 +2362,307 @@
         worksheet.save(out, xmlOptions);
     }
 
-	/**
-	 * @return true when Autofilters are locked and the sheet is protected.
-	 */
-	public boolean isAutoFilterLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getAutoFilter();
-	}
-
-	/**
-	 * @return true when Deleting columns is locked and the sheet is protected.
-	 */
-	public boolean isDeleteColumnsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getDeleteColumns();
-	}
-
-	/**
-	 * @return true when Deleting rows is locked and the sheet is protected.
-	 */
-	public boolean isDeleteRowsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getDeleteRows();
-	}
-	
-	/**
-	 * @return true when Formatting cells is locked and the sheet is protected.
-	 */
-	public boolean isFormatCellsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatCells();
-	}
-
-	/**
-	 * @return true when Formatting columns is locked and the sheet is protected.
-	 */
-	public boolean isFormatColumnsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatColumns();
-	}
-
-	/**
-	 * @return true when Formatting rows is locked and the sheet is protected.
-	 */
-	public boolean isFormatRowsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatRows();
-	}
-
-	/**
-	 * @return true when Inserting columns is locked and the sheet is protected.
-	 */
-	public boolean isInsertColumnsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertColumns();
-	}
-
-	/**
-	 * @return true when Inserting hyperlinks is locked and the sheet is protected.
-	 */
-	public boolean isInsertHyperlinksLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertHyperlinks();
-	}
-
-	/**
-	 * @return true when Inserting rows is locked and the sheet is protected.
-	 */
-	public boolean isInsertRowsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertRows();
-	}
-
-	/**
-	 * @return true when Pivot tables are locked and the sheet is protected.
-	 */
-	public boolean isPivotTablesLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getPivotTables();
-	}
-
-	/**
-	 * @return true when Sorting is locked and the sheet is protected.
-	 */
-	public boolean isSortLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getSort();
-	}
-
-	/**
-	 * @return true when Objects are locked and the sheet is protected.
-	 */
-	public boolean isObjectsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getObjects();
-	}
-
-	/**
-	 * @return true when Scenarios are locked and the sheet is protected.
-	 */
-	public boolean isScenariosLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getScenarios();
-	}
-
-	/**
-	 * @return true when Selection of locked cells is locked and the sheet is protected.
-	 */
-	public boolean isSelectLockedCellsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getSelectLockedCells();
-	}
-
-	/**
-	 * @return true when Selection of unlocked cells is locked and the sheet is protected.
-	 */
-	public boolean isSelectUnlockedCellsLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getSelectUnlockedCells();
-	}
-
-	/**
-	 * @return true when Sheet is Protected.
-	 */
-	public boolean isSheetLocked() {
-		createProtectionFieldIfNotPresent();
-		return sheetProtectionEnabled() && worksheet.getSheetProtection().getSheet();
-	}
-
-	/**
-	 * Enable sheet protection
-	 */
-	public void enableLocking() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setSheet(true);
-	}
-	
-	/**
-	 * Disable sheet protection
-	 */
-	public void disableLocking() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setSheet(false);
-	}
-	
-	/**
-	 * Enable Autofilters locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockAutoFilter() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setAutoFilter(true);
-	}
-	
-	/**
-	 * Enable Deleting columns locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockDeleteColumns() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setDeleteColumns(true);
-	}
-
-	/**
-	 * Enable Deleting rows locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockDeleteRows() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setDeleteRows(true);		
-	}
-	
-	/**
-	 * Enable Formatting cells locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockFormatCells() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setDeleteColumns(true);	
-	}
-
-	/**
-	 * Enable Formatting columns locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockFormatColumns() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setFormatColumns(true);	
-	}
-
-	/**
-	 * Enable Formatting rows locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockFormatRows() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setFormatRows(true);	
-	}
-
-	/**
-	 * Enable Inserting columns locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockInsertColumns() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setInsertColumns(true);	
-	}
-
-	/**
-	 * Enable Inserting hyperlinks locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockInsertHyperlinks() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setInsertHyperlinks(true);	
-	}
-
-	/**
-	 * Enable Inserting rows locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockInsertRows() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setInsertRows(true);	
-	}
-
-	/**
-	 * Enable Pivot Tables locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockPivotTables() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setPivotTables(true);	
-	}
-
-	/**
-	 * Enable Sort locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockSort() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setSort(true);	
-	}
-
-	/**
-	 * Enable Objects locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockObjects() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setObjects(true);	
-	}
-
-	/**
-	 * Enable Scenarios locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockScenarios() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setScenarios(true);	
-	}
-
-	/**
-	 * Enable Selection of locked cells locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockSelectLockedCells() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setSelectLockedCells(true);	
-	}
-
-	/**
-	 * Enable Selection of unlocked cells locking.
-	 * This does not modify sheet protection status.
-	 * To enforce this locking, call {@link #enableLocking()}
-	 */
-	public void lockSelectUnlockedCells() {
-		createProtectionFieldIfNotPresent();
-		worksheet.getSheetProtection().setSelectUnlockedCells(true);
-	}
-
-	private void createProtectionFieldIfNotPresent() {
-		if (worksheet.getSheetProtection() == null) {
-			worksheet.setSheetProtection(CTSheetProtection.Factory.newInstance());
-		}
-	}
-	
-	private boolean sheetProtectionEnabled() {
-		return worksheet.getSheetProtection().getSheet();
-	}
+    /**
+     * @return true when Autofilters are locked and the sheet is protected.
+     */
+    public boolean isAutoFilterLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getAutoFilter();
+    }
+
+    /**
+     * @return true when Deleting columns is locked and the sheet is protected.
+     */
+    public boolean isDeleteColumnsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getDeleteColumns();
+    }
+
+    /**
+     * @return true when Deleting rows is locked and the sheet is protected.
+     */
+    public boolean isDeleteRowsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getDeleteRows();
+    }
+
+    /**
+     * @return true when Formatting cells is locked and the sheet is protected.
+     */
+    public boolean isFormatCellsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatCells();
+    }
+
+    /**
+     * @return true when Formatting columns is locked and the sheet is protected.
+     */
+    public boolean isFormatColumnsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatColumns();
+    }
+
+    /**
+     * @return true when Formatting rows is locked and the sheet is protected.
+     */
+    public boolean isFormatRowsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getFormatRows();
+    }
+
+    /**
+     * @return true when Inserting columns is locked and the sheet is protected.
+     */
+    public boolean isInsertColumnsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertColumns();
+    }
+
+    /**
+     * @return true when Inserting hyperlinks is locked and the sheet is protected.
+     */
+    public boolean isInsertHyperlinksLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertHyperlinks();
+    }
+
+    /**
+     * @return true when Inserting rows is locked and the sheet is protected.
+     */
+    public boolean isInsertRowsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getInsertRows();
+    }
+
+    /**
+     * @return true when Pivot tables are locked and the sheet is protected.
+     */
+    public boolean isPivotTablesLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getPivotTables();
+    }
+
+    /**
+     * @return true when Sorting is locked and the sheet is protected.
+     */
+    public boolean isSortLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getSort();
+    }
+
+    /**
+     * @return true when Objects are locked and the sheet is protected.
+     */
+    public boolean isObjectsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getObjects();
+    }
+
+    /**
+     * @return true when Scenarios are locked and the sheet is protected.
+     */
+    public boolean isScenariosLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getScenarios();
+    }
+
+    /**
+     * @return true when Selection of locked cells is locked and the sheet is protected.
+     */
+    public boolean isSelectLockedCellsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getSelectLockedCells();
+    }
+
+    /**
+     * @return true when Selection of unlocked cells is locked and the sheet is protected.
+     */
+    public boolean isSelectUnlockedCellsLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getSelectUnlockedCells();
+    }
+
+    /**
+     * @return true when Sheet is Protected.
+     */
+    public boolean isSheetLocked() {
+        createProtectionFieldIfNotPresent();
+        return sheetProtectionEnabled() && worksheet.getSheetProtection().getSheet();
+    }
+
+    /**
+     * Enable sheet protection
+     */
+    public void enableLocking() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setSheet(true);
+    }
+
+    /**
+     * Disable sheet protection
+     */
+    public void disableLocking() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setSheet(false);
+    }
+
+    /**
+     * Enable Autofilters locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockAutoFilter() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setAutoFilter(true);
+    }
+
+    /**
+     * Enable Deleting columns locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockDeleteColumns() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setDeleteColumns(true);
+    }
+
+    /**
+     * Enable Deleting rows locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockDeleteRows() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setDeleteRows(true);
+    }
+
+    /**
+     * Enable Formatting cells locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockFormatCells() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setDeleteColumns(true);
+    }
+
+    /**
+     * Enable Formatting columns locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockFormatColumns() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setFormatColumns(true);
+    }
+
+    /**
+     * Enable Formatting rows locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockFormatRows() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setFormatRows(true);
+    }
+
+    /**
+     * Enable Inserting columns locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockInsertColumns() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setInsertColumns(true);
+    }
+
+    /**
+     * Enable Inserting hyperlinks locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockInsertHyperlinks() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setInsertHyperlinks(true);
+    }
+
+    /**
+     * Enable Inserting rows locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockInsertRows() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setInsertRows(true);
+    }
+
+    /**
+     * Enable Pivot Tables locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockPivotTables() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setPivotTables(true);
+    }
+
+    /**
+     * Enable Sort locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockSort() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setSort(true);
+    }
+
+    /**
+     * Enable Objects locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockObjects() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setObjects(true);
+    }
+
+    /**
+     * Enable Scenarios locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockScenarios() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setScenarios(true);
+    }
+
+    /**
+     * Enable Selection of locked cells locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockSelectLockedCells() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setSelectLockedCells(true);
+    }
+
+    /**
+     * Enable Selection of unlocked cells locking.
+     * This does not modify sheet protection status.
+     * To enforce this locking, call {@link #enableLocking()}
+     */
+    public void lockSelectUnlockedCells() {
+        createProtectionFieldIfNotPresent();
+        worksheet.getSheetProtection().setSelectUnlockedCells(true);
+    }
+
+    private void createProtectionFieldIfNotPresent() {
+        if (worksheet.getSheetProtection() == null) {
+            worksheet.setSheetProtection(CTSheetProtection.Factory.newInstance());
+        }
+    }
+
+    private boolean sheetProtectionEnabled() {
+        return worksheet.getSheetProtection().getSheet();
+    }
 }



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