Class SXSSFSheet
- java.lang.Object
-
- org.apache.poi.xssf.streaming.SXSSFSheet
-
-
Field Summary
-
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
Constructors Constructor Description SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet xSheet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddMergedRegion(CellRangeAddress region)Adds a merged region of cells (hence those cells form one)intaddMergedRegionUnsafe(CellRangeAddress region)Adds a merged region of cells (hence those cells form one)voidaddValidationData(DataValidation dataValidation)Creates a data validation objectbooleanareAllRowsFlushed()Are all rows flushed to disk?voidautoSizeColumn(int column)Adjusts the column width to fit the contents.voidautoSizeColumn(int column, boolean useMergedCells)Adjusts the column width to fit the contents.voidchangeRowNum(SXSSFRow row, int newRowNum)SXSSFDrawingcreateDrawingPatriarch()Creates the top-level drawing patriarch.voidcreateFreezePane(int colSplit, int rowSplit)Creates a split (freezepane).voidcreateFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)Creates a split (freezepane).SXSSFRowcreateRow(int rownum)Create a new row within the sheet and return the high level representationvoidcreateSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)Creates a split pane.voiddisableLocking()Disable sheet protectionvoidenableLocking()Enable sheet protectionvoidflushRows()Flush all rows to disk.voidflushRows(int remaining)Specifies how many rows can be accessed at most via getRow().CellAddressgetActiveCell()Return location of the active cell, e.g.booleangetAutobreaks()Flag indicating whether the sheet displays Automatic Page Breaks.XSSFCommentgetCellComment(CellAddress ref)Returns cell comment for the specified row and columnjava.util.Map<CellAddress,XSSFComment>getCellComments()Returns all cell comments on this sheet.int[]getColumnBreaks()Retrieves all the vertical page breaksintgetColumnOutlineLevel(int columnIndex)Returns the column outline level.CellStylegetColumnStyle(int column)Returns the CellStyle that applies to the given (0 based) column, or null if no style has been set for that columnintgetColumnWidth(int columnIndex)get the width (in units of 1/256th of a character width )floatgetColumnWidthInPixels(int columnIndex)Get the actual column width in pixelsDataValidationHelpergetDataValidationHelper()java.util.List<XSSFDataValidation>getDataValidations()Returns the list of DataValidation in the sheet.intgetDefaultColumnWidth()Get the default column width for the sheet (if the columns do not define their own width) in charactersshortgetDefaultRowHeight()Get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)floatgetDefaultRowHeightInPoints()Get the default row height for the sheet (if the rows do not define their own height) in points.booleangetDisplayGuts()Get whether to display the guts or not, default value is trueXSSFDrawinggetDrawingPatriarch()Return the sheet's existing drawing, or null if there isn't yet one.intgetFirstRowNum()Gets the first row on the sheetbooleangetFitToPage()Flag indicating whether the Fit to Page print option is enabled.FootergetFooter()Gets the user model for the default document footer.booleangetForceFormulaRecalculation()Whether Excel will be asked to recalculate all formulas when the workbook is opened.HeadergetHeader()Gets the user model for the default document header.booleangetHorizontallyCenter()Determine whether printed output for this sheet will be horizontally centered.XSSFHyperlinkgetHyperlink(int row, int column)Get a Hyperlink in this sheet anchored at row, columnXSSFHyperlinkgetHyperlink(CellAddress addr)Get a Hyperlink in this sheet located in a cell specified by {code addr}java.util.List<XSSFHyperlink>getHyperlinkList()Get a list of Hyperlinks in this sheetintgetLastFlushedRowNum()intgetLastRowNum()Gets the last row on the sheetshortgetLeftCol()The left col in the visible view when the sheet is first viewed after opening it in a viewerdoublegetMargin(short margin)Gets the size of the margin in inches.CellRangeAddressgetMergedRegion(int index)Returns the merged region at the specified index.java.util.List<CellRangeAddress>getMergedRegions()Returns the list of merged regions.intgetNumMergedRegions()Returns the number of merged regionsPaneInformationgetPaneInformation()Returns the information regarding the currently configured pane (split or freeze)intgetPhysicalNumberOfRows()Returns the number of physically defined rows (NOT the number of rows in the sheet)PrintSetupgetPrintSetup()Gets the print setup object.booleangetProtect()Answer whether protection is enabled or disabledCellRangeAddressgetRepeatingColumns()Gets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.CellRangeAddressgetRepeatingRows()Gets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.SXSSFRowgetRow(int rownum)Returns the logical row (not physical) 0-based.int[]getRowBreaks()Retrieves all the horizontal page breaksintgetRowNum(SXSSFRow row)booleangetRowSumsBelow()Flag indicating whether summary rows appear below detail in an outline, when applying an outline.booleangetRowSumsRight()Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.booleangetScenarioProtect()Answer whether scenario protection is enabled or disabledSheetConditionalFormattinggetSheetConditionalFormatting()The 'Conditional Formatting' facet for this Sheetjava.lang.StringgetSheetName()Returns the name of this sheetXSSFColorgetTabColor()shortgetTopRow()The top row in the visible view when the sheet is first viewed after opening it in a viewerjava.util.Set<java.lang.Integer>getTrackedColumnsForAutoSizing()Get the currently tracked columns for auto-sizing.booleangetVerticallyCenter()Determine whether printed output for this sheet will be vertically centered.SXSSFWorkbookgetWorkbook()Return the parent workbookjava.io.InputStreamgetWorksheetXMLInputStream()voidgroupColumn(int fromColumn, int toColumn)Create an outline for the provided column range.voidgroupRow(int fromRow, int toRow)Tie a range of rows together so that they can be collapsed or expandedbooleanisColumnBroken(int column)Determines if there is a page break at the indicated columnbooleanisColumnHidden(int columnIndex)Get the hidden state for a given columnbooleanisColumnTrackedForAutoSizing(int column)Returns true if column is currently tracked for auto-sizing.booleanisDisplayFormulas()Returns if formulas are displayedbooleanisDisplayGridlines()Returns if gridlines are displayedbooleanisDisplayRowColHeadings()Returns if RowColHeadings are displayed.booleanisDisplayZeros()Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.booleanisPrintGridlines()Returns whether gridlines are printed.booleanisPrintRowAndColumnHeadings()Returns whether row and column headings are printed.booleanisRightToLeft()Whether the text is displayed in right-to-left mode in the windowbooleanisRowBroken(int row)Determines if there is a page break at the indicated rowbooleanisSelected()Note - this is not the same as whether the sheet is focused (isActive)java.util.Iterator<Row>iterator()voidlockAutoFilter(boolean enabled)Enable or disable Autofilters locking.voidlockDeleteColumns(boolean enabled)Enable or disable Deleting columns locking.voidlockDeleteRows(boolean enabled)Enable or disable Deleting rows locking.voidlockFormatCells(boolean enabled)Enable or disable Formatting cells locking.voidlockFormatColumns(boolean enabled)Enable or disable Formatting columns locking.voidlockFormatRows(boolean enabled)Enable or disable Formatting rows locking.voidlockInsertColumns(boolean enabled)Enable or disable Inserting columns locking.voidlockInsertHyperlinks(boolean enabled)Enable or disable Inserting hyperlinks locking.voidlockInsertRows(boolean enabled)Enable or disable Inserting rows locking.voidlockObjects(boolean enabled)Enable or disable Objects locking.voidlockPivotTables(boolean enabled)Enable or disable Pivot Tables locking.voidlockScenarios(boolean enabled)Enable or disable Scenarios locking.voidlockSelectLockedCells(boolean enabled)Enable or disable Selection of locked cells locking.voidlockSelectUnlockedCells(boolean enabled)Enable or disable Selection of unlocked cells locking.voidlockSort(boolean enabled)Enable or disable Sort locking.voidprotectSheet(java.lang.String password)Sets the protection enabled as well as the passwordCellRange<? extends Cell>removeArrayFormula(Cell cell)Remove a Array Formula from this sheet.voidremoveColumnBreak(int column)Removes a page break at the indicated columnvoidremoveMergedRegion(int index)Removes a merged region of cells (hence letting them free)voidremoveMergedRegions(java.util.Collection<java.lang.Integer> indices)Removes a merged region of cells (hence letting them free)voidremoveRow(Row row)Remove a row from this sheet.voidremoveRowBreak(int row)Removes the page break at the indicated rowjava.util.Iterator<Row>rowIterator()Returns an iterator of the physical rowsvoidsetActiveCell(CellAddress address)Sets location of the active cellCellRange<? extends Cell>setArrayFormula(java.lang.String formula, CellRangeAddress range)Sets array formula to specified region for result.voidsetAutobreaks(boolean value)Flag indicating whether the sheet displays Automatic Page Breaks.AutoFiltersetAutoFilter(CellRangeAddress range)Enable filtering for a range of cellsvoidsetColumnBreak(int column)Sets a page break at the indicated columnvoidsetColumnGroupCollapsed(int columnNumber, boolean collapsed)Expands or collapses a column group.voidsetColumnHidden(int columnIndex, boolean hidden)Get the visibility state for a given columnvoidsetColumnWidth(int columnIndex, int width)Set the width (in units of 1/256th of a character width)voidsetDefaultColumnStyle(int column, CellStyle style)Sets the default column style for a given column.voidsetDefaultColumnWidth(int width)Set the default column width for the sheet (if the columns do not define their own width) in charactersvoidsetDefaultRowHeight(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)voidsetDefaultRowHeightInPoints(float height)Set the default row height for the sheet (if the rows do not define their own height) in pointsvoidsetDisplayFormulas(boolean show)Sets whether the formulas are shown in a viewervoidsetDisplayGridlines(boolean show)Sets whether the gridlines are shown in a viewervoidsetDisplayGuts(boolean value)Set whether to display the guts or notvoidsetDisplayRowColHeadings(boolean show)Sets whether the RowColHeadings are shown in a viewervoidsetDisplayZeros(boolean value)Set whether the window should show 0 (zero) in cells containing zero value.voidsetFitToPage(boolean value)Flag indicating whether the Fit to Page print option is enabled.voidsetForceFormulaRecalculation(boolean value)Control if Excel should be asked to recalculate all formulas when the workbook is opened, via the "sheetCalcPr fullCalcOnLoad" option.voidsetHorizontallyCenter(boolean value)Determines whether the output is horizontally centered on the page.voidsetMargin(short margin, double size)Sets the size of the margin in inches.voidsetPrintGridlines(boolean show)Turns on or off the printing of gridlines.voidsetPrintRowAndColumnHeadings(boolean show)Turns on or off the printing of row and column headings.voidsetRandomAccessWindowSize(int value)Specifies how many rows can be accessed at most via getRow().voidsetRepeatingColumns(CellRangeAddress columnRangeRef)Sets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.voidsetRepeatingRows(CellRangeAddress rowRangeRef)Sets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.voidsetRightToLeft(boolean value)Sets whether the worksheet is displayed from right to left instead of from left to right.voidsetRowBreak(int row)Sets a page break at the indicated rowvoidsetRowGroupCollapsed(int row, boolean collapse)Set view state of a grouped range of rows.voidsetRowOutlineLevel(int rownum, int level)Set row groupings (like groupRow) in a stream-friendly mannervoidsetRowSumsBelow(boolean value)Flag indicating whether summary rows appear below detail in an outline, when applying an outline.voidsetRowSumsRight(boolean value)Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.voidsetSelected(boolean value)Sets a flag indicating whether this sheet is selected.voidsetTabColor(int colorIndex)Set background color of the sheet tabvoidsetTabColor(XSSFColor color)voidsetVerticallyCenter(boolean value)Determines whether the output is vertically centered on the page.voidsetZoom(int scale)Window zoom magnification for current view representing percent values.voidshiftColumns(int startColumn, int endColumn, int n)Shifts columns between startColumn and endColumn, n number of columns.voidshiftRows(int startRow, int endRow, int n)Not implemented for SXSSFSheets Shifts rows between startRow and endRow n number of rows.voidshiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)Not implemented for SXSSFSheets Shifts rows between startRow and endRow n number of rows.voidshowInPane(int toprow, int leftcol)Sets desktop window pane display area, when the file is first opened in a viewer.voidtrackAllColumnsForAutoSizing()Tracks all columns in the sheet for auto-sizing.voidtrackColumnForAutoSizing(int column)Track a column in the sheet for auto-sizing.voidtrackColumnsForAutoSizing(java.util.Collection<java.lang.Integer> columns)Track several columns in the sheet for auto-sizing.voidungroupColumn(int fromColumn, int toColumn)Ungroup a range of columns that were previously grouppedvoidungroupRow(int fromRow, int toRow)Ungroup a range of rows that were previously grouppedvoiduntrackAllColumnsForAutoSizing()Untracks all columns in the sheet for auto-sizing.booleanuntrackColumnForAutoSizing(int column)Removes a column that was previously marked for inclusion in auto-size column tracking.booleanuntrackColumnsForAutoSizing(java.util.Collection<java.lang.Integer> columns)Untracks several columns in the sheet for auto-sizing.voidvalidateMergedRegions()Verify that merged regions do not intersect multi-cell array formulas and no merged regions intersect another merged region in this sheet.
-
-
-
Constructor Detail
-
SXSSFSheet
public SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet xSheet) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getWorksheetXMLInputStream
public java.io.InputStream getWorksheetXMLInputStream() throws java.io.IOException- Throws:
java.io.IOException
-
iterator
public java.util.Iterator<Row> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Row>
-
createRow
public SXSSFRow createRow(int rownum)
Create a new row within the sheet and return the high level representation- Specified by:
createRowin interfaceSheet- Parameters:
rownum- row number- Returns:
- high level Row object representing a row in the sheet
- Throws:
java.lang.IllegalArgumentException- If the max. number of rows is exceeded or a rownum is provided where the row is already flushed to disk.- See Also:
removeRow(Row)
-
removeRow
public void removeRow(Row row)
Remove a row from this sheet. All cells contained in the row are removed as well
-
getRow
public SXSSFRow getRow(int rownum)
Returns the logical row (not physical) 0-based. If you ask for a row that is not defined you get a null. This is to say row 4 represents the fifth row on a sheet.
-
getPhysicalNumberOfRows
public int getPhysicalNumberOfRows()
Returns the number of physically defined rows (NOT the number of rows in the sheet)- Specified by:
getPhysicalNumberOfRowsin interfaceSheet- Returns:
- the number of physically defined rows in this sheet
-
getFirstRowNum
public int getFirstRowNum()
Gets the first row on the sheet- Specified by:
getFirstRowNumin interfaceSheet- Returns:
- the number of the first logical row on the sheet (0-based)
-
getLastRowNum
public int getLastRowNum()
Gets the last row on the sheet- Specified by:
getLastRowNumin interfaceSheet- Returns:
- last row contained n this sheet (0-based)
-
setColumnHidden
public void setColumnHidden(int columnIndex, boolean hidden)Get the visibility state for a given column- Specified by:
setColumnHiddenin interfaceSheet- Parameters:
columnIndex- - the column to get (0-based)hidden- - the visiblity state of the column
-
isColumnHidden
public boolean isColumnHidden(int columnIndex)
Get the hidden state for a given column- Specified by:
isColumnHiddenin interfaceSheet- Parameters:
columnIndex- - the column to set (0-based)- Returns:
- hidden -
falseif the column is visible
-
setColumnWidth
public void setColumnWidth(int columnIndex, int width)Set the width (in units of 1/256th of a character width)The maximum column width for an individual cell is 255 characters. This value represents the number of characters that can be displayed in a cell that is formatted with the standard font.
- Specified by:
setColumnWidthin interfaceSheet- Parameters:
columnIndex- - the column to set (0-based)width- - the width in units of 1/256th of a character width
-
getColumnWidth
public int getColumnWidth(int columnIndex)
get the width (in units of 1/256th of a character width )- Specified by:
getColumnWidthin interfaceSheet- Parameters:
columnIndex- - the column to set (0-based)- Returns:
- width - the width in units of 1/256th of a character width
-
getColumnWidthInPixels
public float getColumnWidthInPixels(int columnIndex)
Get the actual column width in pixelsPlease note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx).
- Specified by:
getColumnWidthInPixelsin interfaceSheet- Parameters:
columnIndex- - the column to set (0-based)- Returns:
- width in pixels
-
setDefaultColumnWidth
public void setDefaultColumnWidth(int width)
Set the default column width for the sheet (if the columns do not define their own width) in characters- Specified by:
setDefaultColumnWidthin interfaceSheet- Parameters:
width- default column width measured in characters
-
getDefaultColumnWidth
public int getDefaultColumnWidth()
Get the default column width for the sheet (if the columns do not define their own width) in characters- Specified by:
getDefaultColumnWidthin interfaceSheet- Returns:
- default column width measured in characters
-
getDefaultRowHeight
public 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)- Specified by:
getDefaultRowHeightin interfaceSheet- Returns:
- default row height measured in twips (1/20 of a point)
-
getDefaultRowHeightInPoints
public float getDefaultRowHeightInPoints()
Get the default row height for the sheet (if the rows do not define their own height) in points.- Specified by:
getDefaultRowHeightInPointsin interfaceSheet- Returns:
- default row height in points
-
setDefaultRowHeight
public 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)- Specified by:
setDefaultRowHeightin interfaceSheet- Parameters:
height- default row height measured in twips (1/20 of a point)
-
setDefaultRowHeightInPoints
public void setDefaultRowHeightInPoints(float height)
Set the default row height for the sheet (if the rows do not define their own height) in points- Specified by:
setDefaultRowHeightInPointsin interfaceSheet- Parameters:
height- default row height
-
getColumnStyle
public 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- Specified by:
getColumnStylein interfaceSheet
-
addMergedRegion
public int addMergedRegion(CellRangeAddress region)
Adds a merged region of cells (hence those cells form one)- Specified by:
addMergedRegionin interfaceSheet- Parameters:
region- (rowfrom/colfrom-rowto/colto) to merge- Returns:
- index of this region
-
addMergedRegionUnsafe
public int addMergedRegionUnsafe(CellRangeAddress region)
Adds a merged region of cells (hence those cells form one)- Specified by:
addMergedRegionUnsafein interfaceSheet- Parameters:
region- (rowfrom/colfrom-rowto/colto) to merge- Returns:
- index of this region
-
validateMergedRegions
public void validateMergedRegions()
Verify that merged regions do not intersect multi-cell array formulas and no merged regions intersect another merged region in this sheet.- Specified by:
validateMergedRegionsin interfaceSheet- Throws:
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 sheet
-
setVerticallyCenter
public void setVerticallyCenter(boolean value)
Determines whether the output is vertically centered on the page.- Specified by:
setVerticallyCenterin interfaceSheet- Parameters:
value- true to vertically center, false otherwise.
-
setHorizontallyCenter
public void setHorizontallyCenter(boolean value)
Determines whether the output is horizontally centered on the page.- Specified by:
setHorizontallyCenterin interfaceSheet- Parameters:
value- true to horizontally center, false otherwise.
-
getHorizontallyCenter
public boolean getHorizontallyCenter()
Determine whether printed output for this sheet will be horizontally centered.- Specified by:
getHorizontallyCenterin interfaceSheet
-
getVerticallyCenter
public boolean getVerticallyCenter()
Determine whether printed output for this sheet will be vertically centered.- Specified by:
getVerticallyCenterin interfaceSheet
-
removeMergedRegion
public void removeMergedRegion(int index)
Removes a merged region of cells (hence letting them free)- Specified by:
removeMergedRegionin interfaceSheet- Parameters:
index- of the region to unmerge
-
removeMergedRegions
public void removeMergedRegions(java.util.Collection<java.lang.Integer> indices)
Removes a merged region of cells (hence letting them free)- Specified by:
removeMergedRegionsin interfaceSheet- Parameters:
indices- of the regions to unmerge
-
getNumMergedRegions
public int getNumMergedRegions()
Returns the number of merged regions- Specified by:
getNumMergedRegionsin interfaceSheet- Returns:
- number of merged regions
-
getMergedRegion
public CellRangeAddress getMergedRegion(int index)
Returns the merged region at the specified index. If you want multiple regions, it is faster to callgetMergedRegions()than to call this each time.- Specified by:
getMergedRegionin interfaceSheet- Returns:
- the merged region at the specified index
-
getMergedRegions
public java.util.List<CellRangeAddress> getMergedRegions()
Returns the list of merged regions. If you want multiple regions, this is faster than callinggetMergedRegion(int)each time.- Specified by:
getMergedRegionsin interfaceSheet- Returns:
- the list of merged regions
-
rowIterator
public java.util.Iterator<Row> rowIterator()
Returns an iterator of the physical rows- Specified by:
rowIteratorin interfaceSheet- Returns:
- an iterator of the PHYSICAL rows. Meaning the 3rd element may not be the third row if say for instance the second row is undefined.
-
setAutobreaks
public void setAutobreaks(boolean value)
Flag indicating whether the sheet displays Automatic Page Breaks.- Specified by:
setAutobreaksin interfaceSheet- Parameters:
value-trueif the sheet displays Automatic Page Breaks.
-
setDisplayGuts
public void setDisplayGuts(boolean value)
Set whether to display the guts or not- Specified by:
setDisplayGutsin interfaceSheet- Parameters:
value- - guts or no guts
-
setDisplayZeros
public void setDisplayZeros(boolean value)
Set whether the window should show 0 (zero) in cells containing zero value. When false, cells with zero value appear blank instead of showing the number zero.- Specified by:
setDisplayZerosin interfaceSheet- Parameters:
value- whether to display or hide all zero values on the worksheet
-
isDisplayZeros
public boolean isDisplayZeros()
Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value. When false, cells with zero value appear blank instead of showing the number zero.- Specified by:
isDisplayZerosin interfaceSheet- Returns:
- whether all zero values on the worksheet are displayed
-
setRightToLeft
public void setRightToLeft(boolean value)
Sets whether the worksheet is displayed from right to left instead of from left to right.- Specified by:
setRightToLeftin interfaceSheet- Parameters:
value- true for right to left, false otherwise.
-
isRightToLeft
public boolean isRightToLeft()
Whether the text is displayed in right-to-left mode in the window- Specified by:
isRightToLeftin interfaceSheet- Returns:
- whether the text is displayed in right-to-left mode in the window
-
setFitToPage
public void setFitToPage(boolean value)
Flag indicating whether the Fit to Page print option is enabled.- Specified by:
setFitToPagein interfaceSheet- Parameters:
value-trueif the Fit to Page print option is enabled.
-
setRowSumsBelow
public void setRowSumsBelow(boolean value)
Flag indicating whether summary rows appear below detail in an outline, when applying an outline.When true a summary row is inserted below the detailed data being summarized and a new outline level is established on that row.
When false a summary row is inserted above the detailed data being summarized and a new outline level is established on that row.
- Specified by:
setRowSumsBelowin interfaceSheet- Parameters:
value-trueif row summaries appear below detail in the outline
-
setRowSumsRight
public void setRowSumsRight(boolean value)
Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.When true a summary column is inserted to the right of the detailed data being summarized and a new outline level is established on that column.
When false a summary column is inserted to the left of the detailed data being summarized and a new outline level is established on that column.
- Specified by:
setRowSumsRightin interfaceSheet- Parameters:
value-trueif col summaries appear right of the detail in the outline
-
getAutobreaks
public boolean getAutobreaks()
Flag indicating whether the sheet displays Automatic Page Breaks.- Specified by:
getAutobreaksin interfaceSheet- Returns:
trueif the sheet displays Automatic Page Breaks.
-
getDisplayGuts
public boolean getDisplayGuts()
Get whether to display the guts or not, default value is true- Specified by:
getDisplayGutsin interfaceSheet- Returns:
- boolean - guts or no guts
-
getFitToPage
public boolean getFitToPage()
Flag indicating whether the Fit to Page print option is enabled.- Specified by:
getFitToPagein interfaceSheet- Returns:
trueif the Fit to Page print option is enabled.
-
getRowSumsBelow
public boolean getRowSumsBelow()
Flag indicating whether summary rows appear below detail in an outline, when applying an outline.When true a summary row is inserted below the detailed data being summarized and a new outline level is established on that row.
When false a summary row is inserted above the detailed data being summarized and a new outline level is established on that row.
- Specified by:
getRowSumsBelowin interfaceSheet- Returns:
trueif row summaries appear below detail in the outline
-
getRowSumsRight
public boolean getRowSumsRight()
Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.When true a summary column is inserted to the right of the detailed data being summarized and a new outline level is established on that column.
When false a summary column is inserted to the left of the detailed data being summarized and a new outline level is established on that column.
- Specified by:
getRowSumsRightin interfaceSheet- Returns:
trueif col summaries appear right of the detail in the outline
-
isPrintGridlines
public boolean isPrintGridlines()
Returns whether gridlines are printed.- Specified by:
isPrintGridlinesin interfaceSheet- Returns:
- whether gridlines are printed
- See Also:
to check if gridlines are displayed on screen
-
setPrintGridlines
public void setPrintGridlines(boolean show)
Turns on or off the printing of gridlines.- Specified by:
setPrintGridlinesin interfaceSheet- Parameters:
show- boolean to turn on or off the printing of gridlines- See Also:
to display gridlines on screen
-
isPrintRowAndColumnHeadings
public boolean isPrintRowAndColumnHeadings()
Returns whether row and column headings are printed.- Specified by:
isPrintRowAndColumnHeadingsin interfaceSheet- Returns:
- whether row and column headings are printed
-
setPrintRowAndColumnHeadings
public void setPrintRowAndColumnHeadings(boolean show)
Turns on or off the printing of row and column headings.- Specified by:
setPrintRowAndColumnHeadingsin interfaceSheet- Parameters:
show- boolean to turn on or off the printing of row and column headings
-
getPrintSetup
public PrintSetup getPrintSetup()
Gets the print setup object.- Specified by:
getPrintSetupin interfaceSheet- Returns:
- The user model for the print setup object.
-
getHeader
public Header getHeader()
Gets the user model for the default document header.Note that XSSF offers more kinds of document headers than HSSF does
-
getFooter
public Footer getFooter()
Gets the user model for the default document footer.Note that XSSF offers more kinds of document footers than HSSF does.
-
setSelected
public void setSelected(boolean value)
Sets a flag indicating whether this sheet is selected.Note: multiple sheets can be selected, but only one sheet can be active at one time.
- Specified by:
setSelectedin interfaceSheet- Parameters:
value-trueif this sheet is selected- See Also:
Workbook.setActiveSheet(int)
-
getMargin
public double getMargin(short margin)
Gets the size of the margin in inches.
-
setMargin
public void setMargin(short margin, double size)Sets the size of the margin in inches.
-
getProtect
public boolean getProtect()
Answer whether protection is enabled or disabled- Specified by:
getProtectin interfaceSheet- Returns:
- true means protection enabled; false means protection disabled
-
protectSheet
public void protectSheet(java.lang.String password)
Sets the protection enabled as well as the password- Specified by:
protectSheetin interfaceSheet- Parameters:
password- to set for protection. Passnullto remove protection
-
getScenarioProtect
public boolean getScenarioProtect()
Answer whether scenario protection is enabled or disabled- Specified by:
getScenarioProtectin interfaceSheet- Returns:
- true means protection enabled; false means protection disabled
-
setZoom
public void setZoom(int scale)
Window zoom magnification for current view representing percent values. Valid values range from 10 to 400. Horizontal and Vertical scale together. For example:10 - 10% 20 - 20% ... 100 - 100% ... 400 - 400%
Current view can be Normal, Page Layout, or Page Break Preview.
-
getTopRow
public short getTopRow()
The top row in the visible view when the sheet is first viewed after opening it in a viewer
-
getLeftCol
public short getLeftCol()
The left col in the visible view when the sheet is first viewed after opening it in a viewer- Specified by:
getLeftColin interfaceSheet- Returns:
- short indicating the rownum (0 based) of the top row
-
showInPane
public void showInPane(int toprow, int leftcol)Sets desktop window pane display area, when the file is first opened in a viewer.- Specified by:
showInPanein interfaceSheet- Parameters:
toprow- the top row to show in desktop window paneleftcol- the left column to show in desktop window pane
-
setForceFormulaRecalculation
public void setForceFormulaRecalculation(boolean value)
Control if Excel should be asked to recalculate all formulas when the workbook is opened, via the "sheetCalcPr fullCalcOnLoad" option. Calculating the formula values withFormulaEvaluatoris the recommended solution, but this may be used for certain cases where evaluation in POI is not possible.- Specified by:
setForceFormulaRecalculationin interfaceSheet- Parameters:
value- true if the application will perform a full recalculation of this worksheet values when the workbook is opened- See Also:
Workbook.setForceFormulaRecalculation(boolean)
-
getForceFormulaRecalculation
public boolean getForceFormulaRecalculation()
Whether Excel will be asked to recalculate all formulas when the workbook is opened.- Specified by:
getForceFormulaRecalculationin interfaceSheet
-
shiftRows
@NotImplemented public void shiftRows(int startRow, int endRow, int n)
Not implemented for SXSSFSheets Shifts rows between startRow and endRow n number of rows. If you use a negative number, it will shift rows up. Code ensures that rows don't wrap around. Calls shiftRows(startRow, endRow, n, false, false);Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).
-
shiftRows
@NotImplemented public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
Not implemented for SXSSFSheets Shifts rows between startRow and endRow n number of rows. If you use a negative number, it will shift rows up. Code ensures that rows don't wrap aroundAdditionally 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.
- Specified by:
shiftRowsin interfaceSheet- Parameters:
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 default
-
createFreezePane
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)Creates a split (freezepane). Any existing freezepane or split pane is overwritten.- Specified by:
createFreezePanein interfaceSheet- Parameters:
colSplit- Horizonatal position of split.rowSplit- Vertical position of split.leftmostColumn- Left column visible in right pane.topRow- Top row visible in bottom pane
-
createFreezePane
public void createFreezePane(int colSplit, int rowSplit)Creates a split (freezepane). Any existing freezepane or split pane is overwritten.- Specified by:
createFreezePanein interfaceSheet- Parameters:
colSplit- Horizonatal position of split.rowSplit- Vertical position of split.
-
createSplitPane
public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)Creates a split pane. Any existing freezepane or split pane is overwritten.- Specified by:
createSplitPanein interfaceSheet- Parameters:
xSplitPos- Horizonatal position of split (in 1/20th of a point).ySplitPos- Vertical position of split (in 1/20th of a point).topRow- Top row visible in bottom paneleftmostColumn- Left column visible in right pane.activePane- Active pane. One of: PANE_LOWER_RIGHT, PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT- See Also:
Sheet.PANE_LOWER_LEFT,Sheet.PANE_LOWER_RIGHT,Sheet.PANE_UPPER_LEFT,Sheet.PANE_UPPER_RIGHT
-
getPaneInformation
public PaneInformation getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze)- Specified by:
getPaneInformationin interfaceSheet- Returns:
- null if no pane configured, or the pane information.
-
setDisplayGridlines
public void setDisplayGridlines(boolean show)
Sets whether the gridlines are shown in a viewer- Specified by:
setDisplayGridlinesin interfaceSheet- Parameters:
show- whether to show gridlines or not
-
isDisplayGridlines
public boolean isDisplayGridlines()
Returns if gridlines are displayed- Specified by:
isDisplayGridlinesin interfaceSheet- Returns:
- whether gridlines are displayed
-
setDisplayFormulas
public void setDisplayFormulas(boolean show)
Sets whether the formulas are shown in a viewer- Specified by:
setDisplayFormulasin interfaceSheet- Parameters:
show- whether to show formulas or not
-
isDisplayFormulas
public boolean isDisplayFormulas()
Returns if formulas are displayed- Specified by:
isDisplayFormulasin interfaceSheet- Returns:
- whether formulas are displayed
-
setDisplayRowColHeadings
public void setDisplayRowColHeadings(boolean show)
Sets whether the RowColHeadings are shown in a viewer- Specified by:
setDisplayRowColHeadingsin interfaceSheet- Parameters:
show- whether to show RowColHeadings or not
-
isDisplayRowColHeadings
public boolean isDisplayRowColHeadings()
Returns if RowColHeadings are displayed.- Specified by:
isDisplayRowColHeadingsin interfaceSheet- Returns:
- whether RowColHeadings are displayed
-
setRowBreak
public void setRowBreak(int row)
Sets a page break at the indicated row- Specified by:
setRowBreakin interfaceSheet- Parameters:
row- FIXME: Document this!
-
isRowBroken
public boolean isRowBroken(int row)
Determines if there is a page break at the indicated row- Specified by:
isRowBrokenin interfaceSheet- Parameters:
row- The row to check- Returns:
- true if there is a page-break at the given row, false otherwise
-
removeRowBreak
public void removeRowBreak(int row)
Removes the page break at the indicated row- Specified by:
removeRowBreakin interfaceSheet- Parameters:
row- The row to remove page breaks from
-
getRowBreaks
public int[] getRowBreaks()
Retrieves all the horizontal page breaks- Specified by:
getRowBreaksin interfaceSheet- Returns:
- all the horizontal page breaks, or null if there are no row page breaks
-
getColumnBreaks
public int[] getColumnBreaks()
Retrieves all the vertical page breaks- Specified by:
getColumnBreaksin interfaceSheet- Returns:
- all the vertical page breaks, or null if there are no column page breaks
-
setColumnBreak
public void setColumnBreak(int column)
Sets a page break at the indicated column- Specified by:
setColumnBreakin interfaceSheet- Parameters:
column- The column to work on
-
isColumnBroken
public boolean isColumnBroken(int column)
Determines if there is a page break at the indicated column- Specified by:
isColumnBrokenin interfaceSheet- Parameters:
column- The column to check for page breaks- Returns:
- true if there is a page break at the given column, false otherwise
-
removeColumnBreak
public void removeColumnBreak(int column)
Removes a page break at the indicated column- Specified by:
removeColumnBreakin interfaceSheet- Parameters:
column- The column to remove a page break from
-
setColumnGroupCollapsed
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed)Expands or collapses a column group.- Specified by:
setColumnGroupCollapsedin interfaceSheet- Parameters:
columnNumber- One of the columns in the group.collapsed- true = collapse group, false = expand group.
-
groupColumn
public void groupColumn(int fromColumn, int toColumn)Create an outline for the provided column range.- Specified by:
groupColumnin interfaceSheet- Parameters:
fromColumn- beginning of the column range.toColumn- end of the column range.
-
ungroupColumn
public void ungroupColumn(int fromColumn, int toColumn)Ungroup a range of columns that were previously groupped- Specified by:
ungroupColumnin interfaceSheet- Parameters:
fromColumn- start column (0-based)toColumn- end column (0-based)
-
groupRow
public void groupRow(int fromRow, int toRow)Tie a range of rows together so that they can be collapsed or expandedPlease note the rows being grouped must be in the current window, if the rows are already flushed then groupRow has no effect.
Correct code:
Incorrect code:Workbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory Sheet sh = wb.createSheet(); for (int rownum = 0; rownum < 1000; rownum++) { Row row = sh.createRow(rownum); if(rownum == 200) { sh.groupRow(100, 200); } }Workbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory Sheet sh = wb.createSheet(); for (int rownum = 0; rownum < 1000; rownum++) { Row row = sh.createRow(rownum); } sh.groupRow(100, 200); // the rows in the range [100, 200] are already flushed and groupRows has no effect
-
setRowOutlineLevel
public void setRowOutlineLevel(int rownum, int level)Set row groupings (like groupRow) in a stream-friendly mannergroupRows requires all rows in the group to be in the current window. This is not always practical. Instead use setRowOutlineLevel to explicitly set the group level. Level 1 is the top level group, followed by 2, etc. It is up to the user to ensure that level 2 groups are correctly nested under level 1, etc.
- Parameters:
rownum- index of row to update (0-based)level- outline level (greater than 0)
-
ungroupRow
public void ungroupRow(int fromRow, int toRow)Ungroup a range of rows that were previously groupped- Specified by:
ungroupRowin interfaceSheet- Parameters:
fromRow- start row (0-based)toRow- end row (0-based)
-
setRowGroupCollapsed
public void setRowGroupCollapsed(int row, boolean collapse)Set view state of a grouped range of rows. Not implemented for expanding (i.e. collapse == false)- Specified by:
setRowGroupCollapsedin interfaceSheet- Parameters:
row- start row of a groupped range of rows (0-based)collapse- whether to expand/collapse the detail rows- Throws:
java.lang.RuntimeException- if collapse is false as this is not implemented for SXSSF.
-
setDefaultColumnStyle
public void setDefaultColumnStyle(int column, CellStyle style)Sets the default column style for a given column. POI will only apply this style to new cells added to the sheet.- Specified by:
setDefaultColumnStylein interfaceSheet- Parameters:
column- the column indexstyle- the style to set
-
trackColumnForAutoSizing
public void trackColumnForAutoSizing(int column)
Track a column in the sheet for auto-sizing. Note this has undefined behavior if a column is tracked after one or more rows are written to the sheet. Ifcolumnis already tracked, this call does nothing.- Parameters:
column- the column to track for auto-sizing- Since:
- 3.14beta1
- See Also:
trackColumnsForAutoSizing(Collection),trackAllColumnsForAutoSizing()
-
trackColumnsForAutoSizing
public void trackColumnsForAutoSizing(java.util.Collection<java.lang.Integer> columns)
Track several columns in the sheet for auto-sizing. Note this has undefined behavior if columns are tracked after one or more rows are written to the sheet. Any column incolumnsthat are already tracked are ignored by this call.- Parameters:
columns- the columns to track for auto-sizing- Since:
- 3.14beta1
-
trackAllColumnsForAutoSizing
public void trackAllColumnsForAutoSizing()
Tracks all columns in the sheet for auto-sizing. If this is called, individual columns do not need to be tracked. Because determining the best-fit width for a cell is expensive, this may affect the performance.- Since:
- 3.14beta1
-
untrackColumnForAutoSizing
public boolean untrackColumnForAutoSizing(int column)
Removes a column that was previously marked for inclusion in auto-size column tracking. When a column is untracked, the best-fit width is forgotten. Ifcolumnis not tracked, it will be ignored by this call.- Parameters:
column- the index of the column to track for auto-sizing- Returns:
- true if column was tracked prior to this call, false if no action was taken
- Since:
- 3.14beta1
- See Also:
untrackColumnsForAutoSizing(Collection),untrackAllColumnsForAutoSizing()
-
untrackColumnsForAutoSizing
public boolean untrackColumnsForAutoSizing(java.util.Collection<java.lang.Integer> columns)
Untracks several columns in the sheet for auto-sizing. When a column is untracked, the best-fit width is forgotten. Any column incolumnsthat is not tracked will be ignored by this call.- Parameters:
columns- the indices of the columns to track for auto-sizing- Returns:
- true if one or more columns were untracked as a result of this call
- Since:
- 3.14beta1
-
untrackAllColumnsForAutoSizing
public void untrackAllColumnsForAutoSizing()
Untracks all columns in the sheet for auto-sizing. Best-fit column widths are forgotten. If this is called, individual columns do not need to be untracked.- Since:
- 3.14beta1
-
isColumnTrackedForAutoSizing
public boolean isColumnTrackedForAutoSizing(int column)
Returns true if column is currently tracked for auto-sizing.- Parameters:
column- the index of the column to check- Returns:
- true if column is tracked
- Since:
- 3.14beta1
-
getTrackedColumnsForAutoSizing
public java.util.Set<java.lang.Integer> getTrackedColumnsForAutoSizing()
Get the currently tracked columns for auto-sizing. Note if all columns are tracked, this will only return the columns that have been explicitly or implicitly tracked, which is probably only columns containing 1 or more non-blank values- Returns:
- a set of the indices of all tracked columns
- Since:
- 3.14beta1
-
autoSizeColumn
public void autoSizeColumn(int column)
Adjusts the column width to fit the contents.This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.
You can specify whether the content of merged cells should be considered or ignored. Default is to ignore merged cells.Special note about SXSSF implementation: You must register the columns you wish to track with the SXSSFSheet using
trackColumnForAutoSizing(int)ortrackAllColumnsForAutoSizing(). This is needed because the rows needed to compute the column width may have fallen outside the random access window and been flushed to disk. Tracking columns is required even if all rows are in the random access window.New in POI 3.14 beta 1: auto-sizes columns using cells from current and flushed rows.
- Specified by:
autoSizeColumnin interfaceSheet- Parameters:
column- the column index to auto-size
-
autoSizeColumn
public void autoSizeColumn(int column, boolean useMergedCells)Adjusts the column width to fit the contents.This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.
You can specify whether the content of merged cells should be considered or ignored. Default is to ignore merged cells.Special note about SXSSF implementation: You must register the columns you wish to track with the SXSSFSheet using
trackColumnForAutoSizing(int)ortrackAllColumnsForAutoSizing(). This is needed because the rows needed to compute the column width may have fallen outside the random access window and been flushed to disk. Tracking columns is required even if all rows are in the random access window.New in POI 3.14 beta 1: auto-sizes columns using cells from current and flushed rows.
- Specified by:
autoSizeColumnin interfaceSheet- Parameters:
column- the column index to auto-sizeuseMergedCells- whether to use the contents of merged cells when calculating the width of the column
-
getCellComment
public XSSFComment getCellComment(CellAddress ref)
Returns cell comment for the specified row and column- Specified by:
getCellCommentin interfaceSheet- Returns:
- cell comment or
nullif not found
-
getCellComments
public java.util.Map<CellAddress,XSSFComment> getCellComments()
Returns all cell comments on this sheet.- Specified by:
getCellCommentsin interfaceSheet- Returns:
- A map of each Comment in the sheet, keyed on the cell address where the comment is located.
-
getHyperlink
public XSSFHyperlink getHyperlink(int row, int column)
Get a Hyperlink in this sheet anchored at row, column- Specified by:
getHyperlinkin interfaceSheet- Parameters:
row- The 0-base row numbercolumn- The 0-based column number- Returns:
- hyperlink if there is a hyperlink anchored at row, column; otherwise returns null
-
getHyperlink
public XSSFHyperlink getHyperlink(CellAddress addr)
Get a Hyperlink in this sheet located in a cell specified by {code addr}- Specified by:
getHyperlinkin interfaceSheet- Parameters:
addr- The address of the cell containing the hyperlink- Returns:
- hyperlink if there is a hyperlink anchored at
addr; otherwise returnsnull - Since:
- POI 3.15 beta 3
-
getHyperlinkList
public java.util.List<XSSFHyperlink> getHyperlinkList()
Get a list of Hyperlinks in this sheet- Specified by:
getHyperlinkListin interfaceSheet- Returns:
- Hyperlinks for the sheet
-
getDrawingPatriarch
public XSSFDrawing getDrawingPatriarch()
Return the sheet's existing drawing, or null if there isn't yet one. UseSheet.createDrawingPatriarch()to get or create- Specified by:
getDrawingPatriarchin interfaceSheet- Returns:
- a SpreadsheetML drawing
-
createDrawingPatriarch
public SXSSFDrawing createDrawingPatriarch()
Creates the top-level drawing patriarch.- Specified by:
createDrawingPatriarchin interfaceSheet- Returns:
- The new drawing patriarch.
-
getWorkbook
public SXSSFWorkbook getWorkbook()
Return the parent workbook- Specified by:
getWorkbookin interfaceSheet- Returns:
- the parent workbook
-
getSheetName
public java.lang.String getSheetName()
Returns the name of this sheet- Specified by:
getSheetNamein interfaceSheet- Returns:
- the name of this sheet
-
isSelected
public boolean isSelected()
Note - this is not the same as whether the sheet is focused (isActive)- Specified by:
isSelectedin interfaceSheet- Returns:
trueif this sheet is currently selected
-
setArrayFormula
public CellRange<? extends Cell> setArrayFormula(java.lang.String formula, CellRangeAddress range)
Sets array formula to specified region for result.- Specified by:
setArrayFormulain interfaceSheet- Parameters:
formula- text representation of the formularange- Region of array formula for result.- Returns:
- the
CellRangeof cells affected by this change
-
removeArrayFormula
public CellRange<? extends Cell> removeArrayFormula(Cell cell)
Remove a Array Formula from this sheet. All cells contained in the Array Formula range are removed as well- Specified by:
removeArrayFormulain interfaceSheet- Parameters:
cell- any cell within Array Formula range- Returns:
- the
CellRangeof cells affected by this change
-
getDataValidationHelper
public DataValidationHelper getDataValidationHelper()
- Specified by:
getDataValidationHelperin interfaceSheet
-
getDataValidations
public java.util.List<XSSFDataValidation> getDataValidations()
Description copied from interface:SheetReturns the list of DataValidation in the sheet.- Specified by:
getDataValidationsin interfaceSheet- Returns:
- list of DataValidation in the sheet
-
addValidationData
public void addValidationData(DataValidation dataValidation)
Creates a data validation object- Specified by:
addValidationDatain interfaceSheet- Parameters:
dataValidation- The Data validation object settings
-
setAutoFilter
public AutoFilter setAutoFilter(CellRangeAddress range)
Enable filtering for a range of cells- Specified by:
setAutoFilterin interfaceSheet- Parameters:
range- the range of cells to filter
-
getSheetConditionalFormatting
public SheetConditionalFormatting getSheetConditionalFormatting()
Description copied from interface:SheetThe 'Conditional Formatting' facet for this Sheet- Specified by:
getSheetConditionalFormattingin interfaceSheet- Returns:
- conditional formatting rule for this sheet
-
getRepeatingRows
public CellRangeAddress getRepeatingRows()
Description copied from interface:SheetGets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.Repeating rows cover a range of contiguous rows, e.g.:
Sheet1!$1:$1 Sheet2!$5:$8
TheCellRangeAddressreturned 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.
- Specified by:
getRepeatingRowsin interfaceSheet- Returns:
- an
CellRangeAddresscontaining the repeating rows for the Sheet, or null.
-
getRepeatingColumns
public CellRangeAddress getRepeatingColumns()
Description copied from interface:SheetGets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.Repeating columns cover a range of contiguous columns, e.g.:
Sheet1!$A:$A Sheet2!$C:$F
TheCellRangeAddressreturned 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.
- Specified by:
getRepeatingColumnsin interfaceSheet- Returns:
- an
CellRangeAddresscontaining the repeating columns for the Sheet, or null.
-
setRepeatingRows
public void setRepeatingRows(CellRangeAddress rowRangeRef)
Description copied from interface:SheetSets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.Repeating rows cover a range of contiguous rows, e.g.:
Sheet1!$1:$1 Sheet2!$5:$8
The parameterCellRangeAddressshould 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);
- Specified by:
setRepeatingRowsin interfaceSheet- Parameters:
rowRangeRef- aCellRangeAddresscontaining the repeating rows for the Sheet, or null.
-
setRepeatingColumns
public void setRepeatingColumns(CellRangeAddress columnRangeRef)
Description copied from interface:SheetSets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.Repeating columns cover a range of contiguous columns, e.g.:
Sheet1!$A:$A Sheet2!$C:$F
The parameterCellRangeAddressshould 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);
- Specified by:
setRepeatingColumnsin interfaceSheet- Parameters:
columnRangeRef- aCellRangeAddresscontaining the repeating columns for the Sheet, or null.
-
setRandomAccessWindowSize
public void setRandomAccessWindowSize(int value)
Specifies how many rows can be accessed at most via getRow(). When a new node is created via createRow() and the total number of unflushed records would exeed the specified value, then the row with the lowest index value is flushed and cannot be accessed via getRow() anymore. A value of -1 indicates unlimited access. In this case all records that have not been flushed by a call to flush() are available for random access. A value of 0 is not allowed because it would flush any newly created row without having a chance to specify any cells.
-
areAllRowsFlushed
public boolean areAllRowsFlushed()
Are all rows flushed to disk?
-
getLastFlushedRowNum
public int getLastFlushedRowNum()
- Returns:
- Last row number to be flushed to disk, or -1 if none flushed yet
-
flushRows
public void flushRows(int remaining) throws java.io.IOExceptionSpecifies how many rows can be accessed at most via getRow(). The exeeding rows (if any) are flushed to the disk while rows with lower index values are flushed first.- Throws:
java.io.IOException
-
flushRows
public void flushRows() throws java.io.IOExceptionFlush all rows to disk. After this call no rows can be accessed via getRow()- Throws:
java.io.IOException- If an I/O error occurs
-
changeRowNum
public void changeRowNum(SXSSFRow row, int newRowNum)
-
getRowNum
public int getRowNum(SXSSFRow row)
-
getColumnOutlineLevel
public int getColumnOutlineLevel(int columnIndex)
Description copied from interface:SheetReturns the column outline level. Increased as you put it into more groups (outlines), reduced as you take it out of them.- Specified by:
getColumnOutlineLevelin interfaceSheet
-
getActiveCell
public CellAddress getActiveCell()
Return location of the active cell, e.g.A1.- Specified by:
getActiveCellin interfaceSheet- Returns:
- the location of the active cell.
-
setActiveCell
public void setActiveCell(CellAddress address)
Sets location of the active cell- Specified by:
setActiveCellin interfaceSheet- Parameters:
address- the location of the active cell, e.g.A1.
-
getTabColor
public XSSFColor getTabColor()
-
setTabColor
public void setTabColor(XSSFColor color)
-
enableLocking
public void enableLocking()
Enable sheet protection
-
disableLocking
public void disableLocking()
Disable sheet protection
-
lockAutoFilter
public void lockAutoFilter(boolean enabled)
Enable or disable Autofilters locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockDeleteColumns
public void lockDeleteColumns(boolean enabled)
Enable or disable Deleting columns locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockDeleteRows
public void lockDeleteRows(boolean enabled)
Enable or disable Deleting rows locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockFormatCells
public void lockFormatCells(boolean enabled)
Enable or disable Formatting cells locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockFormatColumns
public void lockFormatColumns(boolean enabled)
Enable or disable Formatting columns locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockFormatRows
public void lockFormatRows(boolean enabled)
Enable or disable Formatting rows locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockInsertColumns
public void lockInsertColumns(boolean enabled)
Enable or disable Inserting columns locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockInsertHyperlinks
public void lockInsertHyperlinks(boolean enabled)
Enable or disable Inserting hyperlinks locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockInsertRows
public void lockInsertRows(boolean enabled)
Enable or disable Inserting rows locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockPivotTables
public void lockPivotTables(boolean enabled)
Enable or disable Pivot Tables locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockSort
public void lockSort(boolean enabled)
Enable or disable Sort locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockObjects
public void lockObjects(boolean enabled)
Enable or disable Objects locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockScenarios
public void lockScenarios(boolean enabled)
Enable or disable Scenarios locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockSelectLockedCells
public void lockSelectLockedCells(boolean enabled)
Enable or disable Selection of locked cells locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
lockSelectUnlockedCells
public void lockSelectUnlockedCells(boolean enabled)
Enable or disable Selection of unlocked cells locking. This does not modify sheet protection status. To enforce this un-/locking, calldisableLocking()orenableLocking()
-
setTabColor
public void setTabColor(int colorIndex)
Set background color of the sheet tab- Parameters:
colorIndex- the indexed color to set, must be a constant fromIndexedColors
-
shiftColumns
@NotImplemented public void shiftColumns(int startColumn, int endColumn, int n)
Description copied from interface:SheetShifts columns between startColumn and endColumn, n number of columns. If you use a negative number, it will shift columns left. Code ensures that columns don't wrap around- Specified by:
shiftColumnsin interfaceSheet- Parameters:
startColumn- the column to start shiftingendColumn- the column to end shiftingn- the number of columns to shift
-
-