org.apache.poi.hssf.usermodel
Class HSSFSheet

java.lang.Object
  |
  +--org.apache.poi.hssf.usermodel.HSSFSheet

public class HSSFSheet
extends java.lang.Object

High level representation of a worksheet.

Author:
Andrew C. Oliver (acoliver at apache dot org), Glen Stampoultzis (glens at apache.org), Libin Roman (romal at vistaportal.com)

Field Summary
static int INITIAL_CAPACITY
          Used for compile-time optimization.
 
Constructor Summary
protected HSSFSheet(Workbook book)
          Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from scratch.
protected HSSFSheet(Workbook book, Sheet sheet)
          Creates an HSSFSheet representing the given Sheet object.
 
Method Summary
 int addMergedRegion(Region region)
          adds a merged region of cells (hence those cells form one)
 HSSFRow createRow(short rownum)
          Create a new row within the sheet and return the high level representation
 boolean getAlternateExpression()
          whether alternate expression evaluation is on
 boolean getAlternateFormula()
          whether alternative formula entry is on
 boolean getAutobreaks()
          show automatic page breaks or not
 short getColumnWidth(short column)
          get the width (in units of 1/256th of a character width )
 short getDefaultColumnWidth()
          get the default column width for the sheet (if the columns do not define their own width) in characters
 short getDefaultRowHeight()
          get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
 float getDefaultRowHeightInPoints()
          get the default row height for the sheet (if the rows do not define their own height) in points.
 boolean getDialog()
          get whether sheet is a dialog sheet or not
 boolean getDisplayGuts()
          get whether to display the guts or not
 int getFirstRowNum()
          gets the first row on the sheet
 boolean getFitToPage()
          fit to page option is on
 int getLastRowNum()
          gets the last row on the sheet
 Region getMergedRegionAt(int index)
          gets the region at a particular index
 int getNumMergedRegions()
          returns the number of merged regions
 int getPhysicalNumberOfRows()
          Returns the number of phsyically defined rows (NOT the number of rows in the sheet)
 HSSFRow getRow(int rownum)
          Returns the logical row (not physical) 0-based.
 boolean getRowSumsBelow()
          get if row summaries appear below detail in the outline
 boolean getRowSumsRight()
          get if col summaries appear right of the detail in the outline
protected  Sheet getSheet()
          used internally in the API to get the low level Sheet record represented by this Object.
 boolean getVerticallyCenter(boolean value)
          Determine whether printed output for this sheet will be vertically centered.
 boolean isGridsPrinted()
          get whether gridlines are printed.
 void removeMergedRegion(int index)
          removes a merged region of cells (hence letting them free)
 void removeRow(HSSFRow row)
          Remove a row from this sheet.
 java.util.Iterator rowIterator()
           
 void setAlternativeExpression(boolean b)
          whether alternate expression evaluation is on
 void setAlternativeFormula(boolean b)
          whether alternative formula entry is on
 void setAutobreaks(boolean b)
          show automatic page breaks or not
 void setColumnWidth(short column, short width)
          set the width (in units of 1/256th of a character width)
 void setDefaultColumnWidth(short 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 setDialog(boolean b)
          set whether sheet is a dialog sheet or not
 void setDisplayGuts(boolean b)
          set whether to display the guts or not
 void setFitToPage(boolean b)
          fit to page option is on
 void setGridsPrinted(boolean value)
          set whether gridlines printed.
 void setRowSumsBelow(boolean b)
          set if row summaries appear below detail in the outline
 void setRowSumsRight(boolean b)
          set if col summaries appear right of the detail in the outline
 void setVerticallyCenter(boolean value)
          determines whether the output is vertically centered on the page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

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.
Constructor Detail

HSSFSheet

protected HSSFSheet(Workbook book)
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:
book - - lowlevel Workbook object associated with the sheet.
See Also:
HSSFWorkbook.createSheet()

HSSFSheet

protected HSSFSheet(Workbook book,
                    Sheet sheet)
Creates an HSSFSheet representing the given Sheet object. Should only be called by HSSFWorkbook when reading in an exisiting file.
Parameters:
book - - lowlevel Workbook object associated with the sheet.
sheet - - lowlevel Sheet object this sheet will represent
See Also:
HSSFWorkbook.createSheet()
Method Detail

createRow

public HSSFRow createRow(short rownum)
Create a new row within the sheet and return the high level representation
Parameters:
rownum - row number
Returns:
High level HSSFRow object representing a row in the sheet
See Also:
HSSFRow, removeRow(HSSFRow)

removeRow

public void removeRow(HSSFRow row)
Remove a row from this sheet. All cells contained in the row are removed as well
Parameters:
row - representing a row to remove.

getRow

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.
Parameters:
rownum - row to get
Returns:
HSSFRow representing the rownumber or null if its not defined on the sheet

getPhysicalNumberOfRows

public int getPhysicalNumberOfRows()
Returns the number of phsyically defined rows (NOT the number of rows in the sheet)

getFirstRowNum

public int getFirstRowNum()
gets the first row on the sheet
Returns:
the number of the first logical row on the sheet

getLastRowNum

public int getLastRowNum()
gets the last row on the sheet
Returns:
last row contained n this sheet.

setColumnWidth

public void setColumnWidth(short column,
                           short width)
set the width (in units of 1/256th of a character width)
Parameters:
column - - the column to set (0-based)
width - - the width in units of 1/256th of a character width

getColumnWidth

public short getColumnWidth(short column)
get the width (in units of 1/256th of a character width )
Parameters:
column - - the column to set (0-based)
Returns:
width - the width in units of 1/256th of a character width

getDefaultColumnWidth

public short getDefaultColumnWidth()
get the default column width for the sheet (if the columns do not define their own width) in characters
Returns:
default column width

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)
Returns:
default row height

getDefaultRowHeightInPoints

public float getDefaultRowHeightInPoints()
get the default row height for the sheet (if the rows do not define their own height) in points.
Returns:
default row height in points

setDefaultColumnWidth

public void setDefaultColumnWidth(short width)
set the default column width for the sheet (if the columns do not define their own width) in characters
Parameters:
width - default column width

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)
Parameters:
height - default row height

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
Parameters:
height - default row height

isGridsPrinted

public boolean isGridsPrinted()
get whether gridlines are printed.
Returns:
true if printed

setGridsPrinted

public void setGridsPrinted(boolean value)
set whether gridlines printed.
Parameters:
value - false if not printed.

addMergedRegion

public int addMergedRegion(Region region)
adds a merged region of cells (hence those cells form one)
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.
Parameters:
value - true to vertically center, false otherwise.

getVerticallyCenter

public boolean getVerticallyCenter(boolean value)
Determine whether printed output for this sheet will be vertically centered.

removeMergedRegion

public void removeMergedRegion(int index)
removes a merged region of cells (hence letting them free)
Parameters:
index - of the region to unmerge

getNumMergedRegions

public int getNumMergedRegions()
returns the number of merged regions
Returns:
number of merged regions

getMergedRegionAt

public Region getMergedRegionAt(int index)
gets the region at a particular index
Parameters:
index - of the region to fetch
Returns:
the merged region (simple eh?)

rowIterator

public java.util.Iterator rowIterator()
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.

getSheet

protected Sheet getSheet()
used internally in the API to get the low level Sheet record represented by this Object.
Returns:
Sheet - low level representation of this HSSFSheet.

setAlternativeExpression

public void setAlternativeExpression(boolean b)
whether alternate expression evaluation is on
Parameters:
b - alternative expression evaluation or not

setAlternativeFormula

public void setAlternativeFormula(boolean b)
whether alternative formula entry is on
Parameters:
b - alternative formulas or not

setAutobreaks

public void setAutobreaks(boolean b)
show automatic page breaks or not
Parameters:
b - whether to show auto page breaks

setDialog

public void setDialog(boolean b)
set whether sheet is a dialog sheet or not
Parameters:
b - isDialog or not

setDisplayGuts

public void setDisplayGuts(boolean b)
set whether to display the guts or not
Parameters:
b - guts or no guts (or glory)

setFitToPage

public void setFitToPage(boolean b)
fit to page option is on
Parameters:
b - fit or not

setRowSumsBelow

public void setRowSumsBelow(boolean b)
set if row summaries appear below detail in the outline
Parameters:
b - below or not

setRowSumsRight

public void setRowSumsRight(boolean b)
set if col summaries appear right of the detail in the outline
Parameters:
b - right or not

getAlternateExpression

public boolean getAlternateExpression()
whether alternate expression evaluation is on
Returns:
alternative expression evaluation or not

getAlternateFormula

public boolean getAlternateFormula()
whether alternative formula entry is on
Returns:
alternative formulas or not

getAutobreaks

public boolean getAutobreaks()
show automatic page breaks or not
Returns:
whether to show auto page breaks

getDialog

public boolean getDialog()
get whether sheet is a dialog sheet or not
Returns:
isDialog or not

getDisplayGuts

public boolean getDisplayGuts()
get whether to display the guts or not
Returns:
guts or no guts (or glory)

getFitToPage

public boolean getFitToPage()
fit to page option is on
Returns:
fit or not

getRowSumsBelow

public boolean getRowSumsBelow()
get if row summaries appear below detail in the outline
Returns:
below or not

getRowSumsRight

public boolean getRowSumsRight()
get if col summaries appear right of the detail in the outline
Returns:
right or not


Copyright © 2002 Apache jakarta-poi project. All Rights Reserved.