|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Sheet
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. |
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 |
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 |
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 |
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 |
rowIterator()
Returns an iterator of the physical rows |
CellRange |
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 |
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 |
setRowBreak(int row)
Sets a page break at the indicated row |
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 poi.support.Iterable |
---|
iterator |
Field Detail |
---|
static final short LeftMargin
static final short RightMargin
static final short TopMargin
static final short BottomMargin
static final short HeaderMargin
static final short FooterMargin
static final byte PANE_LOWER_RIGHT
static final byte PANE_UPPER_RIGHT
static final byte PANE_LOWER_LEFT
static final byte PANE_UPPER_LEFT
Method Detail |
---|
Row createRow(int rownum)
rownum
- row number
removeRow(Row)
void removeRow(Row row)
row
- representing a row to remove.Row getRow(int rownum)
rownum
- row to get (0-based)
int getPhysicalNumberOfRows()
int getFirstRowNum()
int getLastRowNum()
void setColumnHidden(int columnIndex, boolean hidden)
columnIndex
- - the column to get (0-based)hidden
- - the visiblity state of the columnboolean isColumnHidden(int columnIndex)
columnIndex
- - the column to set (0-based)
false
if the column is visiblevoid setColumnWidth(int columnIndex, int 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.
columnIndex
- - the column to set (0-based)width
- - the width in units of 1/256th of a character widthint getColumnWidth(int columnIndex)
columnIndex
- - the column to set (0-based)
void setDefaultColumnWidth(int width)
width
- default column width measured in charactersint getDefaultColumnWidth()
short getDefaultRowHeight()
float getDefaultRowHeightInPoints()
void setDefaultRowHeight(short height)
height
- default row height measured in twips (1/20 of a point)void setDefaultRowHeightInPoints(float height)
height
- default row heightCellStyle getColumnStyle(int column)
int addMergedRegion(CellRangeAddress region)
region
- (rowfrom/colfrom-rowto/colto) to merge
void setVerticallyCenter(boolean value)
value
- true to vertically center, false otherwise.void setHorizontallyCenter(boolean value)
value
- true to horizontally center, false otherwise.boolean getHorizontallyCenter()
boolean getVerticallyCenter()
void removeMergedRegion(int index)
index
- of the region to unmergeint getNumMergedRegions()
CellRangeAddress getMergedRegion(int index)
java.util.Iterator rowIterator()
void setAutobreaks(boolean value)
value
- true
if the sheet displays Automatic Page Breaks.void setDisplayGuts(boolean value)
value
- - guts or no gutsvoid setDisplayZeros(boolean value)
value
- whether to display or hide all zero values on the worksheetboolean isDisplayZeros()
void setFitToPage(boolean value)
value
- true
if the Fit to Page print option is enabled.void setRowSumsBelow(boolean value)
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.
value
- true
if row summaries appear below detail in the outlinevoid setRowSumsRight(boolean value)
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.
value
- true
if col summaries appear right of the detail in the outlineboolean getAutobreaks()
true
if the sheet displays Automatic Page Breaks.boolean getDisplayGuts()
boolean getFitToPage()
true
if the Fit to Page print option is enabled.boolean getRowSumsBelow()
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.
true
if row summaries appear below detail in the outlineboolean getRowSumsRight()
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.
true
if col summaries appear right of the detail in the outlineboolean isPrintGridlines()
true
if this sheet displays gridlines.to check if printing of gridlines is turned on or off
void setPrintGridlines(boolean show)
setPrintGridlines(boolean)
show
- true
if this sheet should display gridlines.setPrintGridlines(boolean)
PrintSetup getPrintSetup()
Header getHeader()
null
Footer getFooter()
null
void setSelected(boolean value)
Note: multiple sheets can be selected, but only one sheet can be active at one time.
value
- true
if this sheet is selectedWorkbook.setActiveSheet(int)
double getMargin(short margin)
margin
- which margin to get
void setMargin(short margin, double size)
margin
- which margin to getsize
- the size of the marginboolean getProtect()
void protectSheet(java.lang.String password)
password
- to set for protection. Pass null
to remove protectionboolean getScenarioProtect()
void setZoom(int numerator, int denominator)
numerator
- The numerator for the zoom magnification.denominator
- The denominator for the zoom magnification.short getTopRow()
short getLeftCol()
void showInPane(short toprow, short leftcol)
toprow
- the top row to show in desktop window paneleftcol
- the left column to show in desktop window panevoid shiftRows(int startRow, int endRow, int n)
Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).
startRow
- the row to start shiftingendRow
- the row to end shiftingn
- the number of rows to shiftvoid shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).
startRow
- the row to start shiftingendRow
- the row to end shiftingn
- the number of rows to shiftcopyRowHeight
- whether to copy the row height during the shiftresetOriginalRowHeight
- whether to set the original row's height to the defaultvoid createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
colSplit
- Horizonatal position of split.rowSplit
- Vertical position of split.leftmostColumn
- Left column visible in right pane.topRow
- Top row visible in bottom panevoid createFreezePane(int colSplit, int rowSplit)
colSplit
- Horizonatal position of split.rowSplit
- Vertical position of split.void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
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 paneleftmostColumn
- Left column visible in right pane.activePane
- Active pane. One of: PANE_LOWER_RIGHT,
PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFTPANE_LOWER_LEFT
,
PANE_LOWER_RIGHT
,
PANE_UPPER_LEFT
,
PANE_UPPER_RIGHT
PaneInformation getPaneInformation()
void setDisplayGridlines(boolean show)
show
- whether to show gridlines or notboolean isDisplayGridlines()
void setDisplayFormulas(boolean show)
show
- whether to show formulas or notboolean isDisplayFormulas()
void setDisplayRowColHeadings(boolean show)
show
- whether to show RowColHeadings or notboolean isDisplayRowColHeadings()
void setRowBreak(int row)
row
- FIXME: Document this!boolean isRowBroken(int row)
row
- FIXME: Document this!
void removeRowBreak(int row)
row
- int[] getRowBreaks()
int[] getColumnBreaks()
void setColumnBreak(int column)
column
- boolean isColumnBroken(int column)
column
- FIXME: Document this!
void removeColumnBreak(int column)
column
- void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
columnNumber
- One of the columns in the group.collapsed
- true = collapse group, false = expand group.void groupColumn(int fromColumn, int toColumn)
fromColumn
- beginning of the column range.toColumn
- end of the column range.void ungroupColumn(int fromColumn, int toColumn)
fromColumn
- start column (0-based)toColumn
- end column (0-based)void groupRow(int fromRow, int toRow)
fromRow
- start row (0-based)toRow
- end row (0-based)void ungroupRow(int fromRow, int toRow)
fromRow
- start row (0-based)toRow
- end row (0-based)void setRowGroupCollapsed(int row, boolean collapse)
row
- start row of a groupped range of rows (0-based)collapse
- whether to expand/collapse the detail rowsvoid setDefaultColumnStyle(int column, CellStyle style)
column
- the column indexstyle
- the style to setvoid autoSizeColumn(int column)
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.
column
- the column indexvoid autoSizeColumn(int column, boolean useMergedCells)
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.
column
- the column indexuseMergedCells
- whether to use the contents of merged cells when calculating the width of the columnComment getCellComment(int row, int column)
null
if not foundDrawing createDrawingPatriarch()
Workbook getWorkbook()
java.lang.String getSheetName()
boolean isSelected()
true
if this sheet is currently selectedCellRange setArrayFormula(java.lang.String formula, CellRangeAddress range)
formula
- text representation of the formularange
- Region of array formula for result.
CellRange
of cells affected by this changeCellRange removeArrayFormula(Cell cell)
cell
- any cell within Array Formula range
CellRange
of cells affected by this changeDataValidationHelper getDataValidationHelper()
void addValidationData(DataValidation dataValidation)
dataValidation
- The Data validation object settingsAutoFilter setAutoFilter(CellRangeAddress range)
range
- the range of cells to filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |