org.apache.poi.ss.usermodel
Interface Sheet

All Superinterfaces:
java.lang.Iterable<Row>
All Known Implementing Classes:
HSSFSheet, SXSSFSheet, XSSFChartSheet, XSSFDialogsheet, XSSFSheet

public interface Sheet
extends java.lang.Iterable<Row>

High level representation of a Excel worksheet.

Sheets are the central structures within a workbook, and are where a user does most of his spreadsheet work. The most common type of sheet is the worksheet, which is represented as a grid of cells. Worksheet cells can contain text, numbers, dates, and formulas. Cells can also be formatted.


Field Summary
static short BottomMargin
           
static short FooterMargin
           
static short HeaderMargin
           
static short LeftMargin
           
static byte PANE_LOWER_LEFT
           
static byte PANE_LOWER_RIGHT
           
static byte PANE_UPPER_LEFT
           
static byte PANE_UPPER_RIGHT
           
static short RightMargin
           
static short TopMargin
           
 
Method Summary
 int addMergedRegion(CellRangeAddress region)
          Adds a merged region of cells (hence those cells form one)
 void addValidationData(DataValidation dataValidation)
          Creates a data validation object
 void autoSizeColumn(int column)
          Adjusts the column width to fit the contents.
 void autoSizeColumn(int column, boolean useMergedCells)
          Adjusts the column width to fit the contents.
 Drawing createDrawingPatriarch()
          Creates the top-level drawing patriarch.
 void createFreezePane(int colSplit, int rowSplit)
          Creates a split (freezepane).
 void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
          Creates a split (freezepane).
 Row createRow(int rownum)
          Create a new row within the sheet and return the high level representation
 void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
          Creates a split pane.
 boolean getAutobreaks()
          Flag indicating whether the sheet displays Automatic Page Breaks.
 Comment getCellComment(int row, int column)
          Returns cell comment for the specified row and column
 int[] getColumnBreaks()
          Retrieves all the vertical page breaks
 CellStyle getColumnStyle(int column)
          Returns the CellStyle that applies to the given (0 based) column, or null if no style has been set for that column
 int getColumnWidth(int columnIndex)
          get the width (in units of 1/256th of a character width )
 DataValidationHelper getDataValidationHelper()
           
 int getDefaultColumnWidth()
          Get the default column width for the sheet (if the columns do not define their own width) in characters
 short getDefaultRowHeight()
          Get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
 float getDefaultRowHeightInPoints()
          Get the default row height for the sheet (if the rows do not define their own height) in points.
 boolean getDisplayGuts()
          Get whether to display the guts or not, default value is true
 int getFirstRowNum()
          Gets the first row on the sheet
 boolean getFitToPage()
          Flag indicating whether the Fit to Page print option is enabled.
 Footer getFooter()
          Gets the user model for the default document footer.
 boolean getForceFormulaRecalculation()
          Whether Excel will be asked to recalculate all formulas in this sheet when the workbook is opened.
 Header getHeader()
          Gets the user model for the default document header.
 boolean getHorizontallyCenter()
          Determine whether printed output for this sheet will be horizontally centered.
 int getLastRowNum()
          Gets the last row on the sheet
 short getLeftCol()
          The left col in the visible view when the sheet is first viewed after opening it in a viewer
 double getMargin(short margin)
          Gets the size of the margin in inches.
 CellRangeAddress getMergedRegion(int index)
          Returns the merged region at the specified index
 int getNumMergedRegions()
          Returns the number of merged regions
 PaneInformation getPaneInformation()
          Returns the information regarding the currently configured pane (split or freeze)
 int getPhysicalNumberOfRows()
          Returns the number of physically defined rows (NOT the number of rows in the sheet)
 PrintSetup getPrintSetup()
          Gets the print setup object.
 boolean getProtect()
          Answer whether protection is enabled or disabled
 Row getRow(int rownum)
          Returns the logical row (not physical) 0-based.
 int[] getRowBreaks()
          Retrieves all the horizontal page breaks
 boolean getRowSumsBelow()
          Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
 boolean getRowSumsRight()
          Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
 boolean getScenarioProtect()
          Answer whether scenario protection is enabled or disabled
 SheetConditionalFormatting getSheetConditionalFormatting()
          The 'Conditional Formatting' facet for this Sheet
 java.lang.String getSheetName()
          Returns the name of this sheet
 short getTopRow()
          The top row in the visible view when the sheet is first viewed after opening it in a viewer
 boolean getVerticallyCenter()
          Determine whether printed output for this sheet will be vertically centered.
 Workbook getWorkbook()
          Return the parent workbook
 void groupColumn(int fromColumn, int toColumn)
          Create an outline for the provided column range.
 void groupRow(int fromRow, int toRow)
          Tie a range of rows together so that they can be collapsed or expanded
 boolean isColumnBroken(int column)
          Determines if there is a page break at the indicated column
 boolean isColumnHidden(int columnIndex)
          Get the hidden state for a given column
 boolean isDisplayFormulas()
          Returns if formulas are displayed
 boolean isDisplayGridlines()
          Returns if gridlines are displayed
 boolean isDisplayRowColHeadings()
          Returns if RowColHeadings are displayed.
 boolean isDisplayZeros()
          Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.
 boolean isPrintGridlines()
          Gets the flag indicating whether this sheet displays the lines between rows and columns to make editing and reading easier.
 boolean isRightToLeft()
          Whether the text is displayed in right-to-left mode in the window
 boolean isRowBroken(int row)
          Determines if there is a page break at the indicated row
 boolean isSelected()
          Note - this is not the same as whether the sheet is focused (isActive)
 void protectSheet(java.lang.String password)
          Sets the protection enabled as well as the password
 CellRange<? extends Cell> removeArrayFormula(Cell cell)
          Remove a Array Formula from this sheet.
 void removeColumnBreak(int column)
          Removes a page break at the indicated column
 void removeMergedRegion(int index)
          Removes a merged region of cells (hence letting them free)
 void removeRow(Row row)
          Remove a row from this sheet.
 void removeRowBreak(int row)
          Removes the page break at the indicated row
 java.util.Iterator<Row> rowIterator()
          Returns an iterator of the physical rows
 CellRange<? extends Cell> setArrayFormula(java.lang.String formula, CellRangeAddress range)
          Sets array formula to specified region for result.
 void setAutobreaks(boolean value)
          Flag indicating whether the sheet displays Automatic Page Breaks.
 AutoFilter setAutoFilter(CellRangeAddress range)
          Enable filtering for a range of cells
 void setColumnBreak(int column)
          Sets a page break at the indicated column.
 void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
          Expands or collapses a column group.
 void setColumnHidden(int columnIndex, boolean hidden)
          Get the visibility state for a given column
 void setColumnWidth(int columnIndex, int width)
          Set the width (in units of 1/256th of a character width)
 void setDefaultColumnStyle(int column, CellStyle style)
          Sets the default column style for a given column.
 void setDefaultColumnWidth(int width)
          Set the default column width for the sheet (if the columns do not define their own width) in characters
 void setDefaultRowHeight(short height)
          Set the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
 void setDefaultRowHeightInPoints(float height)
          Set the default row height for the sheet (if the rows do not define their own height) in points
 void setDisplayFormulas(boolean show)
          Sets whether the formulas are shown in a viewer
 void setDisplayGridlines(boolean show)
          Sets whether the gridlines are shown in a viewer
 void setDisplayGuts(boolean value)
          Set whether to display the guts or not
 void setDisplayRowColHeadings(boolean show)
          Sets whether the RowColHeadings are shown in a viewer
 void setDisplayZeros(boolean value)
          Set whether the window should show 0 (zero) in cells containing zero value.
 void setFitToPage(boolean value)
          Flag indicating whether the Fit to Page print option is enabled.
 void setForceFormulaRecalculation(boolean value)
          Control if Excel should be asked to recalculate all formulas on this sheet when the workbook is opened.
 void setHorizontallyCenter(boolean value)
          Determines whether the output is horizontally centered on the page.
 void setMargin(short margin, double size)
          Sets the size of the margin in inches.
 void setPrintGridlines(boolean show)
          Sets the flag indicating whether this sheet should display the lines between rows and columns to make editing and reading easier.
 void setRightToLeft(boolean value)
          Sets whether the worksheet is displayed from right to left instead of from left to right.
 void setRowBreak(int row)
          Sets a page break at the indicated row Breaks occur above the specified row and left of the specified column inclusive.
 void setRowGroupCollapsed(int row, boolean collapse)
          Set view state of a groupped range of rows
 void setRowSumsBelow(boolean value)
          Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
 void setRowSumsRight(boolean value)
          Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
 void setSelected(boolean value)
          Sets a flag indicating whether this sheet is selected.
 void setVerticallyCenter(boolean value)
          Determines whether the output is vertically centered on the page.
 void setZoom(int numerator, int denominator)
          Sets the zoom magnication for the sheet.
 void shiftRows(int startRow, int endRow, int n)
          Shifts rows between startRow and endRow n number of rows.
 void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
          Shifts rows between startRow and endRow n number of rows.
 void showInPane(short toprow, short leftcol)
          Sets desktop window pane display area, when the file is first opened in a viewer.
 void ungroupColumn(int fromColumn, int toColumn)
          Ungroup a range of columns that were previously groupped
 void ungroupRow(int fromRow, int toRow)
          Ungroup a range of rows that were previously groupped
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

LeftMargin

static final short LeftMargin
See Also:
Constant Field Values

RightMargin

static final short RightMargin
See Also:
Constant Field Values

TopMargin

static final short TopMargin
See Also:
Constant Field Values

BottomMargin

static final short BottomMargin
See Also:
Constant Field Values

HeaderMargin

static final short HeaderMargin
See Also:
Constant Field Values

FooterMargin

static final short FooterMargin
See Also:
Constant Field Values

PANE_LOWER_RIGHT

static final byte PANE_LOWER_RIGHT
See Also:
Constant Field Values

PANE_UPPER_RIGHT

static final byte PANE_UPPER_RIGHT
See Also:
Constant Field Values

PANE_LOWER_LEFT

static final byte PANE_LOWER_LEFT
See Also:
Constant Field Values

PANE_UPPER_LEFT

static final byte PANE_UPPER_LEFT
See Also:
Constant Field Values
Method Detail

createRow

Row createRow(int rownum)
Create a new row within the sheet and return the high level representation

Parameters:
rownum - row number
Returns:
high level Row object representing a row in the sheet
See Also:
removeRow(Row)

removeRow

void removeRow(Row row)
Remove a row from this sheet. All cells contained in the row are removed as well

Parameters:
row - representing a row to remove.

getRow

Row getRow(int rownum)
Returns the logical row (not physical) 0-based. If you ask for a row that is not defined you get a null. This is to say row 4 represents the fifth row on a sheet.

Parameters:
rownum - row to get (0-based)
Returns:
Row representing the rownumber or null if its not defined on the sheet

getPhysicalNumberOfRows

int getPhysicalNumberOfRows()
Returns the number of physically defined rows (NOT the number of rows in the sheet)

Returns:
the number of physically defined rows in this sheet

getFirstRowNum

int getFirstRowNum()
Gets the first row on the sheet

Returns:
the number of the first logical row on the sheet (0-based)

getLastRowNum

int getLastRowNum()
Gets the last row on the sheet

Returns:
last row contained n this sheet (0-based)

setColumnHidden

void setColumnHidden(int columnIndex,
                     boolean hidden)
Get the visibility state for a given column

Parameters:
columnIndex - - the column to get (0-based)
hidden - - the visiblity state of the column

isColumnHidden

boolean isColumnHidden(int columnIndex)
Get the hidden state for a given column

Parameters:
columnIndex - - the column to set (0-based)
Returns:
hidden - false if the column is visible

setRightToLeft

void setRightToLeft(boolean value)
Sets whether the worksheet is displayed from right to left instead of from left to right.

Parameters:
value - true for right to left, false otherwise.

isRightToLeft

boolean isRightToLeft()
Whether the text is displayed in right-to-left mode in the window

Returns:
whether the text is displayed in right-to-left mode in the window

setColumnWidth

void setColumnWidth(int columnIndex,
                    int width)
Set the width (in units of 1/256th of a character width)

The maximum column width for an individual cell is 255 characters. This value represents the number of characters that can be displayed in a cell that is formatted with the standard font (first font in the workbook).

Character width is defined as the maximum digit width of the numbers 0, 1, 2, ... 9 as rendered using the default font (first font in the workbook).
Unless you are using a very special font, the default character is '0' (zero), this is true for Arial (default font font in HSSF) and Calibri (default font in XSSF)

Please note, that the width set by this method includes 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines (Section 3.3.1.12 of the OOXML spec). This results is a slightly less value of visible characters than passed to this method (approx. 1/2 of a character).

To compute the actual number of visible characters, Excel uses the following formula (Section 3.3.1.12 of the OOXML spec):

width = Truncate([{Number of Visible Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256

Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). If you set a column width to be eight characters wide, e.g. setColumnWidth(columnIndex, 8*256), then the actual value of visible characters (the value shown in Excel) is derived from the following equation: Truncate([numChars*7+5]/7*256)/256 = 8; which gives 7.29.

Parameters:
columnIndex - - the column to set (0-based)
width - - the width in units of 1/256th of a character width
Throws:
java.lang.IllegalArgumentException - if width > 255*256 (the maximum column width in Excel is 255 characters)

getColumnWidth

int getColumnWidth(int columnIndex)
get the width (in units of 1/256th of a character width )

Character width is defined as the maximum digit width of the numbers 0, 1, 2, ... 9 as rendered using the default font (first font in the workbook)

Parameters:
columnIndex - - the column to set (0-based)
Returns:
width - the width in units of 1/256th of a character width

setDefaultColumnWidth

void setDefaultColumnWidth(int width)
Set the default column width for the sheet (if the columns do not define their own width) in characters

Parameters:
width - default column width measured in characters

getDefaultColumnWidth

int getDefaultColumnWidth()
Get the default column width for the sheet (if the columns do not define their own width) in characters

Returns:
default column width measured in characters

getDefaultRowHeight

short getDefaultRowHeight()
Get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)

Returns:
default row height measured in twips (1/20 of a point)

getDefaultRowHeightInPoints

float getDefaultRowHeightInPoints()
Get the default row height for the sheet (if the rows do not define their own height) in points.

Returns:
default row height in points

setDefaultRowHeight

void setDefaultRowHeight(short height)
Set the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)

Parameters:
height - default row height measured in twips (1/20 of a point)

setDefaultRowHeightInPoints

void setDefaultRowHeightInPoints(float height)
Set the default row height for the sheet (if the rows do not define their own height) in points

Parameters:
height - default row height

getColumnStyle

CellStyle getColumnStyle(int column)
Returns the CellStyle that applies to the given (0 based) column, or null if no style has been set for that column


addMergedRegion

int addMergedRegion(CellRangeAddress region)
Adds a merged region of cells (hence those cells form one)

Parameters:
region - (rowfrom/colfrom-rowto/colto) to merge
Returns:
index of this region

setVerticallyCenter

void setVerticallyCenter(boolean value)
Determines whether the output is vertically centered on the page.

Parameters:
value - true to vertically center, false otherwise.

setHorizontallyCenter

void setHorizontallyCenter(boolean value)
Determines whether the output is horizontally centered on the page.

Parameters:
value - true to horizontally center, false otherwise.

getHorizontallyCenter

boolean getHorizontallyCenter()
Determine whether printed output for this sheet will be horizontally centered.


getVerticallyCenter

boolean getVerticallyCenter()
Determine whether printed output for this sheet will be vertically centered.


removeMergedRegion

void removeMergedRegion(int index)
Removes a merged region of cells (hence letting them free)

Parameters:
index - of the region to unmerge

getNumMergedRegions

int getNumMergedRegions()
Returns the number of merged regions

Returns:
number of merged regions

getMergedRegion

CellRangeAddress getMergedRegion(int index)
Returns the merged region at the specified index

Returns:
the merged region at the specified index

rowIterator

java.util.Iterator<Row> rowIterator()
Returns an iterator of the physical rows

Returns:
an iterator of the PHYSICAL rows. Meaning the 3rd element may not be the third row if say for instance the second row is undefined.

setForceFormulaRecalculation

void setForceFormulaRecalculation(boolean value)
Control if Excel should be asked to recalculate all formulas on this sheet when the workbook is opened.

Calculating the formula values with FormulaEvaluator is the recommended solution, but this may be used for certain cases where evaluation in POI is not possible.

To force recalcuation of formulas in the entire workbook use Workbook.setForceFormulaRecalculation(boolean) instead.

Parameters:
value - true if the application will perform a full recalculation of this worksheet values when the workbook is opened
See Also:
Workbook.setForceFormulaRecalculation(boolean)

getForceFormulaRecalculation

boolean getForceFormulaRecalculation()
Whether Excel will be asked to recalculate all formulas in this sheet when the workbook is opened.


setAutobreaks

void setAutobreaks(boolean value)
Flag indicating whether the sheet displays Automatic Page Breaks.

Parameters:
value - true if the sheet displays Automatic Page Breaks.

setDisplayGuts

void setDisplayGuts(boolean value)
Set whether to display the guts or not

Parameters:
value - - guts or no guts

setDisplayZeros

void setDisplayZeros(boolean value)
Set whether the window should show 0 (zero) in cells containing zero value. When false, cells with zero value appear blank instead of showing the number zero.

Parameters:
value - whether to display or hide all zero values on the worksheet

isDisplayZeros

boolean isDisplayZeros()
Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value. When false, cells with zero value appear blank instead of showing the number zero.

Returns:
whether all zero values on the worksheet are displayed

setFitToPage

void setFitToPage(boolean value)
Flag indicating whether the Fit to Page print option is enabled.

Parameters:
value - true if the Fit to Page print option is enabled.

setRowSumsBelow

void setRowSumsBelow(boolean value)
Flag indicating whether summary rows appear below detail in an outline, when applying an outline.

When true a summary row is inserted below the detailed data being summarized and a new outline level is established on that row.

When false a summary row is inserted above the detailed data being summarized and a new outline level is established on that row.

Parameters:
value - true if row summaries appear below detail in the outline

setRowSumsRight

void setRowSumsRight(boolean value)
Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.

When true a summary column is inserted to the right of the detailed data being summarized and a new outline level is established on that column.

When false a summary column is inserted to the left of the detailed data being summarized and a new outline level is established on that column.

Parameters:
value - true if col summaries appear right of the detail in the outline

getAutobreaks

boolean getAutobreaks()
Flag indicating whether the sheet displays Automatic Page Breaks.

Returns:
true if the sheet displays Automatic Page Breaks.

getDisplayGuts

boolean getDisplayGuts()
Get whether to display the guts or not, default value is true

Returns:
boolean - guts or no guts

getFitToPage

boolean getFitToPage()
Flag indicating whether the Fit to Page print option is enabled.

Returns:
true if the Fit to Page print option is enabled.

getRowSumsBelow

boolean getRowSumsBelow()
Flag indicating whether summary rows appear below detail in an outline, when applying an outline.

When true a summary row is inserted below the detailed data being summarized and a new outline level is established on that row.

When false a summary row is inserted above the detailed data being summarized and a new outline level is established on that row.

Returns:
true if row summaries appear below detail in the outline

getRowSumsRight

boolean getRowSumsRight()
Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.

When true a summary column is inserted to the right of the detailed data being summarized and a new outline level is established on that column.

When false a summary column is inserted to the left of the detailed data being summarized and a new outline level is established on that column.

Returns:
true if col summaries appear right of the detail in the outline

isPrintGridlines

boolean isPrintGridlines()
Gets the flag indicating whether this sheet displays the lines between rows and columns to make editing and reading easier.

Returns:
true if this sheet displays gridlines.
See Also:
to check if printing of gridlines is turned on or off

setPrintGridlines

void setPrintGridlines(boolean show)
Sets the flag indicating whether this sheet should display the lines between rows and columns to make editing and reading easier. To turn printing of gridlines use setPrintGridlines(boolean)

Parameters:
show - true if this sheet should display gridlines.
See Also:
setPrintGridlines(boolean)

getPrintSetup

PrintSetup getPrintSetup()
Gets the print setup object.

Returns:
The user model for the print setup object.

getHeader

Header getHeader()
Gets the user model for the default document header.

Note that XSSF offers more kinds of document headers than HSSF does

Returns:
the document header. Never null

getFooter

Footer getFooter()
Gets the user model for the default document footer.

Note that XSSF offers more kinds of document footers than HSSF does.

Returns:
the document footer. Never null

setSelected

void setSelected(boolean value)
Sets a flag indicating whether this sheet is selected.

Note: multiple sheets can be selected, but only one sheet can be active at one time.

Parameters:
value - true if this sheet is selected
See Also:
Workbook.setActiveSheet(int)

getMargin

double getMargin(short margin)
Gets the size of the margin in inches.

Parameters:
margin - which margin to get
Returns:
the size of the margin

setMargin

void setMargin(short margin,
               double size)
Sets the size of the margin in inches.

Parameters:
margin - which margin to get
size - the size of the margin

getProtect

boolean getProtect()
Answer whether protection is enabled or disabled

Returns:
true => protection enabled; false => protection disabled

protectSheet

void protectSheet(java.lang.String password)
Sets the protection enabled as well as the password

Parameters:
password - to set for protection. Pass null to remove protection

getScenarioProtect

boolean getScenarioProtect()
Answer whether scenario protection is enabled or disabled

Returns:
true => protection enabled; false => protection disabled

setZoom

void setZoom(int numerator,
             int denominator)
Sets the zoom magnication for the sheet. The zoom is expressed as a fraction. For example to express a zoom of 75% use 3 for the numerator and 4 for the denominator.

Parameters:
numerator - The numerator for the zoom magnification.
denominator - The denominator for the zoom magnification.

getTopRow

short getTopRow()
The top row in the visible view when the sheet is first viewed after opening it in a viewer

Returns:
short indicating the rownum (0 based) of the top row

getLeftCol

short getLeftCol()
The left col in the visible view when the sheet is first viewed after opening it in a viewer

Returns:
short indicating the rownum (0 based) of the top row

showInPane

void showInPane(short toprow,
                short leftcol)
Sets desktop window pane display area, when the file is first opened in a viewer.

Parameters:
toprow - the top row to show in desktop window pane
leftcol - the left column to show in desktop window pane

shiftRows

void shiftRows(int startRow,
               int endRow,
               int n)
Shifts rows between startRow and endRow n number of rows. If you use a negative number, it will shift rows up. Code ensures that rows don't wrap around. Calls shiftRows(startRow, endRow, n, false, false);

Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).

Parameters:
startRow - the row to start shifting
endRow - the row to end shifting
n - the number of rows to shift

shiftRows

void shiftRows(int startRow,
               int endRow,
               int n,
               boolean copyRowHeight,
               boolean resetOriginalRowHeight)
Shifts rows between startRow and endRow n number of rows. If you use a negative number, it will shift rows up. Code ensures that rows don't wrap around

Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).

Parameters:
startRow - the row to start shifting
endRow - the row to end shifting
n - the number of rows to shift
copyRowHeight - whether to copy the row height during the shift
resetOriginalRowHeight - whether to set the original row's height to the default

createFreezePane

void createFreezePane(int colSplit,
                      int rowSplit,
                      int leftmostColumn,
                      int topRow)
Creates a split (freezepane). Any existing freezepane or split pane is overwritten.

If both colSplit and rowSplit are zero then the existing freeze pane is removed

Parameters:
colSplit - Horizonatal position of split.
rowSplit - Vertical position of split.
leftmostColumn - Left column visible in right pane.
topRow - Top row visible in bottom pane

createFreezePane

void createFreezePane(int colSplit,
                      int rowSplit)
Creates a split (freezepane). Any existing freezepane or split pane is overwritten.

If both colSplit and rowSplit are zero then the existing freeze pane is removed

Parameters:
colSplit - Horizonatal position of split.
rowSplit - Vertical position of split.

createSplitPane

void createSplitPane(int xSplitPos,
                     int ySplitPos,
                     int leftmostColumn,
                     int topRow,
                     int activePane)
Creates a split pane. Any existing freezepane or split pane is overwritten.

Parameters:
xSplitPos - Horizonatal position of split (in 1/20th of a point).
ySplitPos - Vertical position of split (in 1/20th of a point).
topRow - Top row visible in bottom pane
leftmostColumn - Left column visible in right pane.
activePane - Active pane. One of: PANE_LOWER_RIGHT, PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
See Also:
PANE_LOWER_LEFT, PANE_LOWER_RIGHT, PANE_UPPER_LEFT, PANE_UPPER_RIGHT

getPaneInformation

PaneInformation getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze)

Returns:
null if no pane configured, or the pane information.

setDisplayGridlines

void setDisplayGridlines(boolean show)
Sets whether the gridlines are shown in a viewer

Parameters:
show - whether to show gridlines or not

isDisplayGridlines

boolean isDisplayGridlines()
Returns if gridlines are displayed

Returns:
whether gridlines are displayed

setDisplayFormulas

void setDisplayFormulas(boolean show)
Sets whether the formulas are shown in a viewer

Parameters:
show - whether to show formulas or not

isDisplayFormulas

boolean isDisplayFormulas()
Returns if formulas are displayed

Returns:
whether formulas are displayed

setDisplayRowColHeadings

void setDisplayRowColHeadings(boolean show)
Sets whether the RowColHeadings are shown in a viewer

Parameters:
show - whether to show RowColHeadings or not

isDisplayRowColHeadings

boolean isDisplayRowColHeadings()
Returns if RowColHeadings are displayed.

Returns:
whether RowColHeadings are displayed

setRowBreak

void setRowBreak(int row)
Sets a page break at the indicated row Breaks occur above the specified row and left of the specified column inclusive. For example, sheet.setColumnBreak(2); breaks the sheet into two parts with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.setRowBreak(2); breaks the sheet into two parts with first three rows (rownum=1...3) in the first part and rows starting with rownum=4 in the second.

Parameters:
row - the row to break, inclusive

isRowBroken

boolean isRowBroken(int row)
Determines if there is a page break at the indicated row

Parameters:
row - FIXME: Document this!
Returns:
FIXME: Document this!

removeRowBreak

void removeRowBreak(int row)
Removes the page break at the indicated row

Parameters:
row -

getRowBreaks

int[] getRowBreaks()
Retrieves all the horizontal page breaks

Returns:
all the horizontal page breaks, or null if there are no row page breaks

getColumnBreaks

int[] getColumnBreaks()
Retrieves all the vertical page breaks

Returns:
all the vertical page breaks, or null if there are no column page breaks

setColumnBreak

void setColumnBreak(int column)
Sets a page break at the indicated column. Breaks occur above the specified row and left of the specified column inclusive. For example, sheet.setColumnBreak(2); breaks the sheet into two parts with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.setRowBreak(2); breaks the sheet into two parts with first three rows (rownum=1...3) in the first part and rows starting with rownum=4 in the second.

Parameters:
column - the column to break, inclusive

isColumnBroken

boolean isColumnBroken(int column)
Determines if there is a page break at the indicated column

Parameters:
column - FIXME: Document this!
Returns:
FIXME: Document this!

removeColumnBreak

void removeColumnBreak(int column)
Removes a page break at the indicated column

Parameters:
column -

setColumnGroupCollapsed

void setColumnGroupCollapsed(int columnNumber,
                             boolean collapsed)
Expands or collapses a column group.

Parameters:
columnNumber - One of the columns in the group.
collapsed - true = collapse group, false = expand group.

groupColumn

void groupColumn(int fromColumn,
                 int toColumn)
Create an outline for the provided column range.

Parameters:
fromColumn - beginning of the column range.
toColumn - end of the column range.

ungroupColumn

void ungroupColumn(int fromColumn,
                   int toColumn)
Ungroup a range of columns that were previously groupped

Parameters:
fromColumn - start column (0-based)
toColumn - end column (0-based)

groupRow

void groupRow(int fromRow,
              int toRow)
Tie a range of rows together so that they can be collapsed or expanded

Parameters:
fromRow - start row (0-based)
toRow - end row (0-based)

ungroupRow

void ungroupRow(int fromRow,
                int toRow)
Ungroup a range of rows that were previously groupped

Parameters:
fromRow - start row (0-based)
toRow - end row (0-based)

setRowGroupCollapsed

void setRowGroupCollapsed(int row,
                          boolean collapse)
Set view state of a groupped range of rows

Parameters:
row - start row of a groupped range of rows (0-based)
collapse - whether to expand/collapse the detail rows

setDefaultColumnStyle

void setDefaultColumnStyle(int column,
                           CellStyle style)
Sets the default column style for a given column. POI will only apply this style to new cells added to the sheet.

Parameters:
column - the column index
style - the style to set

autoSizeColumn

void autoSizeColumn(int column)
Adjusts the column width to fit the contents.

This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.

You can specify whether the content of merged cells should be considered or ignored. Default is to ignore merged cells.

Parameters:
column - the column index

autoSizeColumn

void autoSizeColumn(int column,
                    boolean useMergedCells)
Adjusts the column width to fit the contents.

This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.

You can specify whether the content of merged cells should be considered or ignored. Default is to ignore merged cells.

Parameters:
column - the column index
useMergedCells - whether to use the contents of merged cells when calculating the width of the column

getCellComment

Comment getCellComment(int row,
                       int column)
Returns cell comment for the specified row and column

Returns:
cell comment or null if not found

createDrawingPatriarch

Drawing createDrawingPatriarch()
Creates the top-level drawing patriarch.

Returns:
The new drawing patriarch.

getWorkbook

Workbook getWorkbook()
Return the parent workbook

Returns:
the parent workbook

getSheetName

java.lang.String getSheetName()
Returns the name of this sheet

Returns:
the name of this sheet

isSelected

boolean isSelected()
Note - this is not the same as whether the sheet is focused (isActive)

Returns:
true if this sheet is currently selected

setArrayFormula

CellRange<? extends Cell> setArrayFormula(java.lang.String formula,
                                          CellRangeAddress range)
Sets array formula to specified region for result.

Parameters:
formula - text representation of the formula
range - Region of array formula for result.
Returns:
the CellRange of cells affected by this change

removeArrayFormula

CellRange<? extends Cell> removeArrayFormula(Cell cell)
Remove a Array Formula from this sheet. All cells contained in the Array Formula range are removed as well

Parameters:
cell - any cell within Array Formula range
Returns:
the CellRange of cells affected by this change

getDataValidationHelper

DataValidationHelper getDataValidationHelper()

addValidationData

void addValidationData(DataValidation dataValidation)
Creates a data validation object

Parameters:
dataValidation - The Data validation object settings

setAutoFilter

AutoFilter setAutoFilter(CellRangeAddress range)
Enable filtering for a range of cells

Parameters:
range - the range of cells to filter

getSheetConditionalFormatting

SheetConditionalFormatting getSheetConditionalFormatting()
The 'Conditional Formatting' facet for this Sheet

Returns:
conditional formatting rule for this sheet


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.