|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.hssf.usermodel.HSSFSheet
public final class HSSFSheet
High level representation of a worksheet.
Field Summary | |
---|---|
protected InternalWorkbook |
_book
|
protected HSSFWorkbook |
_workbook
|
static int |
INITIAL_CAPACITY
Used for compile-time optimization. |
Fields inherited from interface org.apache.poi.ss.usermodel.Sheet |
---|
BottomMargin, FooterMargin, HeaderMargin, LeftMargin, PANE_LOWER_LEFT, PANE_LOWER_RIGHT, PANE_UPPER_LEFT, PANE_UPPER_RIGHT, RightMargin, TopMargin |
Constructor Summary | |
---|---|
protected |
HSSFSheet(HSSFWorkbook workbook)
Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from scratch. |
protected |
HSSFSheet(HSSFWorkbook workbook,
InternalSheet sheet)
Creates an HSSFSheet representing the given Sheet object. |
Method Summary | |
---|---|
int |
addMergedRegion(CellRangeAddress region)
adds a merged region of cells (hence those cells form one) |
int |
addMergedRegion(Region region)
Deprecated. (Aug-2008) use CellRangeAddress instead of Region |
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. |
HSSFPatriarch |
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). |
HSSFRow |
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. |
void |
dumpDrawingRecords(boolean fat,
java.io.PrintWriter pw)
Aggregates the drawing records and dumps the escher record hierarchy to the standard output. |
protected HSSFComment |
findCellComment(int row,
int column)
|
boolean |
getAlternateExpression()
whether alternate expression evaluation is on |
boolean |
getAlternateFormula()
whether alternative formula entry is on |
boolean |
getAutobreaks()
show automatic page breaks or not |
HSSFComment |
getCellComment(int row,
int column)
Returns cell comment for the specified row and column |
int[] |
getColumnBreaks()
Retrieves all the vertical page breaks |
int |
getColumnOutlineLevel(int columnIndex)
Returns the column outline level. |
HSSFCellStyle |
getColumnStyle(int column)
Returns the HSSFCellStyle 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 ) |
short |
getColumnWidth(short columnIndex)
Deprecated. (Sep 2008) use getColumnWidth(int) |
float |
getColumnWidthInPixels(int column)
get the width in pixel |
DataValidationHelper |
getDataValidationHelper()
|
java.util.List<HSSFDataValidation> |
getDataValidations()
Returns the list of DataValidation in the sheet. |
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 |
getDialog()
get whether sheet is a dialog sheet or not |
boolean |
getDisplayGuts()
get whether to display the guts or not |
EscherAggregate |
getDrawingEscherAggregate()
Returns the agregate escher records for this sheet, it there is one. |
HSSFPatriarch |
getDrawingPatriarch()
This will hold any graphics or charts for the sheet. |
int |
getFirstRowNum()
Gets the first row on the sheet |
boolean |
getFitToPage()
fit to page option is on |
HSSFFooter |
getFooter()
Gets the user model for the default document footer. |
boolean |
getForceFormulaRecalculation()
Whether a record must be inserted or not at generation to indicate that formula must be recalculated when workbook is opened. |
HSSFHeader |
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 number 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 |
Region |
getMergedRegionAt(int index)
Deprecated. (Aug-2008) use getMergedRegion(int) |
java.util.List<CellRangeAddress> |
getMergedRegions()
Returns the list of merged regions. |
int |
getNumMergedRegions()
returns the number of merged regions |
boolean |
getObjectProtect()
Answer whether object protection is enabled or disabled |
PaneInformation |
getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze). |
short |
getPassword()
|
int |
getPhysicalNumberOfRows()
Returns the number of physically defined rows (NOT the number of rows in the sheet) |
HSSFPrintSetup |
getPrintSetup()
Gets the print setup object. |
boolean |
getProtect()
Answer whether protection is enabled or disabled |
CellRangeAddress |
getRepeatingColumns()
Gets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet. |
CellRangeAddress |
getRepeatingRows()
Gets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet. |
HSSFRow |
getRow(int rowIndex)
Returns the logical row (not physical) 0-based. |
int[] |
getRowBreaks()
Retrieves all the horizontal page breaks |
boolean |
getRowSumsBelow()
get if row summaries appear below detail in the outline |
boolean |
getRowSumsRight()
get if col summaries appear right of the detail in the outline |
boolean |
getScenarioProtect()
Answer whether scenario protection is enabled or disabled |
HSSFSheetConditionalFormatting |
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. |
boolean |
getVerticallyCenter(boolean value)
Deprecated. (Mar-2008) use getVerticallyCenter() instead |
HSSFWorkbook |
getWorkbook()
Return the parent workbook |
void |
groupColumn(int fromColumn,
int toColumn)
Create an outline for the provided column range. |
void |
groupColumn(short fromColumn,
short toColumn)
Deprecated. (Sep 2008) use groupColumn(int, int) |
void |
groupRow(int fromRow,
int toRow)
Tie a range of cell together so that they can be collapsed or expanded |
protected void |
insertChartRecords(java.util.List<Record> records)
|
boolean |
isActive()
|
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 |
isColumnHidden(short columnIndex)
Deprecated. (Sep 2008) use isColumnHidden(int) |
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 |
isGridsPrinted()
get whether gridlines are printed. |
boolean |
isPrintGridlines()
Returns whether gridlines are printed. |
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) |
java.util.Iterator<Row> |
iterator()
Alias for rowIterator() to allow
foreach loops |
protected void |
preSerialize()
check whether the data of sheet can be serialized |
void |
protectSheet(java.lang.String password)
Sets the protection enabled as well as the password |
CellRange<HSSFCell> |
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 |
void |
setActive(boolean sel)
Sets whether sheet is selected. |
void |
setAlternativeExpression(boolean b)
whether alternate expression evaluation is on |
void |
setAlternativeFormula(boolean b)
whether alternative formula entry is on |
CellRange<HSSFCell> |
setArrayFormula(java.lang.String formula,
CellRangeAddress range)
Sets array formula to specified region for result. |
void |
setAutobreaks(boolean b)
show automatic page breaks or not |
HSSFAutoFilter |
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 |
setColumnGroupCollapsed(short columnNumber,
boolean collapsed)
Deprecated. (Sep 2008) use setColumnGroupCollapsed(int, boolean) |
void |
setColumnHidden(int columnIndex,
boolean hidden)
Get the visibility state for a given column. |
void |
setColumnHidden(short columnIndex,
boolean hidden)
Deprecated. (Sep 2008) use setColumnHidden(int, boolean) |
void |
setColumnWidth(int columnIndex,
int width)
Set the width (in units of 1/256th of a character width) |
void |
setColumnWidth(short columnIndex,
short width)
Deprecated. (Sep 2008) use setColumnWidth(int, int) |
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 |
setDefaultColumnWidth(short width)
Deprecated. (Sep 2008) use setDefaultColumnWidth(int) |
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 |
setDialog(boolean b)
set whether sheet is a dialog sheet or not |
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 b)
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 b)
fit to page option is on |
void |
setForceFormulaRecalculation(boolean value)
Control if Excel should be asked to recalculate all formulas on this sheet when the workbook is opened. |
void |
setGridsPrinted(boolean value)
set whether gridlines printed. |
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 newPrintGridlines)
Turns on or off the printing of gridlines. |
void |
setRepeatingColumns(CellRangeAddress columnRangeRef)
Sets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet. |
void |
setRepeatingRows(CellRangeAddress rowRangeRef)
Sets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet. |
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 rowIndex,
boolean collapse)
Set view state of a groupped range of rows |
void |
setRowSumsBelow(boolean b)
set if row summaries appear below detail in the outline |
void |
setRowSumsRight(boolean b)
set if col summaries appear right of the detail in the outline |
void |
setSelected(boolean sel)
Sets whether 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 magnification for the sheet. |
protected void |
shiftMerged(int startRow,
int endRow,
int n,
boolean isRow)
Shifts the merged regions left or right depending on mode TODO: MODE , this is only row specific |
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 |
shiftRows(int startRow,
int endRow,
int n,
boolean copyRowHeight,
boolean resetOriginalRowHeight,
boolean moveComments)
Shifts rows between startRow and endRow n number of rows. |
void |
showInPane(int toprow,
int leftcol)
Sets desktop window pane display area, when the file is first opened in a viewer. |
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 |
ungroupColumn(short fromColumn,
short toColumn)
Deprecated. (Sep 2008) use ungroupColumn(int, int) |
void |
ungroupRow(int fromRow,
int toRow)
Ungroup a range of rows that were previously groupped |
protected void |
validateColumn(int column)
Runs a bounds check for column numbers |
protected void |
validateRow(int row)
Runs a bounds check for row numbers |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INITIAL_CAPACITY
protected final InternalWorkbook _book
protected final HSSFWorkbook _workbook
Constructor Detail |
---|
protected HSSFSheet(HSSFWorkbook workbook)
workbook
- - The HSSF Workbook object associated with the sheet.HSSFWorkbook.createSheet()
protected HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet)
workbook
- - The HSSF Workbook object associated with the sheet.sheet
- - lowlevel Sheet object this sheet will representHSSFWorkbook.createSheet()
Method Detail |
---|
protected void preSerialize()
public HSSFWorkbook getWorkbook()
getWorkbook
in interface Sheet
public HSSFRow createRow(int rownum)
createRow
in interface Sheet
rownum
- row number
HSSFRow
,
removeRow(org.apache.poi.ss.usermodel.Row)
public void removeRow(Row row)
removeRow
in interface Sheet
row
- representing a row to remove.public HSSFRow getRow(int rowIndex)
getRow
in interface Sheet
rowIndex
- row to get
public int getPhysicalNumberOfRows()
getPhysicalNumberOfRows
in interface Sheet
public int getFirstRowNum()
getFirstRowNum
in interface Sheet
public int getLastRowNum()
getPhysicalNumberOfRows()
to
tell if there is a row at position zero
or not.
getLastRowNum
in interface Sheet
public java.util.List<HSSFDataValidation> getDataValidations()
Sheet
getDataValidations
in interface Sheet
public void addValidationData(DataValidation dataValidation)
addValidationData
in interface Sheet
dataValidation
- The Data validation object settingspublic void setColumnHidden(short columnIndex, boolean hidden)
setColumnHidden(int, boolean)
public boolean isColumnHidden(short columnIndex)
isColumnHidden(int)
public void setColumnWidth(short columnIndex, short width)
setColumnWidth(int, int)
public short getColumnWidth(short columnIndex)
getColumnWidth(int)
public void setDefaultColumnWidth(short width)
setDefaultColumnWidth(int)
public void setColumnHidden(int columnIndex, boolean hidden)
setColumnHidden
in interface Sheet
columnIndex
- - the column to get (0-based)hidden
- - the visiblity state of the columnpublic boolean isColumnHidden(int columnIndex)
isColumnHidden
in interface Sheet
columnIndex
- - the column to set (0-based)
false
if the column is visiblepublic void 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 (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;
7.29
.
setColumnWidth
in interface Sheet
columnIndex
- - the column to set (0-based)width
- - the width in units of 1/256th of a character width
java.lang.IllegalArgumentException
- if width > 255*256 (the maximum column width in Excel is 255 characters)public int getColumnWidth(int columnIndex)
getColumnWidth
in interface Sheet
columnIndex
- - the column to set (0-based)
public float getColumnWidthInPixels(int column)
Sheet
Please note, that this method works correctly only for workbooks with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). If the default font is changed the column width can be streched
getColumnWidthInPixels
in interface Sheet
column
- - the column to set (0-based)
public int getDefaultColumnWidth()
getDefaultColumnWidth
in interface Sheet
public void setDefaultColumnWidth(int width)
setDefaultColumnWidth
in interface Sheet
width
- default column widthpublic short getDefaultRowHeight()
getDefaultRowHeight
in interface Sheet
public float getDefaultRowHeightInPoints()
getDefaultRowHeightInPoints
in interface Sheet
public void setDefaultRowHeight(short height)
setDefaultRowHeight
in interface Sheet
height
- default row heightpublic void setDefaultRowHeightInPoints(float height)
setDefaultRowHeightInPoints
in interface Sheet
height
- default row heightpublic HSSFCellStyle getColumnStyle(int column)
getColumnStyle
in interface Sheet
public boolean isGridsPrinted()
public void setGridsPrinted(boolean value)
value
- false if not printed.public int addMergedRegion(Region region)
public int addMergedRegion(CellRangeAddress region)
addMergedRegion
in interface Sheet
region
- (rowfrom/colfrom-rowto/colto) to merge
public void setForceFormulaRecalculation(boolean value)
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.
It is recommended to force recalcuation of formulas on workbook level using
Workbook.setForceFormulaRecalculation(boolean)
to ensure that all cross-worksheet formuals and external dependencies are updated.
setForceFormulaRecalculation
in interface Sheet
value
- true if the application will perform a full recalculation of
this worksheet values when the workbook is openedWorkbook.setForceFormulaRecalculation(boolean)
public boolean getForceFormulaRecalculation()
getForceFormulaRecalculation
in interface Sheet
public void setVerticallyCenter(boolean value)
setVerticallyCenter
in interface Sheet
value
- true to vertically center, false otherwise.public boolean getVerticallyCenter(boolean value)
public boolean getVerticallyCenter()
getVerticallyCenter
in interface Sheet
public void setHorizontallyCenter(boolean value)
setHorizontallyCenter
in interface Sheet
value
- true to horizontally center, false otherwise.public boolean getHorizontallyCenter()
getHorizontallyCenter
in interface Sheet
public void setRightToLeft(boolean value)
setRightToLeft
in interface Sheet
value
- true for right to left, false otherwise.public boolean isRightToLeft()
isRightToLeft
in interface Sheet
public void removeMergedRegion(int index)
removeMergedRegion
in interface Sheet
index
- of the region to unmergepublic int getNumMergedRegions()
getNumMergedRegions
in interface Sheet
public Region getMergedRegionAt(int index)
getMergedRegion(int)
public CellRangeAddress getMergedRegion(int index)
Sheet
getMergedRegion
in interface Sheet
public java.util.List<CellRangeAddress> getMergedRegions()
Sheet
getMergedRegions
in interface Sheet
public java.util.Iterator<Row> rowIterator()
Sheet
rowIterator
in interface Sheet
public java.util.Iterator<Row> iterator()
rowIterator()
to allow
foreach loops
iterator
in interface java.lang.Iterable<Row>
public void setAlternativeExpression(boolean b)
b
- alternative expression evaluation or notpublic void setAlternativeFormula(boolean b)
b
- alternative formulas or notpublic void setAutobreaks(boolean b)
setAutobreaks
in interface Sheet
b
- whether to show auto page breakspublic void setDialog(boolean b)
b
- isDialog or notpublic void setDisplayGuts(boolean b)
setDisplayGuts
in interface Sheet
b
- guts or no guts (or glory)public void setFitToPage(boolean b)
setFitToPage
in interface Sheet
b
- fit or notpublic void setRowSumsBelow(boolean b)
setRowSumsBelow
in interface Sheet
b
- below or notpublic void setRowSumsRight(boolean b)
setRowSumsRight
in interface Sheet
b
- right or notpublic boolean getAlternateExpression()
public boolean getAlternateFormula()
public boolean getAutobreaks()
getAutobreaks
in interface Sheet
public boolean getDialog()
public boolean getDisplayGuts()
getDisplayGuts
in interface Sheet
public boolean isDisplayZeros()
In Excel 2003 this option can be changed in the Options dialog on the View tab.
isDisplayZeros
in interface Sheet
public void setDisplayZeros(boolean value)
In Excel 2003 this option can be set in the Options dialog on the View tab.
setDisplayZeros
in interface Sheet
value
- whether to display or hide all zero values on the worksheetpublic boolean getFitToPage()
getFitToPage
in interface Sheet
public boolean getRowSumsBelow()
getRowSumsBelow
in interface Sheet
public boolean getRowSumsRight()
getRowSumsRight
in interface Sheet
public boolean isPrintGridlines()
isPrintGridlines
in interface Sheet
to check if printing of gridlines is turned on or off
public void setPrintGridlines(boolean newPrintGridlines)
setPrintGridlines
in interface Sheet
newPrintGridlines
- boolean to turn on or off the printing of
gridlinesSheet.setPrintGridlines(boolean)
public HSSFPrintSetup getPrintSetup()
getPrintSetup
in interface Sheet
public HSSFHeader getHeader()
Sheet
getHeader
in interface Sheet
null
public HSSFFooter getFooter()
Sheet
getFooter
in interface Sheet
null
public boolean isSelected()
isSelected
in interface Sheet
true
if this sheet is currently selectedpublic void setSelected(boolean sel)
setSelected
in interface Sheet
sel
- Whether to select the sheet or deselect the sheet.Workbook.setActiveSheet(int)
public boolean isActive()
true
if this sheet is currently focusedpublic void setActive(boolean sel)
sel
- Whether to select the sheet or deselect the sheet.public double getMargin(short margin)
getMargin
in interface Sheet
margin
- which margin to get
public void setMargin(short margin, double size)
setMargin
in interface Sheet
margin
- which margin to getsize
- the size of the marginpublic boolean getProtect()
getProtect
in interface Sheet
public short getPassword()
public boolean getObjectProtect()
public boolean getScenarioProtect()
getScenarioProtect
in interface Sheet
public void protectSheet(java.lang.String password)
protectSheet
in interface Sheet
password
- to set for protection. Pass null
to remove protectionpublic void setZoom(int numerator, int denominator)
setZoom
in interface Sheet
numerator
- The numerator for the zoom magnification.denominator
- The denominator for the zoom magnification.public short getTopRow()
getTopRow
in interface Sheet
public short getLeftCol()
getLeftCol
in interface Sheet
public void showInPane(int toprow, int leftcol)
showInPane
in interface Sheet
toprow
- the top row to show in desktop window paneleftcol
- the left column to show in desktop window panepublic void showInPane(short toprow, short leftcol)
showInPane
in interface Sheet
toprow
- the top row to show in desktop window paneleftcol
- the left column to show in desktop window paneprotected void shiftMerged(int startRow, int endRow, int n, boolean isRow)
startRow
- endRow
- n
- isRow
- public void shiftRows(int startRow, int endRow, int n)
shiftRows
in interface Sheet
startRow
- the row to start shiftingendRow
- the row to end shiftingn
- the number of rows to shiftpublic void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
shiftRows
in interface Sheet
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 defaultpublic void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight, boolean moveComments)
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 defaultmoveComments
- whether to move comments at the same time as the cells they are attached toprotected void insertChartRecords(java.util.List<Record> records)
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
If both colSplit and rowSplit are zero then the existing freeze pane is removed
createFreezePane
in interface Sheet
colSplit
- Horizonatal position of split.rowSplit
- Vertical position of split.leftmostColumn
- Left column visible in right pane.topRow
- Top row visible in bottom panepublic void createFreezePane(int colSplit, int rowSplit)
If both colSplit and rowSplit are zero then the existing freeze pane is removed
createFreezePane
in interface Sheet
colSplit
- Horizonatal position of split.rowSplit
- Vertical position of split.public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
createSplitPane
in interface Sheet
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_LEFTSheet.PANE_LOWER_LEFT
,
Sheet.PANE_LOWER_RIGHT
,
Sheet.PANE_UPPER_LEFT
,
Sheet.PANE_UPPER_RIGHT
public PaneInformation getPaneInformation()
getPaneInformation
in interface Sheet
public void setDisplayGridlines(boolean show)
setDisplayGridlines
in interface Sheet
show
- whether to show gridlines or notpublic boolean isDisplayGridlines()
isDisplayGridlines
in interface Sheet
public void setDisplayFormulas(boolean show)
setDisplayFormulas
in interface Sheet
show
- whether to show formulas or notpublic boolean isDisplayFormulas()
isDisplayFormulas
in interface Sheet
public void setDisplayRowColHeadings(boolean show)
setDisplayRowColHeadings
in interface Sheet
show
- whether to show RowColHeadings or notpublic boolean isDisplayRowColHeadings()
isDisplayRowColHeadings
in interface Sheet
public void setRowBreak(int row)
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.
setRowBreak
in interface Sheet
row
- the row to break, inclusivepublic boolean isRowBroken(int row)
Sheet
isRowBroken
in interface Sheet
row
- FIXME: Document this!
true
if there is a page break at the indicated rowpublic void removeRowBreak(int row)
removeRowBreak
in interface Sheet
public int[] getRowBreaks()
Sheet
getRowBreaks
in interface Sheet
null
public int[] getColumnBreaks()
Sheet
getColumnBreaks
in interface Sheet
null
public void setColumnBreak(int column)
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.
setColumnBreak
in interface Sheet
column
- the column to break, inclusivepublic boolean isColumnBroken(int column)
isColumnBroken
in interface Sheet
column
- FIXME: Document this!
public void removeColumnBreak(int column)
removeColumnBreak
in interface Sheet
column
- protected void validateRow(int row)
row
- protected void validateColumn(int column)
column
- public void dumpDrawingRecords(boolean fat, java.io.PrintWriter pw)
public EscherAggregate getDrawingEscherAggregate()
public HSSFPatriarch getDrawingPatriarch()
public HSSFPatriarch createDrawingPatriarch()
This may then be used to add graphics or charts.
Note that this will normally have the effect of removing any existing drawings on this sheet.
createDrawingPatriarch
in interface Sheet
public void setColumnGroupCollapsed(short columnNumber, boolean collapsed)
setColumnGroupCollapsed(int, boolean)
public void groupColumn(short fromColumn, short toColumn)
groupColumn(int, int)
public void ungroupColumn(short fromColumn, short toColumn)
ungroupColumn(int, int)
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
setColumnGroupCollapsed
in interface Sheet
columnNumber
- One of the columns in the group.collapsed
- true = collapse group, false = expand group.public void groupColumn(int fromColumn, int toColumn)
groupColumn
in interface Sheet
fromColumn
- beginning of the column range.toColumn
- end of the column range.public void ungroupColumn(int fromColumn, int toColumn)
Sheet
ungroupColumn
in interface Sheet
fromColumn
- start column (0-based)toColumn
- end column (0-based)public void groupRow(int fromRow, int toRow)
groupRow
in interface Sheet
fromRow
- start row (0-based)toRow
- end row (0-based)public void ungroupRow(int fromRow, int toRow)
Sheet
ungroupRow
in interface Sheet
fromRow
- start row (0-based)toRow
- end row (0-based)public void setRowGroupCollapsed(int rowIndex, boolean collapse)
Sheet
setRowGroupCollapsed
in interface Sheet
rowIndex
- start row of a groupped range of rows (0-based)collapse
- whether to expand/collapse the detail rowspublic void setDefaultColumnStyle(int column, CellStyle style)
setDefaultColumnStyle
in interface Sheet
column
- the column indexstyle
- the style to setpublic void autoSizeColumn(int column)
autoSizeColumn
in interface Sheet
column
- the column indexpublic void autoSizeColumn(int column, boolean useMergedCells)
autoSizeColumn
in interface Sheet
column
- the column indexuseMergedCells
- whether to use the contents of merged cells when calculating the width of the columnpublic HSSFComment getCellComment(int row, int column)
getCellComment
in interface Sheet
null
if not foundpublic HSSFSheetConditionalFormatting getSheetConditionalFormatting()
Sheet
getSheetConditionalFormatting
in interface Sheet
public java.lang.String getSheetName()
getSheetName
in interface Sheet
public CellRange<HSSFCell> setArrayFormula(java.lang.String formula, CellRangeAddress range)
Sheet
setArrayFormula
in interface Sheet
formula
- text representation of the formularange
- Region of array formula for result.
CellRange
of cells affected by this changepublic CellRange<HSSFCell> removeArrayFormula(Cell cell)
Sheet
removeArrayFormula
in interface Sheet
cell
- any cell within Array Formula range
CellRange
of cells affected by this changepublic DataValidationHelper getDataValidationHelper()
getDataValidationHelper
in interface Sheet
public HSSFAutoFilter setAutoFilter(CellRangeAddress range)
Sheet
setAutoFilter
in interface Sheet
range
- the range of cells to filterprotected HSSFComment findCellComment(int row, int column)
public CellRangeAddress getRepeatingRows()
Sheet
Sheet1!$1:$1 Sheet2!$5:$8The
CellRangeAddress
returned contains a column part which spans
all columns, and a row part which specifies the contiguous range of
repeating rows.
If the Sheet does not have any repeating rows defined, null is returned.
getRepeatingRows
in interface Sheet
CellRangeAddress
containing the repeating rows for the
Sheet, or null.public CellRangeAddress getRepeatingColumns()
Sheet
Sheet1!$A:$A Sheet2!$C:$FThe
CellRangeAddress
returned contains a row part which spans all
rows, and a column part which specifies the contiguous range of
repeating columns.
If the Sheet does not have any repeating columns defined, null is
returned.
getRepeatingColumns
in interface Sheet
CellRangeAddress
containing the repeating columns for
the Sheet, or null.public void setRepeatingRows(CellRangeAddress rowRangeRef)
Sheet
Sheet1!$1:$1 Sheet2!$5:$8The parameter
CellRangeAddress
should specify a column part
which spans all columns, and a row part which specifies the contiguous
range of repeating rows, e.g.:
sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));A null parameter value indicates that repeating rows should be removed from the Sheet:
sheet.setRepeatingRows(null);
setRepeatingRows
in interface Sheet
rowRangeRef
- a CellRangeAddress
containing the repeating
rows for the Sheet, or null.public void setRepeatingColumns(CellRangeAddress columnRangeRef)
Sheet
Sheet1!$A:$A Sheet2!$C:$FThe parameter
CellRangeAddress
should specify a row part
which spans all rows, and a column part which specifies the contiguous
range of repeating columns, e.g.:
sheet.setRepeatingColumns(CellRangeAddress.valueOf("B:C"));A null parameter value indicates that repeating columns should be removed from the Sheet:
sheet.setRepeatingColumns(null);
setRepeatingColumns
in interface Sheet
columnRangeRef
- a CellRangeAddress
containing the repeating
columns for the Sheet, or null.public int getColumnOutlineLevel(int columnIndex)
getColumnOutlineLevel
in interface Sheet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |