jxl

Class SheetSettings


public final class SheetSettings
extends java.lang.Object

This is a bean which client applications may use to get/set various properties which are associated with a particular worksheet, such as headers and footers, page orientation etc.

Field Summary

static int
DEFAULT_DEFAULT_ROW_HEIGHT
The default value for the default row height

Constructor Summary

SheetSettings(Sheet s)
Default constructor
SheetSettings(SheetSettings copy, Sheet s)
Copy constructor.

Method Summary

boolean
getAutomaticFormulaCalculation()
Retrieves the automatic formula calculation flag
double
getBottomMargin()
Accessor for the bottom margin
int
getCopies()
Accessor for the number of copies to print
int
getDefaultColumnWidth()
Accessor for the default column width
double
getDefaultHeightMargin()
Gets the default margin height
int
getDefaultRowHeight()
Accessor for the default row height
double
getDefaultWidthMargin()
Gets the default margin width
boolean
getDisplayZeroValues()
Accessor for the displayZeroValues property
int
getFitHeight()
Accessor for the fit height
boolean
getFitToPages()
Accessor for the fit width print flag
int
getFitWidth()
Accessor for the fit width
HeaderFooter
getFooter()
Accessor for the footer
double
getFooterMargin()
Accessor for the footer margin
HeaderFooter
getHeader()
Accessor for the header
double
getHeaderMargin()
Accessor for the header margin
int
getHorizontalFreeze()
Gets the row at which the pane is frozen horizontally
int
getHorizontalPrintResolution()
Accessor for the horizontal print resolution
double
getLeftMargin()
Accessor for the left margin
int
getNormalMagnification()
Accessor for the nomral view magnificaton factor.
PageOrientation
getOrientation()
Accessor for the orientation
int
getPageBreakPreviewMagnification()
Accessor for the page break preview mangificaton factor.
boolean
getPageBreakPreviewMode()
Accessor for the pageBreakPreview mode
PageOrder
getPageOrder()
Accessor for the order
int
getPageStart()
Accessor for the page start
PaperSize
getPaperSize()
Accessor for the paper size
String
getPassword()
Accessor for the password
int
getPasswordHash()
Accessor for the password hash - used only when copying sheets
Range
getPrintArea()
Accessor for the print area
boolean
getPrintGridLines()
Accessor for the printGridLines property
boolean
getPrintHeaders()
Accessor for the printHeaders property
Range
getPrintTitlesCol()
Accessor for the print column titles
Range
getPrintTitlesRow()
Accessor for the print row titles
boolean
getRecalculateFormulasBeforeSave()
Retrieves the recalculate formulas before save flag
double
getRightMargin()
Accessor for the right margin
int
getScaleFactor()
Accessor for the scale factor
boolean
getShowGridLines()
Accessor for the showGridLines property
double
getTopMargin()
Accessor for the top margin
int
getVerticalFreeze()
Gets the column at which the pane is frozen vertically
int
getVerticalPrintResolution()
Accessor for the vertical print resolution
int
getZoomFactor()
Accessor for the zoom factor.
boolean
isHidden()
Accessor for the hidden nature of this sheet
boolean
isHorizontalCentre()
Accessor for the horizontal centre
boolean
isProtected()
Queries whether this sheet is protected (ie.
boolean
isSelected()
Accessor for the selected nature of the sheet
boolean
isVerticalCentre()
Accessor for the vertical centre
void
setAutomaticFormulaCalculation(boolean auto)
Sets the automatic formula calculation flag
void
setBottomMargin(double m)
Sets the bottom margin
void
setCopies(int c)
Sets the number of copies
void
setDefaultColumnWidth(int w)
Sets the default column width
void
setDefaultRowHeight(int h)
Sets the default row height
void
setDisplayZeroValues(boolean b)
Sets the displayZeroValues property
void
setFitHeight(int fh)
Sets the number of pages vertically that this sheet will be printed into
void
setFitToPages(boolean b)
Accessor for the fit to pages flag
void
setFitWidth(int fw)
Sets the number of pages widthwise which this sheet should be printed into
void
setFooter(HeaderFooter f)
Sets the footer
void
setFooterMargin(double d)
Sets the margin for any page footer
void
setHeader(HeaderFooter h)
Sets the header
void
setHeaderMargin(double d)
Sets the margin for any page headers
void
setHidden(boolean h)
Sets the hidden status of this worksheet
void
setHorizontalCentre(boolean horizCentre)
Sets the horizontal centre
void
setHorizontalFreeze(int row)
Sets the row at which the pane is frozen horizontally
void
setHorizontalPrintResolution(int hpw)
Sets the horizontal print resolution
void
setLeftMargin(double m)
Sets the left margin
void
setNormalMagnification(int f)
Accessor for the normal magnificaton factor.
void
setOrientation(PageOrientation po)
Sets the paper orientation for printing this sheet
void
setPageBreakPreviewMagnification(int f)
Accessor for the page break preview magnificaton factor.
void
setPageBreakPreviewMode(boolean b)
Sets the pageBreakPreviewMode property
void
setPageOrder(PageOrder order)
Sets the page order for printing this sheet
void
setPageStart(int ps)
Sets the page number at which to commence printing
void
setPaperSize(PaperSize ps)
Sets the paper size to be used when printing this sheet
void
setPassword(String s)
Sets the password for this sheet
void
setPasswordHash(int ph)
Accessor for the password hash - used only when copying sheets
void
setPrintArea(int firstCol, int firstRow, int lastCol, int lastRow)
Sets the print area for this sheet
void
setPrintGridLines(boolean b)
Sets the printGridLines property
void
setPrintHeaders(boolean b)
Sets the printHeaders property
void
setPrintTitles(int firstRow, int lastRow, int firstCol, int lastCol)
Sets both of the print titles for this sheet
void
setPrintTitlesCol(int firstCol, int lastCol)
Sets the print column titles for this sheet
void
setPrintTitlesRow(int firstRow, int lastRow)
Sets the print row titles for this sheet
void
setProtected(boolean p)
Sets the protected (ie.
void
setRecalculateFormulasBeforeSave(boolean recalc)
Sets the recalculate formulas when the sheet is saved flag
void
setRightMargin(double m)
Sets the right margin
void
setScaleFactor(int sf)
Sets the scale factor for this sheet to be used when printing.
void
setSelected()
Deprecated. use overloaded version which takes a boolean
void
setSelected(boolean s)
Sets this sheet to be when it is opened in excel
void
setShowGridLines(boolean b)
Sets the showGridLines property
void
setTopMargin(double m)
Sets the top margin
void
setVerticalCentre(boolean vertCentre)
Sets the vertical centre
void
setVerticalFreeze(int col)
Sets the row at which the pane is frozen vertically
void
setVerticalPrintResolution(int vpw)
Sets the vertical print reslution
void
setZoomFactor(int zf)
Sets the zoom factor.

Field Details

DEFAULT_DEFAULT_ROW_HEIGHT

public static final int DEFAULT_DEFAULT_ROW_HEIGHT
The default value for the default row height
Field Value:
255

Constructor Details

SheetSettings

public SheetSettings(Sheet s)
Default constructor

SheetSettings

public SheetSettings(SheetSettings copy,
                     Sheet s)
Copy constructor. Called when copying sheets
Parameters:
copy - the settings to copy

Method Details

getAutomaticFormulaCalculation

public boolean getAutomaticFormulaCalculation()
Retrieves the automatic formula calculation flag
Returns:
TRUE if formulas are calculated automatically, FALSE if they are calculated manually

getBottomMargin

public double getBottomMargin()
Accessor for the bottom margin
Returns:
the bottom margin in inches

getCopies

public int getCopies()
Accessor for the number of copies to print
Returns:
the number of copies

getDefaultColumnWidth

public int getDefaultColumnWidth()
Accessor for the default column width
Returns:
the default column width, in characters

getDefaultHeightMargin

public double getDefaultHeightMargin()
Gets the default margin height
Returns:
the default margin height

getDefaultRowHeight

public int getDefaultRowHeight()
Accessor for the default row height
Returns:
the default row height, in 1/20ths of a point

getDefaultWidthMargin

public double getDefaultWidthMargin()
Gets the default margin width
Returns:
the default margin width

getDisplayZeroValues

public boolean getDisplayZeroValues()
Accessor for the displayZeroValues property
Returns:
TRUE to display zero values, FALSE not to bother

getFitHeight

public int getFitHeight()
Accessor for the fit height
Returns:
the number of pages this sheet will be printed into heightwise

getFitToPages

public boolean getFitToPages()
Accessor for the fit width print flag
Returns:
TRUE if the print is to fit to pages, false otherwise

getFitWidth

public int getFitWidth()
Accessor for the fit width
Returns:
the number of pages this sheet will be printed into widthwise

getFooter

public HeaderFooter getFooter()
Accessor for the footer
Returns:
the footer

getFooterMargin

public double getFooterMargin()
Accessor for the footer margin
Returns:
the footer margin

getHeader

public HeaderFooter getHeader()
Accessor for the header
Returns:
the header

getHeaderMargin

public double getHeaderMargin()
Accessor for the header margin
Returns:
the header margin

getHorizontalFreeze

public int getHorizontalFreeze()
Gets the row at which the pane is frozen horizontally
Returns:
the row at which the pane is horizontally frozen, or 0 if there is no freeze

getHorizontalPrintResolution

public int getHorizontalPrintResolution()
Accessor for the horizontal print resolution
Returns:
the horizontal print resolution

getLeftMargin

public double getLeftMargin()
Accessor for the left margin
Returns:
the left margin in inches

getNormalMagnification

public int getNormalMagnification()
Accessor for the nomral view magnificaton factor. Do not confuse zoom factor or scale factor
Returns:
the page break preview magnification a percentage

getOrientation

public PageOrientation getOrientation()
Accessor for the orientation
Returns:
the orientation

getPageBreakPreviewMagnification

public int getPageBreakPreviewMagnification()
Accessor for the page break preview mangificaton factor. Do not confuse zoom factor or scale factor
Returns:
the page break preview magnification a percentage

getPageBreakPreviewMode

public boolean getPageBreakPreviewMode()
Accessor for the pageBreakPreview mode
Returns:
TRUE if page break preview is enabled, FALSE otherwise

getPageOrder

public PageOrder getPageOrder()
Accessor for the order
Returns:

getPageStart

public int getPageStart()
Accessor for the page start
Returns:
the page start

getPaperSize

public PaperSize getPaperSize()
Accessor for the paper size
Returns:
the paper size

getPassword

public String getPassword()
Accessor for the password
Returns:
the password to unlock this sheet, or NULL if not protected

getPasswordHash

public int getPasswordHash()
Accessor for the password hash - used only when copying sheets
Returns:
passwordHash

getPrintArea

public Range getPrintArea()
Accessor for the print area
Returns:
the print area, or NULL if one is not defined for this sheet

getPrintGridLines

public boolean getPrintGridLines()
Accessor for the printGridLines property
Returns:
TRUE if grid lines will be printed, FALSE otherwise

getPrintHeaders

public boolean getPrintHeaders()
Accessor for the printHeaders property
Returns:
TRUE if headers will be printed, FALSE otherwise

getPrintTitlesCol

public Range getPrintTitlesCol()
Accessor for the print column titles
Returns:
the print column titles, or NULL if one is not defined for this sheet

getPrintTitlesRow

public Range getPrintTitlesRow()
Accessor for the print row titles
Returns:
the print row titles, or NULL if one is not defined for this sheet

getRecalculateFormulasBeforeSave

public boolean getRecalculateFormulasBeforeSave()
Retrieves the recalculate formulas before save flag
Returns:
TRUE if formulas are calculated before the sheet is saved, FALSE otherwise

getRightMargin

public double getRightMargin()
Accessor for the right margin
Returns:
the right margin in inches

getScaleFactor

public int getScaleFactor()
Accessor for the scale factor
Returns:
the scale factor

getShowGridLines

public boolean getShowGridLines()
Accessor for the showGridLines property
Returns:
TRUE if grid lines will be shown, FALSE otherwise

getTopMargin

public double getTopMargin()
Accessor for the top margin
Returns:
the top margin in inches

getVerticalFreeze

public int getVerticalFreeze()
Gets the column at which the pane is frozen vertically
Returns:
the column at which the pane is vertically frozen, or 0 if there is no freeze

getVerticalPrintResolution

public int getVerticalPrintResolution()
Accessor for the vertical print resolution
Returns:
the vertical print resolution

getZoomFactor

public int getZoomFactor()
Accessor for the zoom factor. Do not confuse zoom factor (which relates to the on screen view) with scale factor (which refers to the scale factor when printing)
Returns:
the zoom factor as a percentage

isHidden

public boolean isHidden()
Accessor for the hidden nature of this sheet
Returns:
TRUE if this sheet is hidden, FALSE otherwise

isHorizontalCentre

public boolean isHorizontalCentre()
Accessor for the horizontal centre
Returns:
Returns the horizontalCentre.

isProtected

public boolean isProtected()
Queries whether this sheet is protected (ie. read only)
Returns:
TRUE if this sheet is read only, FALSE otherwise

isSelected

public boolean isSelected()
Accessor for the selected nature of the sheet
Returns:
TRUE if this sheet is selected, FALSE otherwise

isVerticalCentre

public boolean isVerticalCentre()
Accessor for the vertical centre
Returns:
Returns the verticalCentre.

setAutomaticFormulaCalculation

public void setAutomaticFormulaCalculation(boolean auto)
Sets the automatic formula calculation flag
Parameters:
auto - - TRUE to automatically calculate the formulas, FALSE otherwise

setBottomMargin

public void setBottomMargin(double m)
Sets the bottom margin
Parameters:
m - the bottom margin in inches

setCopies

public void setCopies(int c)
Sets the number of copies
Parameters:
c - the number of copies

setDefaultColumnWidth

public void setDefaultColumnWidth(int w)
Sets the default column width
Parameters:
w - the new default column width

setDefaultRowHeight

public void setDefaultRowHeight(int h)
Sets the default row height
Parameters:
h - the default row height, in 1/20ths of a point

setDisplayZeroValues

public void setDisplayZeroValues(boolean b)
Sets the displayZeroValues property
Parameters:
b - TRUE to show zero values, FALSE not to bother

setFitHeight

public void setFitHeight(int fh)
Sets the number of pages vertically that this sheet will be printed into
Parameters:
fh - the number of pages this sheet will be printed into heightwise

setFitToPages

public void setFitToPages(boolean b)
Accessor for the fit to pages flag
Parameters:
b - TRUE to fit to pages, FALSE to use a scale factor

setFitWidth

public void setFitWidth(int fw)
Sets the number of pages widthwise which this sheet should be printed into
Parameters:
fw - the number of pages

setFooter

public void setFooter(HeaderFooter f)
Sets the footer
Parameters:
f - the footer

setFooterMargin

public void setFooterMargin(double d)
Sets the margin for any page footer
Parameters:
d - the footer margin in inches

setHeader

public void setHeader(HeaderFooter h)
Sets the header
Parameters:
h - the header

setHeaderMargin

public void setHeaderMargin(double d)
Sets the margin for any page headers
Parameters:
d - the margin in inches

setHidden

public void setHidden(boolean h)
Sets the hidden status of this worksheet
Parameters:
h - the hidden flag

setHorizontalCentre

public void setHorizontalCentre(boolean horizCentre)
Sets the horizontal centre
Parameters:
horizCentre - The horizontalCentre to set.

setHorizontalFreeze

public void setHorizontalFreeze(int row)
Sets the row at which the pane is frozen horizontally
Parameters:
row - the row number to freeze at

setHorizontalPrintResolution

public void setHorizontalPrintResolution(int hpw)
Sets the horizontal print resolution
Parameters:
hpw - the print resolution

setLeftMargin

public void setLeftMargin(double m)
Sets the left margin
Parameters:
m - the left margin in inches

setNormalMagnification

public void setNormalMagnification(int f)
Accessor for the normal magnificaton factor. Do not confuse zoom factor or scale factor
Parameters:
f - the page break preview magnification as a percentage

setOrientation

public void setOrientation(PageOrientation po)
Sets the paper orientation for printing this sheet
Parameters:
po - the orientation

setPageBreakPreviewMagnification

public void setPageBreakPreviewMagnification(int f)
Accessor for the page break preview magnificaton factor. Do not confuse zoom factor or scale factor
Parameters:
f - the page break preview magnification as a percentage

setPageBreakPreviewMode

public void setPageBreakPreviewMode(boolean b)
Sets the pageBreakPreviewMode property
Parameters:
b - TRUE to launch in page break preview mode, FALSE otherwise

setPageOrder

public void setPageOrder(PageOrder order)
Sets the page order for printing this sheet
Parameters:
order -

setPageStart

public void setPageStart(int ps)
Sets the page number at which to commence printing
Parameters:
ps - the page start number

setPaperSize

public void setPaperSize(PaperSize ps)
Sets the paper size to be used when printing this sheet
Parameters:
ps - the paper size

setPassword

public void setPassword(String s)
Sets the password for this sheet
Parameters:
s - the password

setPasswordHash

public void setPasswordHash(int ph)
Accessor for the password hash - used only when copying sheets
Parameters:
ph - the password hash

setPrintArea

public void setPrintArea(int firstCol,
                         int firstRow,
                         int lastCol,
                         int lastRow)
Sets the print area for this sheet
Parameters:
firstCol - the first column of the print area
firstRow - the first row of the print area
lastCol - the last column of the print area
lastRow - the last row of the print area

setPrintGridLines

public void setPrintGridLines(boolean b)
Sets the printGridLines property
Parameters:
b - TRUE to print grid lines on this sheet, FALSE otherwise

setPrintHeaders

public void setPrintHeaders(boolean b)
Sets the printHeaders property
Parameters:
b - TRUE to print headers on this sheet, FALSE otherwise

setPrintTitles

public void setPrintTitles(int firstRow,
                           int lastRow,
                           int firstCol,
                           int lastCol)
Sets both of the print titles for this sheet
Parameters:
firstRow - the first row of the print row titles
lastRow - the last row of the print row titles
firstCol - the first column of the print column titles
lastCol - the last column of the print column titles

setPrintTitlesCol

public void setPrintTitlesCol(int firstCol,
                              int lastCol)
Sets the print column titles for this sheet
Parameters:

setPrintTitlesRow

public void setPrintTitlesRow(int firstRow,
                              int lastRow)
Sets the print row titles for this sheet
Parameters:
firstRow - the first row of the print titles
lastRow - the last row of the print titles

setProtected

public void setProtected(boolean p)
Sets the protected (ie. read only) status of this sheet
Parameters:
p - the protected status

setRecalculateFormulasBeforeSave

public void setRecalculateFormulasBeforeSave(boolean recalc)
Sets the recalculate formulas when the sheet is saved flag
Parameters:
recalc - - TRUE to automatically calculate the formulas when the, spreadsheet is saved, FALSE otherwise

setRightMargin

public void setRightMargin(double m)
Sets the right margin
Parameters:
m - the right margin in inches

setScaleFactor

public void setScaleFactor(int sf)
Sets the scale factor for this sheet to be used when printing. The parameter is a percentage, therefore setting a scale factor of 100 will print at normal size, 50 half size, 200 double size etc
Parameters:
sf - the scale factor as a percentage

setSelected

public void setSelected()

Deprecated. use overloaded version which takes a boolean

Sets this sheet to be when it is opened in excel

setSelected

public void setSelected(boolean s)
Sets this sheet to be when it is opened in excel
Parameters:
s - sets whether this sheet is selected or not

setShowGridLines

public void setShowGridLines(boolean b)
Sets the showGridLines property
Parameters:
b - TRUE to show grid lines on this sheet, FALSE otherwise

setTopMargin

public void setTopMargin(double m)
Sets the top margin
Parameters:
m - the top margin in inches

setVerticalCentre

public void setVerticalCentre(boolean vertCentre)
Sets the vertical centre
Parameters:
vertCentre - The verticalCentre to set.

setVerticalFreeze

public void setVerticalFreeze(int col)
Sets the row at which the pane is frozen vertically
Parameters:
col - the column number to freeze at

setVerticalPrintResolution

public void setVerticalPrintResolution(int vpw)
Sets the vertical print reslution
Parameters:
vpw - the vertical print resolution

setZoomFactor

public void setZoomFactor(int zf)
Sets the zoom factor. Do not confuse zoom factor (which relates to the on screen view) with scale factor (which refers to the scale factor when printing)
Parameters:
zf - the zoom factor as a percentage