Documentation of 'org.apache.poi.xssf.streaming.SXSSFSheet' Java class
SXSSFSheet
org.apache.poi.xssf.streaming

Class SXSSFSheet

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<Row>, Sheet


    public class SXSSFSheet
    extends java.lang.Object
    implements Sheet, java.lang.Cloneable
    Streaming version of XSSFSheet implementing the "BigGridDemo" strategy.
    • Method Summary

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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • 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:
        iterator in interface java.lang.Iterable<Row>
      • createRow

        public Row createRow(int rownum)
        Create a new row within the sheet and return the high level representation
        Specified by:
        createRow in interface Sheet
        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
        Specified by:
        removeRow in interface Sheet
        Parameters:
        row - representing a row to remove.
      • getRow

        public Row getRow(int rownum)
        Returns the logical row (not physical) 0-based. If you ask for a row that is not defined you get a null. This is to say row 4 represents the fifth row on a sheet.
        Specified by:
        getRow in interface Sheet
        Parameters:
        rownum - row to get (0-based)
        Returns:
        Row representing the rownumber or null if its not defined on the sheet
      • getPhysicalNumberOfRows

        public int getPhysicalNumberOfRows()
        Returns the number of physically defined rows (NOT the number of rows in the sheet)
        Specified by:
        getPhysicalNumberOfRows in interface Sheet
        Returns:
        the number of physically defined rows in this sheet
      • getFirstRowNum

        public int getFirstRowNum()
        Gets the first row on the sheet
        Specified by:
        getFirstRowNum in interface Sheet
        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:
        getLastRowNum in interface Sheet
        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:
        setColumnHidden in interface Sheet
        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:
        isColumnHidden in interface Sheet
        Parameters:
        columnIndex - - the column to set (0-based)
        Returns:
        hidden - false if 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:
        setColumnWidth in interface Sheet
        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:
        getColumnWidth in interface Sheet
        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 pixels

        Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx).

        Specified by:
        getColumnWidthInPixels in interface Sheet
        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:
        setDefaultColumnWidth in interface Sheet
        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:
        getDefaultColumnWidth in interface Sheet
        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:
        getDefaultRowHeight in interface Sheet
        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:
        getDefaultRowHeightInPoints in interface Sheet
        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:
        setDefaultRowHeight in interface Sheet
        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:
        setDefaultRowHeightInPoints in interface Sheet
        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:
        getColumnStyle in interface Sheet
      • addMergedRegion

        public int addMergedRegion(CellRangeAddress region)
        Adds a merged region of cells (hence those cells form one)
        Specified by:
        addMergedRegion in interface Sheet
        Parameters:
        region - (rowfrom/colfrom-rowto/colto) to merge
        Returns:
        index of this region
      • setVerticallyCenter

        public void setVerticallyCenter(boolean value)
        Determines whether the output is vertically centered on the page.
        Specified by:
        setVerticallyCenter in interface Sheet
        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:
        setHorizontallyCenter in interface Sheet
        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:
        getHorizontallyCenter in interface Sheet
      • getVerticallyCenter

        public boolean getVerticallyCenter()
        Determine whether printed output for this sheet will be vertically centered.
        Specified by:
        getVerticallyCenter in interface Sheet
      • removeMergedRegion

        public void removeMergedRegion(int index)
        Removes a merged region of cells (hence letting them free)
        Specified by:
        removeMergedRegion in interface Sheet
        Parameters:
        index - of the region to unmerge
      • getNumMergedRegions

        public int getNumMergedRegions()
        Returns the number of merged regions
        Specified by:
        getNumMergedRegions in interface Sheet
        Returns:
        number of merged regions
      • getMergedRegion

        public CellRangeAddress getMergedRegion(int index)
        Returns the merged region at the specified index
        Specified by:
        getMergedRegion in interface Sheet
        Returns:
        the merged region at the specified index
      • rowIterator

        public java.util.Iterator<Row> rowIterator()
        Returns an iterator of the physical rows
        Specified by:
        rowIterator in interface Sheet
        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:
        setAutobreaks in interface Sheet
        Parameters:
        value - true if the sheet displays Automatic Page Breaks.
      • setDisplayGuts

        public void setDisplayGuts(boolean value)
        Set whether to display the guts or not
        Specified by:
        setDisplayGuts in interface Sheet
        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:
        setDisplayZeros in interface Sheet
        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:
        isDisplayZeros in interface Sheet
        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:
        setRightToLeft in interface Sheet
        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:
        isRightToLeft in interface Sheet
        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:
        setFitToPage in interface Sheet
        Parameters:
        value - true if 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:
        setRowSumsBelow in interface Sheet
        Parameters:
        value - true if 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:
        setRowSumsRight in interface Sheet
        Parameters:
        value - true if 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:
        getAutobreaks in interface Sheet
        Returns:
        true if the sheet displays Automatic Page Breaks.
      • getDisplayGuts

        public boolean getDisplayGuts()
        Get whether to display the guts or not, default value is true
        Specified by:
        getDisplayGuts in interface Sheet
        Returns:
        boolean - guts or no guts
      • getFitToPage

        public boolean getFitToPage()
        Flag indicating whether the Fit to Page print option is enabled.
        Specified by:
        getFitToPage in interface Sheet
        Returns:
        true if 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:
        getRowSumsBelow in interface Sheet
        Returns:
        true if 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:
        getRowSumsRight in interface Sheet
        Returns:
        true if col summaries appear right of the detail in the outline
      • setPrintGridlines

        public void setPrintGridlines(boolean show)
        Sets the flag indicating whether this sheet should display the lines between rows and columns to make editing and reading easier. To turn printing of gridlines use setPrintGridlines(boolean)
        Specified by:
        setPrintGridlines in interface Sheet
        Parameters:
        show - true if this sheet should display gridlines.
        See Also:
        setPrintGridlines(boolean)
      • getPrintSetup

        public PrintSetup getPrintSetup()
        Gets the print setup object.
        Specified by:
        getPrintSetup in interface Sheet
        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

        Specified by:
        getHeader in interface Sheet
        Returns:
        the document header. Never null
      • 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.

        Specified by:
        getFooter in interface Sheet
        Returns:
        the document footer. Never null
      • 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:
        setSelected in interface Sheet
        Parameters:
        value - true if this sheet is selected
        See Also:
        Workbook.setActiveSheet(int)
      • getMargin

        public double getMargin(short margin)
        Gets the size of the margin in inches.
        Specified by:
        getMargin in interface Sheet
        Parameters:
        margin - which margin to get
        Returns:
        the size of the margin
      • setMargin

        public void setMargin(short margin,
                              double size)
        Sets the size of the margin in inches.
        Specified by:
        setMargin in interface Sheet
        Parameters:
        margin - which margin to get
        size - the size of the margin
      • getProtect

        public boolean getProtect()
        Answer whether protection is enabled or disabled
        Specified by:
        getProtect in interface Sheet
        Returns:
        true => protection enabled; false => protection disabled
      • protectSheet

        public void protectSheet(java.lang.String password)
        Sets the protection enabled as well as the password
        Specified by:
        protectSheet in interface Sheet
        Parameters:
        password - to set for protection. Pass null to remove protection
      • getScenarioProtect

        public boolean getScenarioProtect()
        Answer whether scenario protection is enabled or disabled
        Specified by:
        getScenarioProtect in interface Sheet
        Returns:
        true => protection enabled; false => protection disabled
      • setZoom

        public void setZoom(int numerator,
                            int denominator)
        Sets the zoom magnication for the sheet. The zoom is expressed as a fraction. For example to express a zoom of 75% use 3 for the numerator and 4 for the denominator.
        Specified by:
        setZoom in interface Sheet
        Parameters:
        numerator - The numerator for the zoom magnification.
        denominator - The denominator for the zoom magnification.
      • getTopRow

        public short getTopRow()
        The top row in the visible view when the sheet is first viewed after opening it in a viewer
        Specified by:
        getTopRow in interface Sheet
        Returns:
        short indicating the rownum (0 based) of the top row
      • 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:
        getLeftCol in interface Sheet
        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:
        showInPane in interface Sheet
        Parameters:
        toprow - the top row to show in desktop window pane
        leftcol - the left column to show in desktop window pane
      • showInPane

        public void showInPane(short toprow,
                               short leftcol)
        Deprecated. Use the version of showInPane() with ints as there can be more than 32767 rows.
        Sets desktop window pane display area, when the file is first opened in a viewer.
        Specified by:
        showInPane in interface Sheet
        Parameters:
        toprow - the top row to show in desktop window pane
        leftcol - 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 with FormulaEvaluator is the recommended solution, but this may be used for certain cases where evaluation in POI is not possible.
        Specified by:
        setForceFormulaRecalculation in interface Sheet
        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:
        getForceFormulaRecalculation in interface Sheet
      • shiftRows

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

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

        Specified by:
        shiftRows in interface Sheet
        Parameters:
        startRow - the row to start shifting
        endRow - the row to end shifting
        n - the number of rows to shift
      • shiftRows

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

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

        Specified by:
        shiftRows in interface Sheet
        Parameters:
        startRow - the row to start shifting
        endRow - the row to end shifting
        n - the number of rows to shift
        copyRowHeight - whether to copy the row height during the shift
        resetOriginalRowHeight - whether to set the original row's height to the default
      • createFreezePane

        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:
        createFreezePane in interface Sheet
        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:
        createFreezePane in interface Sheet
        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:
        createSplitPane in interface Sheet
        Parameters:
        xSplitPos - Horizonatal position of split (in 1/20th of a point).
        ySplitPos - Vertical position of split (in 1/20th of a point).
        topRow - Top row visible in bottom pane
        leftmostColumn - Left column visible in right pane.
        activePane - Active pane. One of: PANE_LOWER_RIGHT, PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
        See Also:
        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:
        getPaneInformation in interface Sheet
        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:
        setDisplayGridlines in interface Sheet
        Parameters:
        show - whether to show gridlines or not
      • isDisplayGridlines

        public boolean isDisplayGridlines()
        Returns if gridlines are displayed
        Specified by:
        isDisplayGridlines in interface Sheet
        Returns:
        whether gridlines are displayed
      • setDisplayFormulas

        public void setDisplayFormulas(boolean show)
        Sets whether the formulas are shown in a viewer
        Specified by:
        setDisplayFormulas in interface Sheet
        Parameters:
        show - whether to show formulas or not
      • isDisplayFormulas

        public boolean isDisplayFormulas()
        Returns if formulas are displayed
        Specified by:
        isDisplayFormulas in interface Sheet
        Returns:
        whether formulas are displayed
      • setDisplayRowColHeadings

        public void setDisplayRowColHeadings(boolean show)
        Sets whether the RowColHeadings are shown in a viewer
        Specified by:
        setDisplayRowColHeadings in interface Sheet
        Parameters:
        show - whether to show RowColHeadings or not
      • isDisplayRowColHeadings

        public boolean isDisplayRowColHeadings()
        Returns if RowColHeadings are displayed.
        Specified by:
        isDisplayRowColHeadings in interface Sheet
        Returns:
        whether RowColHeadings are displayed
      • setRowBreak

        public void setRowBreak(int row)
        Sets a page break at the indicated row
        Specified by:
        setRowBreak in interface Sheet
        Parameters:
        row - FIXME: Document this!
      • isRowBroken

        public boolean isRowBroken(int row)
        Determines if there is a page break at the indicated row
        Specified by:
        isRowBroken in interface Sheet
        Parameters:
        row - FIXME: Document this!
        Returns:
        FIXME: Document this!
      • removeRowBreak

        public void removeRowBreak(int row)
        Removes the page break at the indicated row
        Specified by:
        removeRowBreak in interface Sheet
        Parameters:
        row -
      • getRowBreaks

        public int[] getRowBreaks()
        Retrieves all the horizontal page breaks
        Specified by:
        getRowBreaks in interface Sheet
        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:
        getColumnBreaks in interface Sheet
        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:
        setColumnBreak in interface Sheet
        Parameters:
        column -
      • isColumnBroken

        public boolean isColumnBroken(int column)
        Determines if there is a page break at the indicated column
        Specified by:
        isColumnBroken in interface Sheet
        Parameters:
        column - FIXME: Document this!
        Returns:
        FIXME: Document this!
      • removeColumnBreak

        public void removeColumnBreak(int column)
        Removes a page break at the indicated column
        Specified by:
        removeColumnBreak in interface Sheet
        Parameters:
        column -
      • setColumnGroupCollapsed

        public void setColumnGroupCollapsed(int columnNumber,
                                            boolean collapsed)
        Expands or collapses a column group.
        Specified by:
        setColumnGroupCollapsed in interface Sheet
        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:
        groupColumn in interface Sheet
        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:
        ungroupColumn in interface Sheet
        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 expanded

        Please note the rows being grouped must be in the current window, if the rows are already flushed then groupRow has no effect.

        Correct 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);
                   }
               }
        
              

        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);
               }
               sh.groupRow(100, 200); // the rows in the range [100, 200] are already flushed and groupRows has no effect
        
              

        Specified by:
        groupRow in interface Sheet
        Parameters:
        fromRow - start row (0-based)
        toRow - end row (0-based)
      • setRowOutlineLevel

        public void setRowOutlineLevel(int rownum,
                                       int level)
        Set row groupings (like groupRow) in a stream-friendly manner

        groupRows 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 (> 0)
      • ungroupRow

        public void ungroupRow(int fromRow,
                               int toRow)
        Ungroup a range of rows that were previously groupped
        Specified by:
        ungroupRow in interface Sheet
        Parameters:
        fromRow - start row (0-based)
        toRow - end row (0-based)
      • setRowGroupCollapsed

        public void setRowGroupCollapsed(int row,
                                         boolean collapse)
        Set view state of a groupped range of rows
        Specified by:
        setRowGroupCollapsed in interface Sheet
        Parameters:
        row - start row of a groupped range of rows (0-based)
        collapse - whether to expand/collapse the detail rows
      • 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:
        setDefaultColumnStyle in interface Sheet
        Parameters:
        column - the column index
        style - the style to set
      • 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.
        Specified by:
        autoSizeColumn in interface Sheet
        Parameters:
        column - the column index
      • 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.
        Specified by:
        autoSizeColumn in interface Sheet
        Parameters:
        column - the column index
        useMergedCells - whether to use the contents of merged cells when calculating the width of the column
      • getCellComment

        public Comment getCellComment(int row,
                                      int column)
        Returns cell comment for the specified row and column
        Specified by:
        getCellComment in interface Sheet
        Returns:
        cell comment or null if not found
      • createDrawingPatriarch

        public Drawing createDrawingPatriarch()
        Creates the top-level drawing patriarch.
        Specified by:
        createDrawingPatriarch in interface Sheet
        Returns:
        The new drawing patriarch.
      • getWorkbook

        public Workbook getWorkbook()
        Return the parent workbook
        Specified by:
        getWorkbook in interface Sheet
        Returns:
        the parent workbook
      • getSheetName

        public java.lang.String getSheetName()
        Returns the name of this sheet
        Specified by:
        getSheetName in interface Sheet
        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:
        isSelected in interface Sheet
        Returns:
        true if 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:
        setArrayFormula in interface Sheet
        Parameters:
        formula - text representation of the formula
        range - Region of array formula for result.
        Returns:
        the CellRange of 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:
        removeArrayFormula in interface Sheet
        Parameters:
        cell - any cell within Array Formula range
        Returns:
        the CellRange of cells affected by this change
      • getDataValidations

        public java.util.List<XSSFDataValidation> getDataValidations()
        Description copied from interface: Sheet
        Returns the list of DataValidation in the sheet.
        Specified by:
        getDataValidations in interface Sheet
        Returns:
        list of DataValidation in the sheet
      • addValidationData

        public void addValidationData(DataValidation dataValidation)
        Creates a data validation object
        Specified by:
        addValidationData in interface Sheet
        Parameters:
        dataValidation - The Data validation object settings
      • getRepeatingRows

        public CellRangeAddress getRepeatingRows()
        Description copied from interface: Sheet
        Gets 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 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.

        Specified by:
        getRepeatingRows in interface Sheet
        Returns:
        an CellRangeAddress containing the repeating rows for the Sheet, or null.
      • getRepeatingColumns

        public CellRangeAddress getRepeatingColumns()
        Description copied from interface: Sheet
        Gets 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 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.

        Specified by:
        getRepeatingColumns in interface Sheet
        Returns:
        an CellRangeAddress containing the repeating columns for the Sheet, or null.
      • setRepeatingRows

        public void setRepeatingRows(CellRangeAddress rowRangeRef)
        Description copied from interface: Sheet
        Sets 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 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);
        Specified by:
        setRepeatingRows in interface Sheet
        Parameters:
        rowRangeRef - a CellRangeAddress containing the repeating rows for the Sheet, or null.
      • setRepeatingColumns

        public void setRepeatingColumns(CellRangeAddress columnRangeRef)
        Description copied from interface: Sheet
        Sets 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 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);
        Specified by:
        setRepeatingColumns in interface Sheet
        Parameters:
        columnRangeRef - a CellRangeAddress containing 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.
      • flushRows

        public void flushRows(int remaining)
                       throws java.io.IOException
        Specifies 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.IOException
        Flush all rows to disk. After this call no rows can be accessed via getRow()
        Throws:
        java.io.IOException
      • changeRowNum

        public void changeRowNum(SXSSFRow row,
                                 int newRowNum)
      • getRowNum

        public int getRowNum(SXSSFRow row)
      • getColumnOutlineLevel

        public int getColumnOutlineLevel(int columnIndex)
        Description copied from interface: Sheet
        Returns the column outline level. Increased as you put it into more groups (outlines), reduced as you take it out of them.
        Specified by:
        getColumnOutlineLevel in interface Sheet

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.