Package jxl
Class SheetSettings
- java.lang.Object
-
- jxl.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
Fields Modifier and Type Field Description static int
DEFAULT_DEFAULT_ROW_HEIGHT
The default value for the default row height
-
Constructor Summary
Constructors Constructor Description SheetSettings(Sheet s)
Default constructorSheetSettings(SheetSettings copy, Sheet s)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
getAutomaticFormulaCalculation()
Retrieves the automatic formula calculation flagdouble
getBottomMargin()
Accessor for the bottom marginint
getCopies()
Accessor for the number of copies to printint
getDefaultColumnWidth()
Accessor for the default column widthdouble
getDefaultHeightMargin()
Gets the default margin heightint
getDefaultRowHeight()
Accessor for the default row heightdouble
getDefaultWidthMargin()
Gets the default margin widthboolean
getDisplayZeroValues()
Accessor for the displayZeroValues propertyint
getFitHeight()
Accessor for the fit heightboolean
getFitToPages()
Accessor for the fit width print flagint
getFitWidth()
Accessor for the fit widthHeaderFooter
getFooter()
Accessor for the footerdouble
getFooterMargin()
Accessor for the footer marginHeaderFooter
getHeader()
Accessor for the headerdouble
getHeaderMargin()
Accessor for the header marginint
getHorizontalFreeze()
Gets the row at which the pane is frozen horizontallyint
getHorizontalPrintResolution()
Accessor for the horizontal print resolutiondouble
getLeftMargin()
Accessor for the left marginint
getNormalMagnification()
Accessor for the nomral view magnificaton factor.PageOrientation
getOrientation()
Accessor for the orientationint
getPageBreakPreviewMagnification()
Accessor for the page break preview mangificaton factor.boolean
getPageBreakPreviewMode()
Accessor for the pageBreakPreview modePageOrder
getPageOrder()
Accessor for the orderint
getPageStart()
Accessor for the page startPaperSize
getPaperSize()
Accessor for the paper sizejava.lang.String
getPassword()
Accessor for the passwordint
getPasswordHash()
Accessor for the password hash - used only when copying sheetsRange
getPrintArea()
Accessor for the print areaboolean
getPrintGridLines()
Accessor for the printGridLines propertyboolean
getPrintHeaders()
Accessor for the printHeaders propertyRange
getPrintTitlesCol()
Accessor for the print column titlesRange
getPrintTitlesRow()
Accessor for the print row titlesboolean
getRecalculateFormulasBeforeSave()
Retrieves the recalculate formulas before save flagdouble
getRightMargin()
Accessor for the right marginint
getScaleFactor()
Accessor for the scale factorboolean
getShowGridLines()
Accessor for the showGridLines propertydouble
getTopMargin()
Accessor for the top marginint
getVerticalFreeze()
Gets the column at which the pane is frozen verticallyint
getVerticalPrintResolution()
Accessor for the vertical print resolutionint
getZoomFactor()
Accessor for the zoom factor.boolean
isHidden()
Accessor for the hidden nature of this sheetboolean
isHorizontalCentre()
Accessor for the horizontal centreboolean
isProtected()
Queries whether this sheet is protected (ie.boolean
isSelected()
Accessor for the selected nature of the sheetboolean
isVerticalCentre()
Accessor for the vertical centrevoid
setAutomaticFormulaCalculation(boolean auto)
Sets the automatic formula calculation flagvoid
setBottomMargin(double m)
Sets the bottom marginvoid
setCopies(int c)
Sets the number of copiesvoid
setDefaultColumnWidth(int w)
Sets the default column widthvoid
setDefaultRowHeight(int h)
Sets the default row heightvoid
setDisplayZeroValues(boolean b)
Sets the displayZeroValues propertyvoid
setFitHeight(int fh)
Sets the number of pages vertically that this sheet will be printed intovoid
setFitToPages(boolean b)
Accessor for the fit to pages flagvoid
setFitWidth(int fw)
Sets the number of pages widthwise which this sheet should be printed intovoid
setFooter(HeaderFooter f)
Sets the footervoid
setFooterMargin(double d)
Sets the margin for any page footervoid
setHeader(HeaderFooter h)
Sets the headervoid
setHeaderMargin(double d)
Sets the margin for any page headersvoid
setHidden(boolean h)
Sets the hidden status of this worksheetvoid
setHorizontalCentre(boolean horizCentre)
Sets the horizontal centrevoid
setHorizontalFreeze(int row)
Sets the row at which the pane is frozen horizontallyvoid
setHorizontalPrintResolution(int hpw)
Sets the horizontal print resolutionvoid
setLeftMargin(double m)
Sets the left marginvoid
setNormalMagnification(int f)
Accessor for the normal magnificaton factor.void
setOrientation(PageOrientation po)
Sets the paper orientation for printing this sheetvoid
setPageBreakPreviewMagnification(int f)
Accessor for the page break preview magnificaton factor.void
setPageBreakPreviewMode(boolean b)
Sets the pageBreakPreviewMode propertyvoid
setPageOrder(PageOrder order)
Sets the page order for printing this sheetvoid
setPageStart(int ps)
Sets the page number at which to commence printingvoid
setPaperSize(PaperSize ps)
Sets the paper size to be used when printing this sheetvoid
setPassword(java.lang.String s)
Sets the password for this sheetvoid
setPasswordHash(int ph)
Accessor for the password hash - used only when copying sheetsvoid
setPrintArea(int firstCol, int firstRow, int lastCol, int lastRow)
Sets the print area for this sheetvoid
setPrintGridLines(boolean b)
Sets the printGridLines propertyvoid
setPrintHeaders(boolean b)
Sets the printHeaders propertyvoid
setPrintTitles(int firstRow, int lastRow, int firstCol, int lastCol)
Sets both of the print titles for this sheetvoid
setPrintTitlesCol(int firstCol, int lastCol)
Sets the print column titles for this sheetvoid
setPrintTitlesRow(int firstRow, int lastRow)
Sets the print row titles for this sheetvoid
setProtected(boolean p)
Sets the protected (ie.void
setRecalculateFormulasBeforeSave(boolean recalc)
Sets the recalculate formulas when the sheet is saved flagvoid
setRightMargin(double m)
Sets the right marginvoid
setScaleFactor(int sf)
Sets the scale factor for this sheet to be used when printing.void
setSelected()
Deprecated.use overloaded version which takes a booleanvoid
setSelected(boolean s)
Sets this sheet to be when it is opened in excelvoid
setShowGridLines(boolean b)
Sets the showGridLines propertyvoid
setTopMargin(double m)
Sets the top marginvoid
setVerticalCentre(boolean vertCentre)
Sets the vertical centrevoid
setVerticalFreeze(int col)
Sets the row at which the pane is frozen verticallyvoid
setVerticalPrintResolution(int vpw)
Sets the vertical print reslutionvoid
setZoomFactor(int zf)
Sets the zoom factor.
-
-
-
Field Detail
-
DEFAULT_DEFAULT_ROW_HEIGHT
public static final int DEFAULT_DEFAULT_ROW_HEIGHT
The default value for the default row height- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
setOrientation
public void setOrientation(PageOrientation po)
Sets the paper orientation for printing this sheet- Parameters:
po
- the orientation
-
getOrientation
public PageOrientation getOrientation()
Accessor for the orientation- Returns:
- the orientation
-
getPageOrder
public PageOrder getPageOrder()
Accessor for the order- Returns:
-
setPageOrder
public void setPageOrder(PageOrder order)
Sets the page order for printing this sheet- Parameters:
order
-
-
setPaperSize
public void setPaperSize(PaperSize ps)
Sets the paper size to be used when printing this sheet- Parameters:
ps
- the paper size
-
getPaperSize
public PaperSize getPaperSize()
Accessor for the paper size- Returns:
- the paper size
-
isProtected
public boolean isProtected()
Queries whether this sheet is protected (ie. read only)- Returns:
- TRUE if this sheet is read only, FALSE otherwise
-
setProtected
public void setProtected(boolean p)
Sets the protected (ie. read only) status of this sheet- Parameters:
p
- the protected status
-
setHeaderMargin
public void setHeaderMargin(double d)
Sets the margin for any page headers- Parameters:
d
- the margin in inches
-
getHeaderMargin
public double getHeaderMargin()
Accessor for the header margin- Returns:
- the header margin
-
setFooterMargin
public void setFooterMargin(double d)
Sets the margin for any page footer- Parameters:
d
- the footer margin in inches
-
getFooterMargin
public double getFooterMargin()
Accessor for the footer margin- Returns:
- the footer margin
-
setHidden
public void setHidden(boolean h)
Sets the hidden status of this worksheet- Parameters:
h
- the hidden flag
-
isHidden
public boolean isHidden()
Accessor for the hidden nature of this sheet- Returns:
- TRUE if this sheet is hidden, FALSE otherwise
-
setSelected
public void setSelected()
Deprecated.use overloaded version which takes a booleanSets 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
-
isSelected
public boolean isSelected()
Accessor for the selected nature of the sheet- Returns:
- TRUE if this sheet is selected, FALSE otherwise
-
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
-
getScaleFactor
public int getScaleFactor()
Accessor for the scale factor- Returns:
- the scale factor
-
setPageStart
public void setPageStart(int ps)
Sets the page number at which to commence printing- Parameters:
ps
- the page start number
-
getPageStart
public int getPageStart()
Accessor for the page start- Returns:
- the page start
-
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
-
getFitWidth
public int getFitWidth()
Accessor for the fit width- Returns:
- the number of pages this sheet will be printed into widthwise
-
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
-
getFitHeight
public int getFitHeight()
Accessor for the fit height- Returns:
- the number of pages this sheet will be printed into heightwise
-
setHorizontalPrintResolution
public void setHorizontalPrintResolution(int hpw)
Sets the horizontal print resolution- Parameters:
hpw
- the print resolution
-
getHorizontalPrintResolution
public int getHorizontalPrintResolution()
Accessor for the horizontal print resolution- Returns:
- the horizontal print resolution
-
setVerticalPrintResolution
public void setVerticalPrintResolution(int vpw)
Sets the vertical print reslution- Parameters:
vpw
- the vertical print resolution
-
getVerticalPrintResolution
public int getVerticalPrintResolution()
Accessor for the vertical print resolution- Returns:
- the vertical print resolution
-
setRightMargin
public void setRightMargin(double m)
Sets the right margin- Parameters:
m
- the right margin in inches
-
getRightMargin
public double getRightMargin()
Accessor for the right margin- Returns:
- the right margin in inches
-
setLeftMargin
public void setLeftMargin(double m)
Sets the left margin- Parameters:
m
- the left margin in inches
-
getLeftMargin
public double getLeftMargin()
Accessor for the left margin- Returns:
- the left margin in inches
-
setTopMargin
public void setTopMargin(double m)
Sets the top margin- Parameters:
m
- the top margin in inches
-
getTopMargin
public double getTopMargin()
Accessor for the top margin- Returns:
- the top margin in inches
-
setBottomMargin
public void setBottomMargin(double m)
Sets the bottom margin- Parameters:
m
- the bottom margin in inches
-
getBottomMargin
public double getBottomMargin()
Accessor for the bottom margin- Returns:
- the bottom margin in inches
-
getDefaultWidthMargin
public double getDefaultWidthMargin()
Gets the default margin width- Returns:
- the default margin width
-
getDefaultHeightMargin
public double getDefaultHeightMargin()
Gets the default margin height- Returns:
- the default margin height
-
getFitToPages
public boolean getFitToPages()
Accessor for the fit width print flag- Returns:
- TRUE if the print is to fit to pages, false otherwise
-
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
-
getPassword
public java.lang.String getPassword()
Accessor for the password- Returns:
- the password to unlock this sheet, or NULL if not protected
-
setPassword
public void setPassword(java.lang.String s)
Sets the password for this sheet- Parameters:
s
- the password
-
getPasswordHash
public int getPasswordHash()
Accessor for the password hash - used only when copying sheets- Returns:
- passwordHash
-
setPasswordHash
public void setPasswordHash(int ph)
Accessor for the password hash - used only when copying sheets- Parameters:
ph
- the password hash
-
getDefaultColumnWidth
public int getDefaultColumnWidth()
Accessor for the default column width- Returns:
- the default column width, in characters
-
setDefaultColumnWidth
public void setDefaultColumnWidth(int w)
Sets the default column width- Parameters:
w
- the new default column width
-
getDefaultRowHeight
public int getDefaultRowHeight()
Accessor for the default row height- Returns:
- the default row height, in 1/20ths of a point
-
setDefaultRowHeight
public void setDefaultRowHeight(int h)
Sets the default row height- Parameters:
h
- the default row height, in 1/20ths of a point
-
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
-
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
-
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
-
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
-
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
-
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
-
getDisplayZeroValues
public boolean getDisplayZeroValues()
Accessor for the displayZeroValues property- Returns:
- TRUE to display zero values, FALSE not to bother
-
setDisplayZeroValues
public void setDisplayZeroValues(boolean b)
Sets the displayZeroValues property- Parameters:
b
- TRUE to show zero values, FALSE not to bother
-
getShowGridLines
public boolean getShowGridLines()
Accessor for the showGridLines property- Returns:
- TRUE if grid lines will be shown, FALSE otherwise
-
setShowGridLines
public void setShowGridLines(boolean b)
Sets the showGridLines property- Parameters:
b
- TRUE to show grid lines on this sheet, FALSE otherwise
-
getPageBreakPreviewMode
public boolean getPageBreakPreviewMode()
Accessor for the pageBreakPreview mode- Returns:
- TRUE if page break preview is enabled, FALSE otherwise
-
setPageBreakPreviewMode
public void setPageBreakPreviewMode(boolean b)
Sets the pageBreakPreviewMode property- Parameters:
b
- TRUE to launch in page break preview mode, FALSE otherwise
-
getPrintGridLines
public boolean getPrintGridLines()
Accessor for the printGridLines property- Returns:
- TRUE if grid lines will be printed, FALSE otherwise
-
setPrintGridLines
public void setPrintGridLines(boolean b)
Sets the printGridLines property- Parameters:
b
- TRUE to print grid lines on this sheet, FALSE otherwise
-
getPrintHeaders
public boolean getPrintHeaders()
Accessor for the printHeaders property- Returns:
- TRUE if headers will be printed, FALSE otherwise
-
setPrintHeaders
public void setPrintHeaders(boolean b)
Sets the printHeaders property- Parameters:
b
- TRUE to print headers on this sheet, FALSE otherwise
-
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
-
setHorizontalFreeze
public void setHorizontalFreeze(int row)
Sets the row at which the pane is frozen horizontally- Parameters:
row
- the row number to freeze at
-
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
-
setVerticalFreeze
public void setVerticalFreeze(int col)
Sets the row at which the pane is frozen vertically- Parameters:
col
- the column number to freeze at
-
setCopies
public void setCopies(int c)
Sets the number of copies- Parameters:
c
- the number of copies
-
getCopies
public int getCopies()
Accessor for the number of copies to print- Returns:
- the number of copies
-
getHeader
public HeaderFooter getHeader()
Accessor for the header- Returns:
- the header
-
setHeader
public void setHeader(HeaderFooter h)
Sets the header- Parameters:
h
- the header
-
setFooter
public void setFooter(HeaderFooter f)
Sets the footer- Parameters:
f
- the footer
-
getFooter
public HeaderFooter getFooter()
Accessor for the footer- Returns:
- the footer
-
isHorizontalCentre
public boolean isHorizontalCentre()
Accessor for the horizontal centre- Returns:
- Returns the horizontalCentre.
-
setHorizontalCentre
public void setHorizontalCentre(boolean horizCentre)
Sets the horizontal centre- Parameters:
horizCentre
- The horizontalCentre to set.
-
isVerticalCentre
public boolean isVerticalCentre()
Accessor for the vertical centre- Returns:
- Returns the verticalCentre.
-
setVerticalCentre
public void setVerticalCentre(boolean vertCentre)
Sets the vertical centre- Parameters:
vertCentre
- The verticalCentre to set.
-
setAutomaticFormulaCalculation
public void setAutomaticFormulaCalculation(boolean auto)
Sets the automatic formula calculation flag- Parameters:
auto
- - TRUE to automatically calculate the formulas, FALSE otherwise
-
getAutomaticFormulaCalculation
public boolean getAutomaticFormulaCalculation()
Retrieves the automatic formula calculation flag- Returns:
- TRUE if formulas are calculated automatically, FALSE if they are calculated manually
-
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
-
getRecalculateFormulasBeforeSave
public boolean getRecalculateFormulasBeforeSave()
Retrieves the recalculate formulas before save flag- Returns:
- TRUE if formulas are calculated before the sheet is saved, FALSE otherwise
-
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 areafirstRow
- the first row of the print arealastCol
- the last column of the print arealastRow
- the last row of the print area
-
getPrintArea
public Range getPrintArea()
Accessor for the print area- Returns:
- the print area, or NULL if one is not defined for this sheet
-
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 titleslastRow
- the last row of the print row titlesfirstCol
- the first column of the print column titleslastCol
- the last column of the print column titles
-
setPrintTitlesRow
public void setPrintTitlesRow(int firstRow, int lastRow)
Sets the print row titles for this sheet- Parameters:
firstRow
- the first row of the print titleslastRow
- the last row of the print titles
-
setPrintTitlesCol
public void setPrintTitlesCol(int firstCol, int lastCol)
Sets the print column titles for this sheet- Parameters:
firstRow
- the first row of the print titleslastRow
- the last row of the print titles
-
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
-
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
-
-