|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jxl.write.biff.WritableSheetImpl
A writable sheet. This class contains implementation of all the writable sheet methods which may be invoke by the API
Inner Class Summary | |
private static class |
WritableSheetImpl.ColumnInfoComparator
The comparator for column info record |
Field Summary | |
private boolean |
chartOnly
A flag indicating that this sheet is a chart only |
private java.util.TreeSet |
columnFormats
The list of non-default column formats |
private FormattingRecords |
formatRecords
A handle to workbook format records |
private java.util.ArrayList |
hyperlinks
The list of hyperlinks |
private MergedCells |
mergedCells
The list of merged ranged |
private java.lang.String |
name
The name of this sheet |
private int |
numColumns
The number of columns. |
private int |
numRows
A number of rows. |
private static int |
numRowsPerSheet
The maximum number of rows excel allows in a worksheet |
private File |
outputFile
A handle to the output file which the binary data is written to |
private java.util.ArrayList |
rowBreaks
Array of row page breaks |
private static int |
rowGrowSize
The amount by which to grow the rows array |
private RowRecord[] |
rows
The rows within this sheet |
private SheetSettings |
settings
The settings for this sheet |
private SharedStrings |
sharedStrings
A handle to the shared strings used by this workbook |
private SheetWriter |
sheetWriter
The sheet writer engine |
private WritableWorkbookImpl |
workbook
The workbook |
private WorkbookSettings |
workbookSettings
The settings for the workbook |
Constructor Summary | |
WritableSheetImpl(java.lang.String n,
File of,
FormattingRecords fr,
SharedStrings ss,
WorkbookSettings ws,
WritableWorkbookImpl ww)
Constructor |
Method Summary | |
void |
addCell(WritableCell cell)
Adds the cell to this sheet. |
void |
addHyperlink(WritableHyperlink h)
Adds the specified hyperlink |
void |
addRowPageBreak(int row)
Forces a page break at the specified row |
(package private) void |
checkMergedBorders()
Check all the merged cells for borders. |
(package private) void |
copy(Sheet s)
Copies the specified sheet, row by row and cell by cell |
(package private) void |
copy(WritableSheet s)
Copies the specified sheet, row by row and cell by cell |
private void |
copyCells(Sheet s)
Copies the cell contents from the specified sheet into this one |
Cell |
findCell(java.lang.String contents)
Gets the cell whose contents match the string passed in. |
LabelCell |
findLabelCell(java.lang.String contents)
Gets the cell whose contents match the string passed in. |
Cell |
getCell(int column,
int row)
Returns the cell specified at this row and at this column |
private Chart[] |
getCharts()
Accessor for the charts. |
Cell[] |
getColumn(int col)
Gets all the cells on the specified column |
CellFormat |
getColumnFormat(int col)
Deprecated. use getColumnView instead |
(package private) ColumnInfoRecord |
getColumnInfo(int c)
Gets the column info record for the specified column |
int |
getColumns()
Returns the number of columns in this sheet |
CellView |
getColumnView(int col)
Gets the column width for the specified column |
int |
getColumnWidth(int col)
Deprecated. use getColumnView instead |
(package private) FooterRecord |
getFooter()
Gets the footer. |
(package private) HeaderRecord |
getHeader()
Gets the header. |
Hyperlink[] |
getHyperlinks()
Gets the hyperlinks on this sheet |
Range[] |
getMergedCells()
Gets the cells which have been merged on this sheet |
java.lang.String |
getName()
Gets the name of this sheet |
Cell[] |
getRow(int row)
Gets all the cells on the specified row |
int |
getRowHeight(int row)
Deprecated. use getRowView instead |
(package private) RowRecord |
getRowInfo(int r)
Gets the row record for the specified row |
private RowRecord |
getRowRecord(int row)
Gets the row record at the specified row number, growing the array as needs dictate |
int |
getRows()
Returns the number of rows in this sheet |
CellView |
getRowView(int row)
Gets the row view for the specified row |
SheetSettings |
getSettings()
Gets the settings for this sheet |
(package private) WritableWorkbookImpl |
getWorkbook()
Accessor for the workbook |
(package private) WorkbookSettings |
getWorkbookSettings()
Gets the workbook settings |
private WorkspaceInformationRecord |
getWorkspaceOptions()
Accessor for the workspace options |
WritableCell |
getWritableCell(int column,
int row)
Returns the cell specified at this row and at this column |
WritableHyperlink[] |
getWritableHyperlinks()
Gets the writable hyperlinks on this sheet |
void |
insertColumn(int col)
Inserts a blank column into this spreadsheet. |
void |
insertRow(int row)
Inserts a blank row into this spreadsheet. |
(package private) boolean |
isChartOnly()
Accessor for the chart only method |
boolean |
isHidden()
Deprecated. in favour of the getSettings() method |
boolean |
isProtected()
Deprecated. in favour of getSettings() api |
Range |
mergeCells(int col1,
int row1,
int col2,
int row2)
Merges the specified cells. |
(package private) void |
rationalize(IndexMapping xfMapping,
IndexMapping fontMapping,
IndexMapping formatMapping)
Rationalizes the sheets xf index mapping |
void |
removeColumn(int col)
Removes a column from this spreadsheet. |
void |
removeHyperlink(WritableHyperlink h)
Removes the specified hyperlink. |
void |
removeHyperlink(WritableHyperlink h,
boolean preserveLabel)
Removes the specified hyperlink. |
void |
removeRow(int row)
Removes a row from this spreadsheet. |
void |
setColumnView(int col,
CellView view)
Sets the view for this column |
void |
setColumnView(int col,
int width)
Sets the width (in characters) for a particular column in this sheet |
void |
setColumnView(int col,
int width,
CellFormat format)
Deprecated. use the CellView bean instead |
void |
setFooter(java.lang.String l,
java.lang.String c,
java.lang.String r)
Sets the footer for this page |
void |
setHeader(java.lang.String l,
java.lang.String c,
java.lang.String r)
Sets the header for this page |
void |
setHidden(boolean h)
Deprecated. use the settings bean instead |
void |
setName(java.lang.String n)
Sets the name of this worksheet |
void |
setPageSetup(PageOrientation p)
Deprecated. use the SheetSettings bean |
void |
setPageSetup(PageOrientation p,
double hm,
double fm)
Deprecated. use the SheetSettings bean |
void |
setPageSetup(PageOrientation p,
PaperSize ps,
double hm,
double fm)
Deprecated. use the SheetSettings bean |
void |
setProtected(boolean prot)
Deprecated. use the settings bean instead |
void |
setRowView(int row,
boolean collapsed)
Sets the height of the specified row, as well as its collapse status |
void |
setRowView(int row,
int height)
Sets the height of the specified row, as well as its collapse status |
void |
setRowView(int row,
int height,
boolean collapsed)
Sets the height of the specified row, as well as its collapse status |
void |
setSelected()
Deprecated. use the settings bean |
void |
unmergeCells(Range r)
Unmerges the specified cells. |
void |
write()
Writes out this sheet. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String name
private File outputFile
private RowRecord[] rows
private FormattingRecords formatRecords
private SharedStrings sharedStrings
private java.util.TreeSet columnFormats
private java.util.ArrayList hyperlinks
private MergedCells mergedCells
private int numRows
private int numColumns
private boolean chartOnly
private java.util.ArrayList rowBreaks
private SheetSettings settings
private SheetWriter sheetWriter
private WorkbookSettings workbookSettings
private WritableWorkbookImpl workbook
private static final int rowGrowSize
private static final int numRowsPerSheet
Constructor Detail |
public WritableSheetImpl(java.lang.String n, File of, FormattingRecords fr, SharedStrings ss, WorkbookSettings ws, WritableWorkbookImpl ww)
fr
- the formatting records used by the workbookof
- the output file to write the binary dataf
- the fonts used by the workbookn
- the name of this sheetss
- the shared strings used by the workbookws
- the workbook settingsMethod Detail |
public Cell getCell(int column, int row)
getCell
in interface Sheet
column
- the column numberrow
- the row numberpublic WritableCell getWritableCell(int column, int row)
getWritableCell
in interface WritableSheet
column
- the column numberrow
- the row numberpublic int getRows()
getRows
in interface Sheet
public int getColumns()
getColumns
in interface Sheet
public Cell findCell(java.lang.String contents)
findCell
in interface Sheet
contents
- the string to matchpublic LabelCell findLabelCell(java.lang.String contents)
findLabelCell
in interface Sheet
contents
- the string to matchpublic Cell[] getRow(int row)
getRow
in interface Sheet
row
- the rows whose cells are to be returnedpublic Cell[] getColumn(int col)
getColumn
in interface Sheet
col
- the column whose cells are to be returnedpublic java.lang.String getName()
getName
in interface Sheet
public void insertRow(int row)
insertRow
in interface WritableSheet
row
- the row to insertpublic void insertColumn(int col)
insertColumn
in interface WritableSheet
col
- the column to insertpublic void removeColumn(int col)
removeColumn
in interface WritableSheet
col
- the column to removepublic void removeRow(int row)
removeRow
in interface WritableSheet
row
- the row to removepublic void addCell(WritableCell cell) throws WriteException, RowsExceededException
addCell
in interface WritableSheet
cell
- the cell to addWriteException
- RowsExceededException
- private RowRecord getRowRecord(int row) throws RowsExceededException
row
- the row number we are interested inRowsExceededException
- RowRecord getRowInfo(int r)
r
- the rowColumnInfoRecord getColumnInfo(int c)
c
- the columnpublic void setName(java.lang.String n)
setName
in interface WritableSheet
n
- the name of this sheetpublic void setHidden(boolean h)
setHidden
in interface WritableSheet
h
- the hiden flagpublic void setProtected(boolean prot)
setProtected
in interface WritableSheet
prot
- protected flagpublic void setSelected()
public boolean isHidden()
isHidden
in interface Sheet
public void setColumnView(int col, int width)
setColumnView
in interface WritableSheet
col
- the column whose width to setwidth
- the width of the column in characterspublic void setColumnView(int col, int width, CellFormat format)
setColumnView
in interface WritableSheet
col
- the column to setwidth
- the width in charactersformat
- the formt details for the columnpublic void setColumnView(int col, CellView view)
setColumnView
in interface WritableSheet
col
- the column on which to set the viewview
- the view to setpublic void setRowView(int row, int height) throws RowsExceededException
setRowView
in interface WritableSheet
row
- the row to be formattedheight
- the row height in pointsRowsExceededException
- public void setRowView(int row, boolean collapsed) throws RowsExceededException
setRowView
in interface WritableSheet
row
- the row to be formattedcollapsed
- indicates whether the row is collapsedRowsExceededException
- public void setRowView(int row, int height, boolean collapsed) throws RowsExceededException
setRowView
in interface WritableSheet
row
- the row to be formattedheight
- the row height in pointscollapsed
- indicates whether the row is collapsedzeroHeight
- indicates that the row has zero heightRowsExceededException
- public void write() throws java.io.IOException
java.io.IOException
- private void copyCells(Sheet s)
s
- the sheet to copyvoid copy(Sheet s)
s
- the sheet to copyvoid copy(WritableSheet s)
s
- the sheet to copyfinal HeaderRecord getHeader()
final FooterRecord getFooter()
public boolean isProtected()
isProtected
in interface Sheet
public Hyperlink[] getHyperlinks()
getHyperlinks
in interface Sheet
public Range[] getMergedCells()
getMergedCells
in interface Sheet
public WritableHyperlink[] getWritableHyperlinks()
getWritableHyperlinks
in interface WritableSheet
public void removeHyperlink(WritableHyperlink h)
removeHyperlink
in interface WritableSheet
h
- the hyperlink to remove.preserveLabel
- if TRUE preserves the label contents, if FALSE
removes thempublic void removeHyperlink(WritableHyperlink h, boolean preserveLabel)
removeHyperlink
in interface WritableSheet
h
- the hyperlink to remove.preserveLabel
- if TRUE preserves the label contents, if FALSE
removes thempublic void addHyperlink(WritableHyperlink h) throws WriteException, RowsExceededException
addHyperlink
in interface WritableSheet
the
- hyperlinkWriteException
- RowsExceededException
- public Range mergeCells(int col1, int row1, int col2, int row2) throws WriteException, RowsExceededException
mergeCells
in interface WritableSheet
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 celljxl.write..WriteException
- RowsExceededException
- public void unmergeCells(Range r)
unmergeCells
in interface WritableSheet
r
- the range of cells to unmergepublic void setHeader(java.lang.String l, java.lang.String c, java.lang.String r)
setHeader
in interface WritableSheet
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 sidepublic void setFooter(java.lang.String l, java.lang.String c, java.lang.String r)
setFooter
in interface WritableSheet
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 sidepublic void setPageSetup(PageOrientation p)
setPageSetup
in interface WritableSheet
p
- the page orientationpublic void setPageSetup(PageOrientation p, double hm, double fm)
setPageSetup
in interface WritableSheet
p
- the page orientationhm
- the header margin, in inchesfm
- the footer margin, in inchespublic void setPageSetup(PageOrientation p, PaperSize ps, double hm, double fm)
setPageSetup
in interface WritableSheet
p
- the page orientationps
- the paper sizehm
- the header margin, in inchesfm
- the footer margin, in inchespublic SheetSettings getSettings()
getSettings
in interface Sheet
WorkbookSettings getWorkbookSettings()
public void addRowPageBreak(int row)
addRowPageBreak
in interface WritableSheet
row
- the row to break atprivate Chart[] getCharts()
void checkMergedBorders()
private WorkspaceInformationRecord getWorkspaceOptions()
void rationalize(IndexMapping xfMapping, IndexMapping fontMapping, IndexMapping formatMapping)
xfMapping
- the index mapping for XFRecordsfontMapping
- the index mapping for fontsformatMapping
- the index mapping for formatsWritableWorkbookImpl getWorkbook()
public CellFormat getColumnFormat(int col)
getColumnFormat
in interface Sheet
col
- the column numberpublic int getColumnWidth(int col)
getColumnWidth
in interface Sheet
col
- the column numberpublic int getRowHeight(int row)
getRowHeight
in interface Sheet
row
- the column numberboolean isChartOnly()
public CellView getRowView(int row)
getRowView
in interface Sheet
col
- the row numberpublic CellView getColumnView(int col)
getColumnView
in interface Sheet
col
- the column number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |