Save This Page
Home » poi-src-3.2-FINAL-20081019 » org.apache » poi » hssf » usermodel » [javadoc | source]
org.apache.poi.hssf.usermodel
public final class: HSSFSheet [javadoc | source]
java.lang.Object
   org.apache.poi.hssf.usermodel.HSSFSheet
High level representation of a worksheet.
Field Summary
public static final  short LeftMargin     
public static final  short RightMargin     
public static final  short TopMargin     
public static final  short BottomMargin     
public static final  byte PANE_LOWER_RIGHT     
public static final  byte PANE_UPPER_RIGHT     
public static final  byte PANE_LOWER_LEFT     
public static final  byte PANE_UPPER_LEFT     
public static final  int INITIAL_CAPACITY    Used for compile-time optimization. This is the initial size for the collection of rows. It is currently set to 20. If you generate larger sheets you may benefit by setting this to a higher number and recompiling a custom edition of HSSFSheet. 
protected  Workbook book     
protected  HSSFWorkbook workbook     
Constructor:
 protected HSSFSheet(HSSFWorkbook workbook) 
    Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from scratch. You should not be calling this from application code (its protected anyhow).
    Parameters:
    workbook - - The HSSF Workbook object associated with the sheet.
    Also see:
    org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
 protected HSSFSheet(HSSFWorkbook workbook,
    Sheet sheet) 
    Creates an HSSFSheet representing the given Sheet object. Should only be called by HSSFWorkbook when reading in an exisiting file.
    Parameters:
    workbook - - The HSSF Workbook object associated with the sheet.
    sheet - - lowlevel Sheet object this sheet will represent
    Also see:
    org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
Method from org.apache.poi.hssf.usermodel.HSSFSheet Summary:
addMergedRegion,   addValidationData,   autoSizeColumn,   autoSizeColumn,   cloneSheet,   createDrawingPatriarch,   createFreezePane,   createFreezePane,   createRow,   createSplitPane,   dumpDrawingRecords,   getAlternateExpression,   getAlternateFormula,   getAutobreaks,   getCellComment,   getColumnBreaks,   getColumnWidth,   getDefaultColumnWidth,   getDefaultRowHeight,   getDefaultRowHeightInPoints,   getDialog,   getDisplayGuts,   getDrawingEscherAggregate,   getDrawingPatriarch,   getFirstRowNum,   getFitToPage,   getFooter,   getForceFormulaRecalculation,   getHeader,   getHorizontallyCenter,   getLastRowNum,   getLeftCol,   getMargin,   getMergedRegionAt,   getNumMergedRegions,   getObjectProtect,   getPaneInformation,   getPassword,   getPhysicalNumberOfRows,   getPrintSetup,   getProtect,   getRow,   getRowBreaks,   getRowSumsBelow,   getRowSumsRight,   getScenarioProtect,   getSheet,   getSheetConditionalFormatting,   getTopRow,   getVerticallyCenter,   getVerticallyCenter,   groupColumn,   groupRow,   insertChartRecords,   isActive,   isColumnBroken,   isColumnHidden,   isDisplayFormulas,   isDisplayGridlines,   isDisplayRowColHeadings,   isGridsPrinted,   isPrintGridlines,   isRowBroken,   isSelected,   iterator,   protectSheet,   removeColumnBreak,   removeMergedRegion,   removeRow,   removeRowBreak,   rowIterator,   setActive,   setAlternativeExpression,   setAlternativeFormula,   setAutobreaks,   setColumnBreak,   setColumnGroupCollapsed,   setColumnHidden,   setColumnWidth,   setDefaultColumnStyle,   setDefaultColumnWidth,   setDefaultRowHeight,   setDefaultRowHeightInPoints,   setDialog,   setDisplayFormulas,   setDisplayGridlines,   setDisplayGuts,   setDisplayRowColHeadings,   setFitToPage,   setForceFormulaRecalculation,   setGridsPrinted,   setHorizontallyCenter,   setMargin,   setPrintGridlines,   setProtect,   setRowBreak,   setRowGroupCollapsed,   setRowSumsBelow,   setRowSumsRight,   setSelected,   setVerticallyCenter,   setZoom,   shiftMerged,   shiftRows,   shiftRows,   showInPane,   ungroupColumn,   ungroupRow,   validateColumn,   validateRow
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.poi.hssf.usermodel.HSSFSheet Detail:
 public int addMergedRegion(Region region) 
    adds a merged region of cells (hence those cells form one)
 public  void addValidationData(HSSFDataValidation obj_validation) 
    Creates a data validation object
 public  void autoSizeColumn(short 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.
 public  void autoSizeColumn(short 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.
 HSSFSheet cloneSheet(HSSFWorkbook workbook) 
 public HSSFPatriarch createDrawingPatriarch() 
    Creates the top-level drawing patriarch. This will have the effect of removing any existing drawings on this sheet. This may then be used to add graphics or charts
 public  void createFreezePane(int colSplit,
    int rowSplit) 
    Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
 public  void createFreezePane(int colSplit,
    int rowSplit,
    int leftmostColumn,
    int topRow) 
    Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
 public HSSFRow createRow(int rownum) 
    Create a new row within the sheet and return the high level representation
 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.
 public  void dumpDrawingRecords(boolean fat) 
    Aggregates the drawing records and dumps the escher record hierarchy to the standard output.
 public boolean getAlternateExpression() 
    whether alternate expression evaluation is on
 public boolean getAlternateFormula() 
    whether alternative formula entry is on
 public boolean getAutobreaks() 
    show automatic page breaks or not
 public HSSFComment getCellComment(int row,
    int column) 
    Returns cell comment for the specified row and column
 public short[] getColumnBreaks() 
    Retrieves all the vertical page breaks
 public short getColumnWidth(short column) 
    get the width (in units of 1/256th of a character width )
 public short getDefaultColumnWidth() 
    get the default column width for the sheet (if the columns do not define their own width) in characters
 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)
 public float getDefaultRowHeightInPoints() 
    get the default row height for the sheet (if the rows do not define their own height) in points.
 public boolean getDialog() 
    get whether sheet is a dialog sheet or not
 public boolean getDisplayGuts() 
    get whether to display the guts or not
 public EscherAggregate getDrawingEscherAggregate() 
    Returns the agregate escher records for this sheet, it there is one. WARNING - calling this will trigger a parsing of the associated escher records. Any that aren't supported (such as charts and complex drawing types) will almost certainly be lost or corrupted when written out.
 public HSSFPatriarch getDrawingPatriarch() 
    Returns the top-level drawing patriach, if there is one. This will hold any graphics or charts for the sheet. WARNING - calling this will trigger a parsing of the associated escher records. Any that aren't supported (such as charts and complex drawing types) will almost certainly be lost or corrupted when written out. Only use this with simple drawings, otherwise call HSSFSheet#createDrawingPatriarch() and start from scratch!
 public int getFirstRowNum() 
    gets the first row on the sheet
 public boolean getFitToPage() 
    fit to page option is on
 public HSSFFooter getFooter() 
    Gets the user model for the document footer.
 public boolean getForceFormulaRecalculation() 
    Whether a record must be inserted or not at generation to indicate that formula must be recalculated when workbook is opened.
 public HSSFHeader getHeader() 
    Gets the user model for the document header.
 public boolean getHorizontallyCenter() 
    Determine whether printed output for this sheet will be horizontally centered.
 public int getLastRowNum() 
    gets the last row on the sheet
 public short getLeftCol() 
    The left col in the visible view when the sheet is first viewed after opening it in a viewer
 public double getMargin(short margin) 
    Gets the size of the margin in inches.
 public Region getMergedRegionAt(int index) 
    gets the region at a particular index
 public int getNumMergedRegions() 
    returns the number of merged regions
 public boolean getObjectProtect() 
    Answer whether object protection is enabled or disabled
 public PaneInformation getPaneInformation() 
    Returns the information regarding the currently configured pane (split or freeze).
 public short getPassword() 
 public int getPhysicalNumberOfRows() 
    Returns the number of phsyically defined rows (NOT the number of rows in the sheet)
 public HSSFPrintSetup getPrintSetup() 
    Gets the print setup object.
 public boolean getProtect() 
    Answer whether protection is enabled or disabled
 public HSSFRow 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.
 public int[] getRowBreaks() 
    Retrieves all the horizontal page breaks
 public boolean getRowSumsBelow() 
    get if row summaries appear below detail in the outline
 public boolean getRowSumsRight() 
    get if col summaries appear right of the detail in the outline
 public boolean getScenarioProtect() 
    Answer whether scenario protection is enabled or disabled
 protected Sheet getSheet() 
    used internally in the API to get the low level Sheet record represented by this Object.
 public HSSFSheetConditionalFormatting getSheetConditionalFormatting() 
 public short getTopRow() 
    The top row in the visible view when the sheet is first viewed after opening it in a viewer
 public boolean getVerticallyCenter() 
    Determine whether printed output for this sheet will be vertically centered.
 public boolean getVerticallyCenter(boolean value) 
Deprecated! use - getVerticallyCenter() instead

    TODO: Boolean not needed, remove after next release
 public  void groupColumn(short fromColumn,
    short toColumn) 
    Create an outline for the provided column range.
 public  void groupRow(int fromRow,
    int toRow) 
 protected  void insertChartRecords(List records) 
 public boolean isActive() 
 public boolean isColumnBroken(short column) 
    Determines if there is a page break at the indicated column
 public boolean isColumnHidden(short column) 
    Get the hidden state for a given column.
 public boolean isDisplayFormulas() 
    Returns if formulas are displayed.
 public boolean isDisplayGridlines() 
    Returns if gridlines are displayed.
 public boolean isDisplayRowColHeadings() 
    Returns if RowColHeadings are displayed.
 public boolean isGridsPrinted() 
    get whether gridlines are printed.
 public boolean isPrintGridlines() 
    Returns whether gridlines are printed.
 public boolean isRowBroken(int row) 
    Determines if there is a page break at the indicated row
 public boolean isSelected() 
    Note - this is not the same as whether the sheet is focused (isActive)
 public Iterator iterator() 
 public  void protectSheet(String password) 
    Sets the protection enabled as well as the password
 public  void removeColumnBreak(short column) 
    Removes a page break at the indicated column
 public  void removeMergedRegion(int index) 
    removes a merged region of cells (hence letting them free)
 public  void removeRow(HSSFRow row) 
    Remove a row from this sheet. All cells contained in the row are removed as well
 public  void removeRowBreak(int row) 
    Removes the page break at the indicated row
 public Iterator rowIterator() 
 public  void setActive(boolean sel) 
    Sets whether sheet is selected.
 public  void setAlternativeExpression(boolean b) 
    whether alternate expression evaluation is on
 public  void setAlternativeFormula(boolean b) 
    whether alternative formula entry is on
 public  void setAutobreaks(boolean b) 
    show automatic page breaks or not
 public  void setColumnBreak(short column) 
    Sets a page break at the indicated column
 public  void setColumnGroupCollapsed(short columnNumber,
    boolean collapsed) 
    Expands or collapses a column group.
 public  void setColumnHidden(short column,
    boolean hidden) 
    Get the visibility state for a given column.
 public  void setColumnWidth(short column,
    short width) 
    set the width (in units of 1/256th of a character width)
 public  void setDefaultColumnStyle(short column,
    HSSFCellStyle style) 
    Sets the default column style for a given column. POI will only apply this style to new cells added to the sheet.
 public  void setDefaultColumnWidth(short width) 
    set the default column width for the sheet (if the columns do not define their own width) in characters
 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)
 public  void setDefaultRowHeightInPoints(float height) 
    set the default row height for the sheet (if the rows do not define their own height) in points
 public  void setDialog(boolean b) 
    set whether sheet is a dialog sheet or not
 public  void setDisplayFormulas(boolean show) 
    Sets whether the formulas are shown in a viewer.
 public  void setDisplayGridlines(boolean show) 
    Sets whether the gridlines are shown in a viewer.
 public  void setDisplayGuts(boolean b) 
    set whether to display the guts or not
 public  void setDisplayRowColHeadings(boolean show) 
    Sets whether the RowColHeadings are shown in a viewer.
 public  void setFitToPage(boolean b) 
    fit to page option is on
 public  void setForceFormulaRecalculation(boolean value) 
    Whether a record must be inserted or not at generation to indicate that formula must be recalculated when workbook is opened.
 public  void setGridsPrinted(boolean value) 
    set whether gridlines printed.
 public  void setHorizontallyCenter(boolean value) 
    determines whether the output is horizontally centered on the page.
 public  void setMargin(short margin,
    double size) 
    Sets the size of the margin in inches.
 public  void setPrintGridlines(boolean newPrintGridlines) 
    Turns on or off the printing of gridlines.
 public  void setProtect(boolean protect) 
Deprecated! use - protectSheet(String, boolean, boolean)

    Sets the protection on enabled or disabled
 public  void setRowBreak(int row) 
    Sets a page break at the indicated row
 public  void setRowGroupCollapsed(int row,
    boolean collapse) 
 public  void setRowSumsBelow(boolean b) 
    set if row summaries appear below detail in the outline
 public  void setRowSumsRight(boolean b) 
    set if col summaries appear right of the detail in the outline
 public  void setSelected(boolean sel) 
    Sets whether sheet is selected.
 public  void setVerticallyCenter(boolean value) 
    determines whether the output is vertically centered on the page.
 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.
 protected  void shiftMerged(int startRow,
    int endRow,
    int n,
    boolean isRow) 
    Shifts the merged regions left or right depending on mode

    TODO: MODE , this is only row specific

 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).

 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).

    TODO Might want to add bounds checking here

 public  void showInPane(short toprow,
    short leftcol) 
    Sets desktop window pane display area, when the file is first opened in a viewer.
 public  void ungroupColumn(short fromColumn,
    short toColumn) 
 public  void ungroupRow(int fromRow,
    int toRow) 
 protected  void validateColumn(short column) 
    Runs a bounds check for column numbers
 protected  void validateRow(int row) 
    Runs a bounds check for row numbers