Package jxl.write
Interface WritableSheet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddCell(WritableCell cell)Adds a cell to this sheet The RowsExceededException may be caught if client code wishes to explicitly trap the case where too many rows have been written to the current sheet.voidaddColumnPageBreak(int col)Forces a page break at the specified columnvoidaddHyperlink(WritableHyperlink h)Adds the specified hyperlink.voidaddImage(WritableImage image)Adds an image to the sheetvoidaddRowPageBreak(int row)Forces a page break at the specified rowvoidapplySharedDataValidation(WritableCell cell, int col, int row)Extend the data validation contained in the specified cell across and downwards.WritableImagegetImage(int i)Accessor for the imageintgetNumberOfImages()Accessor for the number of images on the sheetWritableCellgetWritableCell(int column, int row)Gets the writable cell from this sheet.WritableCellgetWritableCell(java.lang.String loc)Returns the cell for the specified location eg.WritableHyperlink[]getWritableHyperlinks()Gets the writable hyperlinks from this sheet.voidinsertColumn(int col)Inserts a blank column into this spreadsheet.voidinsertRow(int row)Inserts a blank row into this spreadsheet.RangemergeCells(int col1, int row1, int col2, int row2)Merges the specified cells.voidremoveColumn(int col)Removes a column from this spreadsheet.voidremoveHyperlink(WritableHyperlink h)Removes the specified hyperlink.voidremoveHyperlink(WritableHyperlink h, boolean preserveLabel)Removes the specified hyperlink.voidremoveImage(WritableImage wi)Removes the specified image from the sheet.voidremoveRow(int row)Removes a row from this spreadsheet.voidremoveSharedDataValidation(WritableCell cell)Remove the shared data validation from multiple cells.voidsetColumnGroup(int col1, int col2, boolean collapsed)Sets a column groupingvoidsetColumnView(int col, int width)Sets the width of the column on this sheet, in characters.voidsetColumnView(int col, int width, CellFormat format)Deprecated.Use the CellView bean insteadvoidsetColumnView(int col, CellView view)Sets the view for this columnvoidsetFooter(java.lang.String l, java.lang.String c, java.lang.String r)Deprecated.use the SheetSettings beanvoidsetHeader(java.lang.String l, java.lang.String c, java.lang.String r)Deprecated.use the SheetSettings beanvoidsetHidden(boolean hidden)Deprecated.use the SheetSettings bean insteadvoidsetName(java.lang.String name)Sets the name of this sheetvoidsetPageSetup(PageOrientation p)Sets the page setup detailsvoidsetPageSetup(PageOrientation p, double hm, double fm)Sets the page setup detailsvoidsetPageSetup(PageOrientation p, PaperSize ps, double hm, double fm)Sets the page setup detailsvoidsetProtected(boolean prot)Deprecated.use the SheetSettings bean insteadvoidsetRowGroup(int row1, int row2, boolean collapsed)Sets a row groupingvoidsetRowView(int row, boolean collapsed)Sets the properties of the specified rowvoidsetRowView(int row, int height)Sets the height of the specified row, as well as its collapse statusvoidsetRowView(int row, int height, boolean collapsed)Sets the height of the specified row, as well as its collapse statusvoidsetRowView(int row, CellView view)Sets the view for this columnvoidunmergeCells(Range r)Unmerges the specified cells.voidunsetColumnGroup(int col1, int col2)Unsets a column groupingvoidunsetRowGroup(int row1, int row2)Unsets a row grouping-
Methods inherited from interface jxl.Sheet
findCell, findCell, findCell, findLabelCell, getCell, getCell, getColumn, getColumnFormat, getColumnPageBreaks, getColumns, getColumnView, getColumnWidth, getDrawing, getHyperlinks, getMergedCells, getName, getRow, getRowHeight, getRowPageBreaks, getRows, getRowView, getSettings, isHidden, isProtected
-
-
-
-
Method Detail
-
addCell
void addCell(WritableCell cell) throws WriteException, jxl.write.biff.RowsExceededException
Adds a cell to this sheet The RowsExceededException may be caught if client code wishes to explicitly trap the case where too many rows have been written to the current sheet. If this behaviour is not desired, it is sufficient simply to handle the WriteException, since this is a base class of RowsExceededException- Parameters:
cell- the cell to add- Throws:
jxl.write.biff.RowsExceededExceptionWriteException
-
setName
void setName(java.lang.String name)
Sets the name of this sheet- Parameters:
name- the name of the sheet
-
setHidden
void setHidden(boolean hidden)
Deprecated.use the SheetSettings bean insteadIndicates whether or not this sheet is hidden- Parameters:
hidden- hidden flag
-
setProtected
void setProtected(boolean prot)
Deprecated.use the SheetSettings bean insteadIndicates whether or not this sheet is protected- Parameters:
prot- Protected flag
-
setColumnView
void setColumnView(int col, int width)Sets the width of the column on this sheet, in characters. This causes Excel to resize the entire column. If the columns specified already has view information associated with it, then it is replaced by the new data- Parameters:
col- the column to be formattedwidth- the width of the column
-
setColumnView
void setColumnView(int col, int width, CellFormat format)Deprecated.Use the CellView bean insteadSets the width and style of every cell in the specified column. If the columns specified already has view information associated with it, then it is replaced by the new data- Parameters:
col- the column to be formattedformat- the format of every cell in the columnwidth- the width of the column, in characters
-
setColumnView
void setColumnView(int col, CellView view)Sets the view for this column- Parameters:
col- the column on which to set the viewview- the view to set
-
setRowView
void setRowView(int row, int height) throws jxl.write.biff.RowsExceededExceptionSets the height of the specified row, as well as its collapse status- Parameters:
row- the row to be formattedheight- the row height in characters- Throws:
jxl.write.biff.RowsExceededException
-
setRowView
void setRowView(int row, boolean collapsed) throws jxl.write.biff.RowsExceededExceptionSets the properties of the specified row- Parameters:
row- the row to be formattedcollapsed- indicates whether the row is collapsed- Throws:
jxl.write.biff.RowsExceededException
-
setRowView
void setRowView(int row, int height, boolean collapsed) throws jxl.write.biff.RowsExceededExceptionSets the height of the specified row, as well as its collapse status- Parameters:
row- the row to be formattedheight- the row height in 1/20th of a pointcollapsed- indicates whether the row is collapsed- Throws:
jxl.write.biff.RowsExceededException
-
setRowView
void setRowView(int row, CellView view) throws jxl.write.biff.RowsExceededExceptionSets the view for this column- Parameters:
row- the column on which to set the viewview- the view to set- Throws:
jxl.write.biff.RowsExceededException
-
getWritableCell
WritableCell getWritableCell(int column, int row)
Gets the writable cell from this sheet. Use of this method allows the returned cell to be modified by the users application- Parameters:
column- the columnrow- the row- Returns:
- the cell at the specified position
-
getWritableCell
WritableCell getWritableCell(java.lang.String loc)
Returns the cell for the specified location eg. "A4". Note that this method is identical to calling getCell(CellReferenceHelper.getColumn(loc), CellReferenceHelper.getRow(loc)) and its implicit performance overhead for string parsing. As such,this method should therefore be used sparingly- Parameters:
loc- the cell reference- Returns:
- the cell at the specified co-ordinates
-
getWritableHyperlinks
WritableHyperlink[] getWritableHyperlinks()
Gets the writable hyperlinks from this sheet. The hyperlinks that are returned may be modified by user applications- Returns:
- the writable hyperlinks
-
insertRow
void insertRow(int row)
Inserts a blank row into this spreadsheet. If the row is out of range of the rows in the sheet, then no action is taken- Parameters:
row- the row to insert
-
insertColumn
void insertColumn(int col)
Inserts a blank column into this spreadsheet. If the column is out of range of the columns in the sheet, then no action is taken- Parameters:
col- the column to insert
-
removeColumn
void removeColumn(int col)
Removes a column from this spreadsheet. If the column is out of range of the columns in the sheet, then no action is taken- Parameters:
col- the column to remove
-
removeRow
void removeRow(int row)
Removes a row from this spreadsheet. If the row is out of range of the columns in the sheet, then no action is taken- Parameters:
row- the row to remove
-
mergeCells
Range mergeCells(int col1, int row1, int col2, int row2) throws WriteException, jxl.write.biff.RowsExceededException
Merges the specified cells. Any clashes or intersections between merged cells are resolved when the spreadsheet is written out- Parameters:
col1- the column number of the top left cellrow1- the row number of the top left cellcol2- the column number of the bottom right cellrow2- the row number of the bottom right cell- Returns:
- the Range object representing the merged cells
- Throws:
jxl.write.biff.RowsExceededExceptionWriteException
-
setRowGroup
void setRowGroup(int row1, int row2, boolean collapsed) throws WriteException, jxl.write.biff.RowsExceededExceptionSets a row grouping- Parameters:
row1- the first row of the grouprow2- the last row of the groupcollapsed- should the group be collapsed?- Throws:
WriteExceptionjxl.write.biff.RowsExceededException
-
unsetRowGroup
void unsetRowGroup(int row1, int row2) throws WriteException, jxl.write.biff.RowsExceededExceptionUnsets a row grouping- Parameters:
row1- the first row to unsetrow2- the last row to unset- Throws:
WriteExceptionjxl.write.biff.RowsExceededException
-
setColumnGroup
void setColumnGroup(int col1, int col2, boolean collapsed) throws WriteException, jxl.write.biff.RowsExceededExceptionSets a column grouping- Parameters:
col1- the first column of the groupcol2- the last column of the groupcollapsed- should the group be collapsed?- Throws:
WriteExceptionjxl.write.biff.RowsExceededException
-
unsetColumnGroup
void unsetColumnGroup(int col1, int col2) throws WriteException, jxl.write.biff.RowsExceededExceptionUnsets a column grouping- Parameters:
col1- the first column to unsetcol2- the last column to unset- Throws:
WriteExceptionjxl.write.biff.RowsExceededException
-
unmergeCells
void unmergeCells(Range r)
Unmerges the specified cells. The Range passed in should be one that has been previously returned as a result of the getMergedCells method- Parameters:
r- the range of cells to unmerge
-
addHyperlink
void addHyperlink(WritableHyperlink h) throws WriteException, jxl.write.biff.RowsExceededException
Adds the specified hyperlink. Adding a hyperlink causes any populated cells in the range of the hyperlink to be set to empty If the cells which activate this hyperlink clash with any other cells, they are still added to the worksheet and it is left to Excel to handle this.- Parameters:
h- the hyperlink- Throws:
jxl.write.biff.RowsExceededExceptionWriteException
-
removeHyperlink
void removeHyperlink(WritableHyperlink h)
Removes the specified hyperlink. Note that if you merely set the cell contents to be an Empty cell, then the cells containing the hyperlink will still be active. The contents of the cell which activate the hyperlink are removed. The hyperlink passed in must be a hyperlink retrieved using the getHyperlinks method- Parameters:
h- the hyperlink to remove.
-
removeHyperlink
void removeHyperlink(WritableHyperlink h, boolean preserveLabel)
Removes the specified hyperlink. Note that if you merely set the cell contents to be an Empty cell, then the cells containing the hyperlink will still be active. If the preserveLabel field is set, the cell contents of the hyperlink are preserved, although the hyperlink is deactivated. If this value is FALSE, the cell contents are removed The hyperlink passed in must be a hyperlink retrieved using the getHyperlinks method- Parameters:
h- the hyperlink to remove.preserveLabel- if TRUE preserves the label contents, if FALSE removes them
-
setHeader
void setHeader(java.lang.String l, java.lang.String c, java.lang.String r)Deprecated.use the SheetSettings beanSets the header for this page- Parameters:
l- the print header to print on the left sidec- the print header to print in the centrer- the print header to print on the right hand side
-
setFooter
void setFooter(java.lang.String l, java.lang.String c, java.lang.String r)Deprecated.use the SheetSettings beanSets the footer for this page- Parameters:
l- the print header to print on the left sidec- the print header to print in the centrer- the print header to print on the right hand side
-
setPageSetup
void setPageSetup(PageOrientation p)
Sets the page setup details- Parameters:
p- the page orientation
-
setPageSetup
void setPageSetup(PageOrientation p, double hm, double fm)
Sets the page setup details- Parameters:
p- the page orientationhm- the header margin, in inchesfm- the footer margin, in inches
-
setPageSetup
void setPageSetup(PageOrientation p, PaperSize ps, double hm, double fm)
Sets the page setup details- Parameters:
p- the page orientationps- the paper sizehm- the header margin, in inchesfm- the footer margin, in inches
-
addRowPageBreak
void addRowPageBreak(int row)
Forces a page break at the specified row- Parameters:
row- the row to break at
-
addColumnPageBreak
void addColumnPageBreak(int col)
Forces a page break at the specified column- Parameters:
col- the column to break at
-
addImage
void addImage(WritableImage image)
Adds an image to the sheet- Parameters:
image- the image to add
-
getNumberOfImages
int getNumberOfImages()
Accessor for the number of images on the sheet- Specified by:
getNumberOfImagesin interfaceSheet- Returns:
- the number of images on this sheet
-
getImage
WritableImage getImage(int i)
Accessor for the image- Parameters:
i- the 0 based image number- Returns:
- the image at the specified position
-
removeImage
void removeImage(WritableImage wi)
Removes the specified image from the sheet. The image passed in must be the same instance as that previously retrieved using the getImage() method- Parameters:
wi- the image to remove
-
applySharedDataValidation
void applySharedDataValidation(WritableCell cell, int col, int row) throws WriteException
Extend the data validation contained in the specified cell across and downwards. NOTE: The source cell (top left) must have been added to the sheet prior to this method being called- Parameters:
col- the number of cells accross to apply this data validationrow- the number of cells downwards to apply this data validation- Throws:
WriteException
-
removeSharedDataValidation
void removeSharedDataValidation(WritableCell cell) throws WriteException
Remove the shared data validation from multiple cells. The cell passed in is the top left cell. The data validation is removed from this cell and all cells which share the same validation.- Parameters:
cell- the top left cell containing the shared data validation- Throws:
WriteException
-
-