public class XSSFSheet extends POIXMLDocumentPart implements Sheet
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.
POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet |
sheet |
static int |
TWIPS_PER_POINT
Deprecated.
POI 5.0.0
|
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet |
worksheet |
BottomMargin, FooterMargin, HeaderMargin, LeftMargin, PANE_LOWER_LEFT, PANE_LOWER_RIGHT, PANE_UPPER_LEFT, PANE_UPPER_RIGHT, RightMargin, TopMargin
Modifier | Constructor and Description |
---|---|
protected |
XSSFSheet()
Creates new XSSFSheet - called by XSSFWorkbook to create a sheet from scratch.
|
protected |
XSSFSheet(PackagePart part)
Creates an XSSFSheet representing the given package part and relationship.
|
Modifier and Type | Method and Description |
---|---|
void |
addHyperlink(XSSFHyperlink hyperlink)
Register a hyperlink in the collection of hyperlinks on this sheet
|
void |
addIgnoredErrors(CellRangeAddress region,
IgnoredErrorType... ignoredErrorTypes)
Ignore errors across a range of cells.
|
void |
addIgnoredErrors(CellReference cell,
IgnoredErrorType... ignoredErrorTypes)
Add ignored errors (usually to suppress them in the UI of a consuming
application).
|
int |
addMergedRegion(CellRangeAddress region)
Adds a merged region of cells on a sheet.
|
int |
addMergedRegionUnsafe(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.
|
protected void |
commit()
Save the content in the underlying package part.
|
void |
copyRows(int srcStartRow,
int srcEndRow,
int destStartRow,
CellCopyPolicy cellCopyPolicy)
Copies rows between srcStartRow and srcEndRow to the same sheet, starting at destStartRow
Convenience function for
copyRows(List, int, CellCopyPolicy)
Equivalent to copyRows(getRows(srcStartRow, srcEndRow, false), destStartRow, cellCopyPolicy) |
void |
copyRows(java.util.List<? extends Row> srcRows,
int destStartRow,
CellCopyPolicy policy)
copyRows rows from srcRows to this sheet starting at destStartRow
Additionally copies merged regions that are completely defined in these
rows (ie.
|
XSSFDrawing |
createDrawingPatriarch()
Create a new SpreadsheetML drawing.
|
void |
createFreezePane(int colSplit,
int rowSplit)
Creates a split (freezepane).
|
void |
createFreezePane(int colSplit,
int rowSplit,
int leftmostColumn,
int topRow)
Creates a split (freezepane).
|
XSSFPivotTable |
createPivotTable(AreaReference source,
CellReference position)
Create a pivot table using the AreaReference range, at the given position.
|
XSSFPivotTable |
createPivotTable(AreaReference source,
CellReference position,
Sheet sourceSheet)
Create a pivot table using the AreaReference range on sourceSheet, at the given position.
|
XSSFPivotTable |
createPivotTable(Name source,
CellReference position)
Create a pivot table using the Name range, at the given position.
|
XSSFPivotTable |
createPivotTable(Name source,
CellReference position,
Sheet sourceSheet)
Create a pivot table using the Name range reference on sourceSheet, at the given position.
|
XSSFPivotTable |
createPivotTable(Table source,
CellReference position)
Create a pivot table using the Table, at the given position.
|
XSSFRow |
createRow(int rownum)
Create a new row within the sheet and return the high level representation
Note: If a row already exists at this position, it is removed/overwritten and
any existing cell is removed!
|
void |
createSplitPane(int xSplitPos,
int ySplitPos,
int leftmostColumn,
int topRow,
int activePane)
Creates a split pane.
|
XSSFTable |
createTable(AreaReference tableArea)
Creates a new Table, and associates it with this Sheet.
|
void |
disableLocking()
Disable sheet protection
|
void |
enableLocking()
Enable sheet protection
|
int |
findEndOfRowOutlineGroup(int row) |
CellAddress |
getActiveCell()
Return location of the active cell, e.g.
|
boolean |
getAutobreaks()
Flag indicating whether the sheet displays Automatic Page Breaks.
|
XSSFComment |
getCellComment(CellAddress address)
Return cell comment at row, column, if one exists.
|
java.util.Map<CellAddress,XSSFComment> |
getCellComments()
Returns all cell comments on this sheet.
|
int[] |
getColumnBreaks()
Vertical page break information used for print layout view, page layout view, drawing print breaks
in normal view, and for printing the worksheet.
|
ColumnHelper |
getColumnHelper() |
int |
getColumnOutlineLevel(int columnIndex)
Returns the column outline level.
|
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 actual column width (in units of 1/256th of a character width )
|
float |
getColumnWidthInPixels(int columnIndex)
Get the actual column width in pixels
|
protected CommentsTable |
getCommentsTable(boolean create)
Returns the sheet's comments object if there is one,
or null if not
|
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDrawing |
getCTDrawing() |
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTLegacyDrawing |
getCTLegacyDrawing() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet |
getCTWorksheet()
Provide access to the CTWorksheet bean holding this sheet's data
|
DataValidationHelper |
getDataValidationHelper() |
java.util.List<XSSFDataValidation> |
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 measued in point size (if the rows do not define their own height).
|
boolean |
getDisplayGuts()
Get whether to display the guts or not,
default value is true
|
XSSFDrawing |
getDrawingPatriarch()
Return the sheet's existing drawing, or null if there isn't yet one.
|
Footer |
getEvenFooter()
Returns the even footer.
|
Header |
getEvenHeader()
Returns the even header.
|
Footer |
getFirstFooter()
Returns the first page footer.
|
Header |
getFirstHeader()
Returns the first page header.
|
int |
getFirstRowNum()
Gets the first row on the sheet
|
boolean |
getFitToPage()
Flag indicating whether the Fit to Page print option is enabled.
|
Footer |
getFooter()
Returns the default footer for the sheet,
creating one as needed.
|
boolean |
getForceFormulaRecalculation()
Whether Excel will be asked to recalculate all formulas of this sheet
when the workbook is opened.
|
Header |
getHeader()
Returns the default header for the sheet,
creating one as needed.
|
XSSFHeaderFooterProperties |
getHeaderFooterProperties() |
boolean |
getHorizontallyCenter()
Determine whether printed output for this sheet will be horizontally centered.
|
XSSFHyperlink |
getHyperlink(CellAddress addr)
Get a Hyperlink in this sheet located in a cell specified by {code addr}
|
XSSFHyperlink |
getHyperlink(int row,
int column)
Get a Hyperlink in this sheet anchored at row, column
|
java.util.List<XSSFHyperlink> |
getHyperlinkList()
Get a list of Hyperlinks in this sheet
|
java.util.Map<IgnoredErrorType,java.util.Set<CellRangeAddress>> |
getIgnoredErrors()
Returns the errors currently being ignored and the ranges
where they are ignored.
|
int |
getLastRowNum()
Gets the last row on the sheet
Note: rows which had content before and were set to empty later might
still be counted as rows by Excel and Apache POI, so the result of this
method will include such rows and thus the returned value might be higher
than expected!
|
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.
|
java.util.List<CellRangeAddress> |
getMergedRegions()
Returns the list of merged regions.
|
protected int |
getNumberOfComments() |
int |
getNumHyperlinks() |
int |
getNumMergedRegions()
Returns the number of merged regions defined in this worksheet
|
Footer |
getOddFooter()
Returns the odd footer.
|
Header |
getOddHeader()
Returns the odd header.
|
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)
|
java.util.List<XSSFPivotTable> |
getPivotTables()
Returns all the pivot tables for this Sheet
|
XSSFPrintSetup |
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.
|
XSSFRow |
getRow(int rownum)
Returns the logical row ( 0-based).
|
int[] |
getRowBreaks()
Horizontal page break information used for print layout view, page layout view, drawing print breaks in normal
view, and for printing the worksheet.
|
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()
A flag indicating whether scenarios are locked when the sheet is protected.
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula |
getSharedFormula(int sid)
Return a master shared formula by index
|
XSSFSheetConditionalFormatting |
getSheetConditionalFormatting()
The 'Conditional Formatting' facet for this Sheet
|
java.lang.String |
getSheetName()
Returns the name of this sheet
|
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetViews |
getSheetTypeSheetViews(boolean create) |
XSSFColor |
getTabColor()
Get background color of the sheet tab.
|
java.util.List<XSSFTable> |
getTables()
Returns any tables associated with 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.
|
protected XSSFVMLDrawing |
getVMLDrawing(boolean autoCreate)
Get VML drawing for this sheet (aka 'legacy' drawig)
|
XSSFWorkbook |
getWorkbook()
Returns the parent XSSFWorkbook
|
void |
groupColumn(int fromColumn,
int toColumn)
Group between (0 based) columns
|
void |
groupRow(int fromRow,
int toRow)
Tie a range of cell together so that they can be collapsed or expanded
|
boolean |
hasComments()
Does this sheet have any comments on it? We need to know,
so we can decide about writing it to disk or not
|
boolean |
isAutoFilterLocked() |
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 |
isDeleteColumnsLocked() |
boolean |
isDeleteRowsLocked() |
boolean |
isDisplayFormulas()
Gets the flag indicating whether this sheet should display formulas.
|
boolean |
isDisplayGridlines()
Gets the flag indicating whether this sheet displays the lines
between rows and columns to make editing and reading easier.
|
boolean |
isDisplayRowColHeadings()
Gets the flag indicating whether this sheet should display row and column headings.
|
boolean |
isDisplayZeros()
Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.
|
boolean |
isFormatCellsLocked() |
boolean |
isFormatColumnsLocked() |
boolean |
isFormatRowsLocked() |
boolean |
isInsertColumnsLocked() |
boolean |
isInsertHyperlinksLocked() |
boolean |
isInsertRowsLocked() |
boolean |
isObjectsLocked() |
boolean |
isPivotTablesLocked() |
boolean |
isPrintGridlines()
Returns whether gridlines are printed.
|
boolean |
isPrintRowAndColumnHeadings()
Returns whether row and column headings are printed.
|
boolean |
isRightToLeft()
Whether the text is displayed in right-to-left mode in the window
|
boolean |
isRowBroken(int row)
Tests if there is a page break at the indicated row
|
boolean |
isScenariosLocked() |
boolean |
isSelected()
Returns a flag indicating whether this sheet is selected.
|
boolean |
isSelectLockedCellsLocked() |
boolean |
isSelectUnlockedCellsLocked() |
boolean |
isSheetLocked() |
boolean |
isSortLocked() |
java.util.Iterator<Row> |
iterator()
Alias for
rowIterator() to
allow foreach loops |
void |
lockAutoFilter(boolean enabled)
Enable or disable Autofilters locking.
|
void |
lockDeleteColumns(boolean enabled)
Enable or disable Deleting columns locking.
|
void |
lockDeleteRows(boolean enabled)
Enable or disable Deleting rows locking.
|
void |
lockFormatCells(boolean enabled)
Enable or disable Formatting cells locking.
|
void |
lockFormatColumns(boolean enabled)
Enable or disable Formatting columns locking.
|
void |
lockFormatRows(boolean enabled)
Enable or disable Formatting rows locking.
|
void |
lockInsertColumns(boolean enabled)
Enable or disable Inserting columns locking.
|
void |
lockInsertHyperlinks(boolean enabled)
Enable or disable Inserting hyperlinks locking.
|
void |
lockInsertRows(boolean enabled)
Enable or disable Inserting rows locking.
|
void |
lockObjects(boolean enabled)
Enable or disable Objects locking.
|
void |
lockPivotTables(boolean enabled)
Enable or disable Pivot Tables locking.
|
void |
lockScenarios(boolean enabled)
Enable or disable Scenarios locking.
|
void |
lockSelectLockedCells(boolean enabled)
Enable or disable Selection of locked cells locking.
|
void |
lockSelectUnlockedCells(boolean enabled)
Enable or disable Selection of unlocked cells locking.
|
void |
lockSort(boolean enabled)
Enable or disable Sort locking.
|
protected void |
onDeleteFormula(XSSFCell cell,
BaseXSSFEvaluationWorkbook evalWb)
when a cell with a 'master' shared formula is removed, the next cell in the range becomes the master
|
protected void |
onDocumentCreate()
Initialize worksheet data when creating a new sheet.
|
protected void |
onDocumentRead()
Initialize worksheet data when reading in an exisiting file.
|
protected void |
onSheetDelete()
called when a sheet is being deleted/removed from a workbook, to clean up relations and other document pieces tied to the sheet
|
void |
protectSheet(java.lang.String password)
Enables sheet protection and sets the password for the sheet.
|
protected void |
read(java.io.InputStream is) |
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTOleObject |
readOleObject(long shapeId)
Determine the OleObject which links shapes with embedded resources
|
CellRange<XSSFCell> |
removeArrayFormula(Cell cell)
Remove a Array Formula from this sheet.
|
void |
removeColumnBreak(int column)
Removes a page break at the indicated column
|
void |
removeHyperlink(int row,
int column)
Removes a hyperlink in the collection of hyperlinks on this sheet
|
void |
removeMergedRegion(int index)
Removes a merged region of cells (hence letting them free)
|
void |
removeMergedRegions(java.util.Collection<java.lang.Integer> indices)
Removes a number of merged regions of cells (hence letting them free)
This method can be used to bulk-remove merged regions in a way
much faster than calling removeMergedRegion() for every single
merged region.
|
void |
removeRow(Row row)
Remove a row from this sheet.
|
void |
removeRowBreak(int row)
Removes the page break at the indicated row
|
void |
removeTable(XSSFTable t)
Remove table references and relations
|
java.util.Iterator<Row> |
rowIterator()
Returns an iterator of the physical rows
|
void |
setActiveCell(CellAddress address)
Sets location of the active cell
|
CellRange<XSSFCell> |
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.
|
XSSFAutoFilter |
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)
Specifies the number of characters of the maximum digit width of the normal style's font.
|
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)
Sets default row height measured in point size.
|
void |
setDisplayFormulas(boolean show)
Sets the flag indicating whether this sheet should display formulas.
|
void |
setDisplayGridlines(boolean show)
Sets the flag indicating whether this sheet should display the lines
between rows and columns to make editing and reading easier.
|
void |
setDisplayGuts(boolean value)
Set whether to display the guts or not
|
void |
setDisplayRowColHeadings(boolean show)
Sets the flag indicating whether this sheet should display row and column headings.
|
void |
setDisplayZeros(boolean value)
Set whether the window should show 0 (zero) in cells containing zero value.
|
void |
setFitToPage(boolean b)
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)
Center on page horizontally when printing.
|
void |
setMargin(short margin,
double size)
Sets the size of the margin in inches.
|
void |
setPrintGridlines(boolean value)
Turns on or off the printing of gridlines.
|
void |
setPrintRowAndColumnHeadings(boolean value)
Turns on or off the printing of row and column headings.
|
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)
group the row It is possible for collapsed to be false and yet still have
the rows in question hidden.
|
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 |
setSheetPassword(java.lang.String password,
HashAlgorithm hashAlgo)
Sets the sheet password.
|
void |
setTabColor(XSSFColor color)
Set background color of the sheet tab
|
void |
setVerticallyCenter(boolean value)
Whether the output is vertically centered on the page.
|
void |
setZoom(int scale)
Window zoom magnification for current view representing percent values.
|
void |
shiftColumns(int startColumn,
int endColumn,
int n)
Shifts columns between startColumn and endColumn n number of columns.
|
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(int topRow,
int leftCol)
Location of the top left visible cell Location of the top left visible cell in the bottom right
pane (when in Left-to-Right mode).
|
void |
ungroupColumn(int fromColumn,
int toColumn)
Ungroup a range of columns that were previously grouped
|
void |
ungroupRow(int fromRow,
int toRow)
Ungroup a range of rows that were previously groupped
|
void |
validateMergedRegions()
Verify that merged regions do not intersect multi-cell array formulas and
no merged regions intersect another merged region in this sheet.
|
boolean |
validateSheetPassword(java.lang.String password)
Validate the password against the stored hash, the hashing method will be determined
by the existing password attributes
|
protected void |
write(java.io.OutputStream out) |
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
public static final int TWIPS_PER_POINT
Font.TWIPS_PER_POINT
instead.protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet sheet
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet worksheet
protected XSSFSheet()
XSSFWorkbook.createSheet()
protected XSSFSheet(PackagePart part)
part
- - The package part that holds xml data representing this sheet.public XSSFWorkbook getWorkbook()
getWorkbook
in interface Sheet
protected void onDocumentRead()
onDocumentRead
in class POIXMLDocumentPart
protected void read(java.io.InputStream is) throws java.io.IOException
java.io.IOException
protected void onDocumentCreate()
onDocumentCreate
in class POIXMLDocumentPart
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet getCTWorksheet()
public ColumnHelper getColumnHelper()
public java.lang.String getSheetName()
getSheetName
in interface Sheet
public int addMergedRegion(CellRangeAddress region)
addMergedRegion
in interface Sheet
region
- to mergejava.lang.IllegalArgumentException
- if region contains fewer than 2 cellsjava.lang.IllegalStateException
- if region intersects with a multi-cell array formulajava.lang.IllegalStateException
- if region intersects with an existing region on this sheetpublic int addMergedRegionUnsafe(CellRangeAddress region)
validateMergedRegions()
, which runs in O(n^2) time.addMergedRegionUnsafe
in interface Sheet
region
- to mergejava.lang.IllegalArgumentException
- if region contains fewer than 2 cellspublic void validateMergedRegions()
validateMergedRegions
in interface Sheet
java.lang.IllegalStateException
- if region intersects with a multi-cell array formulajava.lang.IllegalStateException
- if at least one region intersects with another merged region in this sheetpublic void autoSizeColumn(int column)
autoSizeColumn
in interface Sheet
column
- the column indexpublic void 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.autoSizeColumn
in interface Sheet
column
- the column indexuseMergedCells
- whether to use the contents of merged cells when calculating the width of the columnpublic XSSFDrawing getDrawingPatriarch()
createDrawingPatriarch()
to get or creategetDrawingPatriarch
in interface Sheet
public XSSFDrawing createDrawingPatriarch()
createDrawingPatriarch
in interface Sheet
protected XSSFVMLDrawing getVMLDrawing(boolean autoCreate)
autoCreate
- if true, then a new VML drawing part is creatednull
if the drawing was not found and autoCreate=falseprotected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDrawing getCTDrawing()
protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTLegacyDrawing getCTLegacyDrawing()
public void createFreezePane(int colSplit, int rowSplit)
createFreezePane
in interface Sheet
colSplit
- Horizontal position of split.rowSplit
- Vertical position of split.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
- Horizontal position of split.rowSplit
- Vertical position of split.leftmostColumn
- Left column visible in right pane.topRow
- Top row visible in bottom panepublic XSSFRow createRow(int rownum)
createRow
in interface Sheet
rownum
- row numberXSSFRow
object representing a row in the sheetremoveRow(org.apache.poi.ss.usermodel.Row)
public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
createSplitPane
in interface Sheet
xSplitPos
- Horizontal 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 XSSFComment getCellComment(CellAddress address)
getCellComment
in interface Sheet
address
- the location of the cell commentpublic java.util.Map<CellAddress,XSSFComment> getCellComments()
getCellComments
in interface Sheet
public XSSFHyperlink getHyperlink(int row, int column)
getHyperlink
in interface Sheet
row
- The row where the hyperlink is anchoredcolumn
- The column where the hyperlinkn is anchoredpublic XSSFHyperlink getHyperlink(CellAddress addr)
getHyperlink
in interface Sheet
addr
- The address of the cell containing the hyperlinkaddr
; otherwise returns null
public java.util.List<XSSFHyperlink> getHyperlinkList()
getHyperlinkList
in interface Sheet
public int[] getColumnBreaks()
getColumnBreaks
in interface Sheet
null
public int getColumnWidth(int columnIndex)
Note, the returned value is always gerater that getDefaultColumnWidth()
because the latter does not include margins.
Actual column width measured as the number of characters of the maximum digit width of the
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin
padding (two on each side), plus 1 pixel padding for the gridlines.
getColumnWidth
in interface Sheet
columnIndex
- - the column to set (0-based)public float getColumnWidthInPixels(int columnIndex)
Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx).
getColumnWidthInPixels
in interface Sheet
columnIndex
- - the column to set (0-based)public int getDefaultColumnWidth()
Note, this value is different from getColumnWidth(int)
. The latter is always greater and includes
4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.
getDefaultColumnWidth
in interface Sheet
public short getDefaultRowHeight()
getDefaultRowHeight
in interface Sheet
public float getDefaultRowHeightInPoints()
getDefaultRowHeightInPoints
in interface Sheet
public CellStyle getColumnStyle(int column)
getColumnStyle
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 boolean getDisplayGuts()
getDisplayGuts
in interface Sheet
public void setDisplayGuts(boolean value)
setDisplayGuts
in interface Sheet
value
- - guts or no gutspublic boolean isDisplayZeros()
isDisplayZeros
in interface Sheet
public void setDisplayZeros(boolean value)
setDisplayZeros
in interface Sheet
value
- whether to display or hide all zero values on the worksheetpublic int getFirstRowNum()
getFirstRowNum
in interface Sheet
public boolean getFitToPage()
getFitToPage
in interface Sheet
true
public Footer getFooter()
getFirstFooter()
,
getOddFooter()
and
getEvenFooter()
public Header getHeader()
getFirstHeader()
,
getOddHeader()
and
getEvenHeader()
public Footer getOddFooter()
public Footer getEvenFooter()
public Footer getFirstFooter()
public Header getOddHeader()
public Header getEvenHeader()
public Header getFirstHeader()
public boolean getHorizontallyCenter()
getHorizontallyCenter
in interface Sheet
public int getLastRowNum()
Sheet
getLastRowNum
in interface Sheet
public short getLeftCol()
Sheet
getLeftCol
in interface Sheet
public double getMargin(short margin)
getMargin
in interface Sheet
margin
- which margin to getSheet.LeftMargin
,
Sheet.RightMargin
,
Sheet.TopMargin
,
Sheet.BottomMargin
,
Sheet.HeaderMargin
,
Sheet.FooterMargin
public void setMargin(short margin, double size)
setMargin
in interface Sheet
margin
- which margin to getsize
- the size of the marginSheet.LeftMargin
,
Sheet.RightMargin
,
Sheet.TopMargin
,
Sheet.BottomMargin
,
Sheet.HeaderMargin
,
Sheet.FooterMargin
public CellRangeAddress getMergedRegion(int index)
getMergedRegions()
than to call
this each time.getMergedRegion
in interface Sheet
public java.util.List<CellRangeAddress> getMergedRegions()
getMergedRegion(int)
each time.getMergedRegions
in interface Sheet
public int getNumMergedRegions()
getNumMergedRegions
in interface Sheet
public int getNumHyperlinks()
public PaneInformation getPaneInformation()
getPaneInformation
in interface Sheet
public int getPhysicalNumberOfRows()
getPhysicalNumberOfRows
in interface Sheet
public XSSFPrintSetup getPrintSetup()
getPrintSetup
in interface Sheet
public boolean getProtect()
getProtect
in interface Sheet
public void protectSheet(java.lang.String password)
CTSheetProtection
that correspond to
the default values used by ExcelprotectSheet
in interface Sheet
password
- to set for protection. Pass null
to remove protectionpublic void setSheetPassword(java.lang.String password, HashAlgorithm hashAlgo)
password
- if null, the password will be removedhashAlgo
- if null, the password will be set as XOR password (Excel 2010 and earlier)
otherwise the given algorithm is used for calculating the hash password (Excel 2013)public boolean validateSheetPassword(java.lang.String password)
public XSSFRow getRow(int rownum)
public int[] getRowBreaks()
getRowBreaks
in interface Sheet
null
public 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.
getRowSumsBelow
in interface Sheet
true
if row summaries appear below detail in the outlinepublic 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.
setRowSumsBelow
in interface Sheet
value
- true
if row summaries appear below detail in the outlinepublic boolean 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.
getRowSumsRight
in interface Sheet
true
if col summaries appear right of the detail in the outlinepublic void 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.
setRowSumsRight
in interface Sheet
value
- true
if col summaries appear right of the detail in the outlinepublic boolean getScenarioProtect()
getScenarioProtect
in interface Sheet
public short getTopRow()
public boolean getVerticallyCenter()
getVerticallyCenter
in interface Sheet
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 groupRow(int fromRow, int toRow)
public boolean isColumnBroken(int column)
isColumnBroken
in interface Sheet
column
- FIXME: Document this!public boolean isColumnHidden(int columnIndex)
isColumnHidden
in interface Sheet
columnIndex
- - the column to set (0-based)false
if the column is visiblepublic boolean isDisplayFormulas()
isDisplayFormulas
in interface Sheet
true
if this sheet should display formulas.public boolean isDisplayGridlines()
isDisplayGridlines
in interface Sheet
true
(default) if this sheet displays gridlines.to check if printing of gridlines is turned on or off
public void setDisplayGridlines(boolean show)
setPrintGridlines(boolean)
setDisplayGridlines
in interface Sheet
show
- true
if this sheet should display gridlines.setPrintGridlines(boolean)
public boolean isDisplayRowColHeadings()
Row heading are the row numbers to the side of the sheet
Column heading are the letters or numbers that appear above the columns of the sheet
isDisplayRowColHeadings
in interface Sheet
true
(default) if this sheet should display row and column headings.public void setDisplayRowColHeadings(boolean show)
Row heading are the row numbers to the side of the sheet
Column heading are the letters or numbers that appear above the columns of the sheet
setDisplayRowColHeadings
in interface Sheet
show
- true
if this sheet should display row and column headings.public boolean isPrintGridlines()
isPrintGridlines
in interface Sheet
to check if gridlines are displayed on screen
public void setPrintGridlines(boolean value)
setPrintGridlines
in interface Sheet
value
- boolean to turn on or off the printing of gridlinesto display gridlines on screen
public boolean isPrintRowAndColumnHeadings()
isPrintRowAndColumnHeadings
in interface Sheet
public void setPrintRowAndColumnHeadings(boolean value)
setPrintRowAndColumnHeadings
in interface Sheet
value
- boolean to turn on or off the printing of row and column headingspublic boolean isRowBroken(int row)
isRowBroken
in interface Sheet
row
- index of the row to testtrue
if there is a page break at the indicated rowpublic 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 void removeColumnBreak(int column)
removeColumnBreak
in interface Sheet
column
- The 0-based index of the column.public void removeMergedRegion(int index)
removeMergedRegion
in interface Sheet
index
- of the region to unmergepublic void removeMergedRegions(java.util.Collection<java.lang.Integer> indices)
removeMergedRegions
in interface Sheet
indices
- A set of the regions to unmergepublic void removeRow(Row row)
public void removeRowBreak(int row)
removeRowBreak
in interface Sheet
row
- The 0-based index of the row.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 java.util.Iterator<Row> rowIterator()
Sheet
rowIterator
in interface Sheet
public java.util.Iterator<Row> iterator()
rowIterator()
to
allow foreach loopsiterator
in interface java.lang.Iterable<Row>
public boolean getAutobreaks()
getAutobreaks
in interface Sheet
true
if the sheet displays Automatic Page Breaks.public void setAutobreaks(boolean value)
setAutobreaks
in interface Sheet
value
- true
if the sheet displays Automatic Page Breaks.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 void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
Sheet
setColumnGroupCollapsed
in interface Sheet
columnNumber
- One of the columns in the group.collapsed
- true = collapse group, false = expand group.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 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;
which gives 7.29
.
setColumnWidth
in interface Sheet
columnIndex
- - the column to set (0-based)width
- - the width in units of 1/256th of a character widthjava.lang.IllegalArgumentException
- if width > 255*256 (the maximum column width in Excel is 255 characters)public void setDefaultColumnStyle(int column, CellStyle style)
Sheet
setDefaultColumnStyle
in interface Sheet
column
- the column indexstyle
- the style to setpublic void setDefaultColumnWidth(int width)
setDefaultColumnWidth
in interface Sheet
width
- the number of characters. Default value is 8
.public void setDefaultRowHeight(short height)
setDefaultRowHeight
in interface Sheet
height
- default row height in twips (1/20 of a point)public void setDefaultRowHeightInPoints(float height)
setDefaultRowHeightInPoints
in interface Sheet
height
- default row height measured in point size.public void setDisplayFormulas(boolean show)
setDisplayFormulas
in interface Sheet
show
- true
if this sheet should display formulas.public void setFitToPage(boolean b)
setFitToPage
in interface Sheet
b
- true
if the Fit to Page print option is enabled.public void setHorizontallyCenter(boolean value)
setHorizontallyCenter
in interface Sheet
value
- whether to center on page horizontally when printing.public void setVerticallyCenter(boolean value)
setVerticallyCenter
in interface Sheet
value
- true to vertically center, false otherwise.public void setRowGroupCollapsed(int rowIndex, boolean collapse)
setRowGroupCollapsed
in interface Sheet
rowIndex
- -
the row involved, 0 basedcollapse
- -
boolean value for collapsepublic int findEndOfRowOutlineGroup(int row)
row
- the zero based row index to find frompublic void setZoom(int scale)
10 - 10% 20 - 20% ... 100 - 100% ... 400 - 400%Current view can be Normal, Page Layout, or Page Break Preview.
@Beta public void copyRows(java.util.List<? extends Row> srcRows, int destStartRow, CellCopyPolicy policy)
srcRows
- the rows to copy. Formulas will be offset by the difference
in the row number of the first row in srcRows and destStartRow (even if srcRows
are from a different sheet).destStartRow
- the row in this sheet to paste the first row of srcRows
the remainder of srcRows will be pasted below destStartRow per the cell copy policypolicy
- is the cell copy policy, which can be used to merge the source and destination
when the source is blank, copy styles only, paste as value, etc@Beta public void copyRows(int srcStartRow, int srcEndRow, int destStartRow, CellCopyPolicy cellCopyPolicy)
copyRows(List, int, CellCopyPolicy)
Equivalent to copyRows(getRows(srcStartRow, srcEndRow, false), destStartRow, cellCopyPolicy)srcStartRow
- the index of the first row to copy the cells from in this sheetsrcEndRow
- the index of the last row to copy the cells from in this sheetdestStartRow
- the index of the first row to copy the cells to in this sheetcellCopyPolicy
- the policy to use to determine how cells are copiedpublic void 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).
public void 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). All merged regions that are completely overlaid by shifting will be deleted.
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 shiftColumns(int startColumn, int endColumn, int n)
shiftColumns
in interface Sheet
startColumn
- the column to start shiftingendColumn
- the column to end shiftingn
- length of the shifting steppublic 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 ungroupColumn(int fromColumn, int toColumn)
Sheet
ungroupColumn
in interface Sheet
fromColumn
- start column (0-based)toColumn
- end column (0-based)public void ungroupRow(int fromRow, int toRow)
ungroupRow
in interface Sheet
fromRow
- start row (0-based)toRow
- end row (0-based)protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetViews getSheetTypeSheetViews(boolean create)
public boolean isSelected()
When only 1 sheet is selected and active, this value should be in synch with the activeTab value. In case of a conflict, the Start Part setting wins and sets the active sheet tab.
Note: multiple sheets can be selected, but only one sheet can be active at one time.isSelected
in interface Sheet
true
if this sheet is selectedpublic void setSelected(boolean value)
When only 1 sheet is selected and active, this value should be in synch with the activeTab value. In case of a conflict, the Start Part setting wins and sets the active sheet tab.
Note: multiple sheets can be selected, but only one sheet can be active at one time.setSelected
in interface Sheet
value
- true
if this sheet is selectedWorkbook.setActiveSheet(int)
@Internal public void addHyperlink(XSSFHyperlink hyperlink)
hyperlink
- the link to add@Internal public void removeHyperlink(int row, int column)
row
- row indexcolumn
- column indexpublic CellAddress getActiveCell()
A1
.getActiveCell
in interface Sheet
public void setActiveCell(CellAddress address)
setActiveCell
in interface Sheet
address
- the location of the active cell, e.g. A1
.public boolean hasComments()
protected int getNumberOfComments()
protected CommentsTable getCommentsTable(boolean create)
create
- create a new comments table if it does not exist@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula getSharedFormula(int sid)
sid
- shared group indexnull
if not foundprotected void commit() throws java.io.IOException
POIXMLDocumentPart
Sub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
protected void commit() throws IOException { PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }
commit
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committedprotected void write(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public boolean isAutoFilterLocked()
public boolean isDeleteColumnsLocked()
public boolean isDeleteRowsLocked()
public boolean isFormatCellsLocked()
public boolean isFormatColumnsLocked()
public boolean isFormatRowsLocked()
public boolean isInsertColumnsLocked()
public boolean isInsertHyperlinksLocked()
public boolean isInsertRowsLocked()
public boolean isPivotTablesLocked()
public boolean isSortLocked()
public boolean isObjectsLocked()
public boolean isScenariosLocked()
public boolean isSelectLockedCellsLocked()
public boolean isSelectUnlockedCellsLocked()
public boolean isSheetLocked()
public void enableLocking()
public void disableLocking()
public void lockAutoFilter(boolean enabled)
disableLocking()
or enableLocking()
public void lockDeleteColumns(boolean enabled)
disableLocking()
or enableLocking()
public void lockDeleteRows(boolean enabled)
disableLocking()
or enableLocking()
public void lockFormatCells(boolean enabled)
disableLocking()
or enableLocking()
public void lockFormatColumns(boolean enabled)
disableLocking()
or enableLocking()
public void lockFormatRows(boolean enabled)
disableLocking()
or enableLocking()
public void lockInsertColumns(boolean enabled)
disableLocking()
or enableLocking()
public void lockInsertHyperlinks(boolean enabled)
disableLocking()
or enableLocking()
public void lockInsertRows(boolean enabled)
disableLocking()
or enableLocking()
public void lockPivotTables(boolean enabled)
disableLocking()
or enableLocking()
public void lockSort(boolean enabled)
disableLocking()
or enableLocking()
public void lockObjects(boolean enabled)
disableLocking()
or enableLocking()
public void lockScenarios(boolean enabled)
disableLocking()
or enableLocking()
public void lockSelectLockedCells(boolean enabled)
disableLocking()
or enableLocking()
public void lockSelectUnlockedCells(boolean enabled)
disableLocking()
or enableLocking()
public CellRange<XSSFCell> setArrayFormula(java.lang.String formula, CellRangeAddress range)
Sheet
Note if there are shared formulas this will invalidate any
FormulaEvaluator
instances based on this workbook
setArrayFormula
in interface Sheet
formula
- text representation of the formularange
- Region of array formula for result.CellRange
of cells affected by this changepublic CellRange<XSSFCell> removeArrayFormula(Cell cell)
Sheet
removeArrayFormula
in interface Sheet
cell
- any cell within Array Formula rangeCellRange
of cells affected by this changepublic DataValidationHelper getDataValidationHelper()
getDataValidationHelper
in interface Sheet
public java.util.List<XSSFDataValidation> getDataValidations()
Sheet
getDataValidations
in interface Sheet
public void addValidationData(DataValidation dataValidation)
Sheet
addValidationData
in interface Sheet
dataValidation
- The Data validation object settingspublic XSSFAutoFilter setAutoFilter(CellRangeAddress range)
Sheet
setAutoFilter
in interface Sheet
range
- the range of cells to filterpublic XSSFTable createTable(AreaReference tableArea)
The table is assigned a default display name (since 4.1.1) which can be overridden
by calling setDisplayName
. The default display name is guaranteed to not conflict
with the names of any XSSFName
or XSSFTable
in the workbook.
tableArea
- the area that the table should cover, should not be nullpublic java.util.List<XSSFTable> getTables()
public void removeTable(XSSFTable t)
t
- table to removepublic XSSFSheetConditionalFormatting getSheetConditionalFormatting()
Sheet
getSheetConditionalFormatting
in interface Sheet
public XSSFColor getTabColor()
public void setTabColor(XSSFColor color)
color
- the color to setpublic CellRangeAddress getRepeatingRows()
Sheet
Repeating rows cover a range of contiguous rows, e.g.:
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
Repeating columns cover a range of contiguous columns, e.g.:
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
Repeating rows cover a range of contiguous rows, e.g.:
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
Repeating columns cover a range of contiguous columns, e.g.:
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.@Beta public XSSFPivotTable createPivotTable(AreaReference source, CellReference position, Sheet sourceSheet)
source
- location of pivot dataposition
- A reference to the top left cell where the pivot table will startsourceSheet
- The sheet containing the source data, if the source reference doesn't contain a sheet namejava.lang.IllegalArgumentException
- if source references a sheet different than sourceSheet@Beta public XSSFPivotTable createPivotTable(AreaReference source, CellReference position)
source
- location of pivot dataposition
- A reference to the top left cell where the pivot table will start@Beta public XSSFPivotTable createPivotTable(Name source, CellReference position, Sheet sourceSheet)
source
- location of pivot dataposition
- A reference to the top left cell where the pivot table will startsourceSheet
- The sheet containing the source data, if the source reference doesn't contain a sheet namejava.lang.IllegalArgumentException
- if source references a sheet different than sourceSheet@Beta public XSSFPivotTable createPivotTable(Name source, CellReference position)
source
- location of pivot dataposition
- A reference to the top left cell where the pivot table will start@Beta public XSSFPivotTable createPivotTable(Table source, CellReference position)
source
- location of pivot dataposition
- A reference to the top left cell where the pivot table will start@Beta public java.util.List<XSSFPivotTable> getPivotTables()
public int getColumnOutlineLevel(int columnIndex)
Sheet
getColumnOutlineLevel
in interface Sheet
public void addIgnoredErrors(CellReference cell, IgnoredErrorType... ignoredErrorTypes)
cell
- Cell.ignoredErrorTypes
- Types of error to ignore there.public void addIgnoredErrors(CellRangeAddress region, IgnoredErrorType... ignoredErrorTypes)
region
- Range of cells.ignoredErrorTypes
- Types of error to ignore there.public java.util.Map<IgnoredErrorType,java.util.Set<CellRangeAddress>> getIgnoredErrors()
protected void onSheetDelete()
protected void onDeleteFormula(XSSFCell cell, BaseXSSFEvaluationWorkbook evalWb)
cell
- The cell that is removedevalWb
- BaseXSSFEvaluationWorkbook in use, if one existsprotected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTOleObject readOleObject(long shapeId)
shapeId
- the shape idpublic XSSFHeaderFooterProperties getHeaderFooterProperties()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.