|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.hssf.model.Sheet
public final class Sheet
Low level model implementation of a Sheet (one workbook contains many sheets) This file contains the low level binary records starting at the sheets BOF and ending with the sheets EOF. Use HSSFSheet for a high level representation.
The structures of the highlevel API use references to this to perform most of their operations. Its probably unwise to use these low level structures directly unless you really know what you're doing. I recommend you read the Microsoft Excel 97 Developer's Kit (Microsoft Press) and the documentation at http://sc.openoffice.org/excelfileformat.pdf before even attempting to use this.
Workbook
,
HSSFSheet
Field Summary | |
---|---|
protected boolean |
_isUncalced
Add an UncalcedRecord if not true indicating formulas have not been calculated |
protected RowRecordsAggregate |
_rowsAggregate
always present |
static short |
BottomMargin
|
protected DefaultColWidthRecord |
defaultcolwidth
|
protected DefaultRowHeightRecord |
defaultrowheight
|
protected GridsetRecord |
gridset
|
static short |
LeftMargin
|
protected ObjectProtectRecord |
objprotect
|
static byte |
PANE_LOWER_LEFT
|
static byte |
PANE_LOWER_RIGHT
|
static byte |
PANE_UPPER_LEFT
|
static byte |
PANE_UPPER_RIGHT
|
protected PasswordRecord |
password
|
protected PrintGridlinesRecord |
printGridlines
|
protected ProtectRecord |
protect
|
protected java.util.ArrayList |
records
|
static short |
RightMargin
|
protected ScenarioProtectRecord |
scenprotect
|
protected SelectionRecord |
selection
|
static short |
TopMargin
|
protected WindowTwoRecord |
windowTwo
|
Method Summary | |
---|---|
int |
addMergedRegion(int rowFrom,
int colFrom,
int rowTo,
int colTo)
|
void |
addRow(RowRecord row)
Adds a row record to the sheet |
void |
addValueRecord(int row,
CellValueRecordInterface col)
Adds a value record to the sheet's contained binary records (i.e. |
int |
aggregateDrawingRecords(DrawingManager2 drawingManager,
boolean createIfMissing)
Finds the DrawingRecord for our sheet, and attaches it to the DrawingManager (which knows about the overall DrawingGroup for our workbook). |
Sheet |
cloneSheet()
Clones the low level records of this sheet and returns the new sheet instance. |
void |
createFreezePane(int colSplit,
int rowSplit,
int topRow,
int leftmostColumn)
Creates a split (freezepane). |
static Sheet |
createSheet()
Creates a sheet with all the usual records minus values and the "index" record (not required). |
static Sheet |
createSheet(RecordStream rs)
read support (offset used as starting point for search) for low level API. |
void |
createSplitPane(int xSplitPos,
int ySplitPos,
int topRow,
int leftmostColumn,
int activePane)
Creates a split pane. |
Record |
findFirstRecordBySid(short sid)
Returns the first occurrence of a record matching a particular sid. |
int |
findFirstRecordLocBySid(short sid)
Finds the first occurrence of a record matching a particular sid and returns it's position. |
short |
getActiveCellCol()
|
int |
getActiveCellRow()
Returns the active row |
int |
getColumnWidth(int columnIndex)
get the width of a given column in units of 1/256th of a character width |
ConditionalFormattingTable |
getConditionalFormattingTable()
|
int |
getDefaultColumnWidth()
get the default column width for the sheet (if the columns do not define their own width) |
short |
getDefaultRowHeight()
get the default row height for the sheet (if the rows do not define their own height) |
GridsetRecord |
getGridsetRecord()
Gets the gridset record for this sheet. |
short |
getLeftCol()
|
CellRangeAddress |
getMergedRegionAt(int index)
|
RowRecord |
getNextRow()
get the NEXT RowRecord (from LOC). |
int |
getNumMergedRegions()
|
DataValidityTable |
getOrCreateDataValidityTable()
|
PageSettingsBlock |
getPageSettings()
|
PaneInformation |
getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze). |
PasswordRecord |
getPassword()
Returns the PasswordRecord. |
PrintGridlinesRecord |
getPrintGridlines()
Returns the PrintGridlinesRecord. |
ProtectRecord |
getProtect()
Returns the ProtectRecord. |
java.util.List |
getRecords()
|
RowRecord |
getRow(int rownum)
get the NEXT (from LOC) RowRecord where rownumber matches the given rownum. |
RowRecordsAggregate |
getRowsAggregate()
|
SelectionRecord |
getSelection()
|
short |
getTopRow()
|
boolean |
getUncalced()
|
CellValueRecordInterface[] |
getValueRecords()
get the NEXT value record (from LOC). |
WindowTwoRecord |
getWindowTwo()
|
short |
getXFIndexForColAt(short columnIndex)
get the index to the ExtendedFormatRecord "associated" with the column at specified 0-based index. |
void |
groupColumnRange(int fromColumn,
int toColumn,
boolean indent)
Creates an outline group for the specified columns. |
void |
groupRowRange(int fromRow,
int toRow,
boolean indent)
|
boolean |
isColumnHidden(int columnIndex)
Get the hidden property for a given column. |
boolean |
isDisplayFormulas()
Returns if formulas are displayed. |
boolean |
isDisplayGridlines()
Returns if gridlines are displayed. |
boolean |
isDisplayRowColHeadings()
Returns if RowColHeadings are displayed. |
boolean |
isGridsPrinted()
get whether gridlines are printed. |
boolean[] |
isProtected()
|
void |
preSerialize()
Perform any work necessary before the sheet is about to be serialized. |
void |
protectSheet(java.lang.String password,
boolean objects,
boolean scenarios)
protect a spreadsheet with a password (not encypted, just sets protect flags and the password. |
void |
removeMergedRegion(int index)
|
void |
removeRow(RowRecord row)
Removes a row record This method is not loc sensitive, it resets loc to = dimsloc so no worries. |
void |
removeValueRecord(int row,
CellValueRecordInterface col)
remove a value record from the records array. |
void |
replaceValueRecord(CellValueRecordInterface newval)
replace a value record from the records array. |
void |
setActiveCellCol(short col)
Sets the active column |
void |
setActiveCellRow(int row)
Sets the active row |
void |
setColumnGroupCollapsed(int columnNumber,
boolean collapsed)
|
void |
setColumnHidden(int column,
boolean hidden)
Get the hidden property for a given column. |
void |
setColumnWidth(int column,
int width)
set the width for a given column in 1/256th of a character width units |
void |
setDefaultColumnStyle(int column,
int styleIndex)
|
void |
setDefaultColumnWidth(int dcw)
set the default column width for the sheet (if the columns do not define their own width) |
void |
setDefaultRowHeight(short dch)
set the default row height for the sheet (if the rows do not define their own height) |
void |
setDimensions(int firstrow,
short firstcol,
int lastrow,
short lastcol)
Per an earlier reported bug in working with Andy Khan's excel read library. |
void |
setDisplayFormulas(boolean show)
Sets whether the formulas are shown in a viewer. |
void |
setDisplayGridlines(boolean show)
/** Sets whether the gridlines are shown in a viewer. |
void |
setDisplayRowColHeadings(boolean show)
Sets whether the RowColHeadings are shown in a viewer. |
void |
setGridsPrinted(boolean value)
set whether gridlines printed or not. |
void |
setLeftCol(short leftCol)
Sets the left column to show in desktop window pane. |
void |
setPrintGridlines(PrintGridlinesRecord newPrintGridlines)
Sets the PrintGridlinesRecord. |
void |
setSCLRecord(SCLRecord sclRecord)
Sets the SCL record or creates it in the correct place if it does not already exist. |
void |
setSelected(boolean sel)
Sets whether the sheet is selected |
void |
setSelection(SelectionRecord selection)
|
void |
setTopRow(short topRow)
|
void |
setUncalced(boolean uncalced)
|
void |
unprotectSheet(boolean sheet,
boolean objects,
boolean scenarios)
unprotect objects in the sheet (will not protect them, but any set to false are unprotected. |
void |
updateFormulasAfterCellShift(FormulaShifter shifter,
int externSheetIndex)
Updates formulas in cells and conditional formats due to moving of cells |
void |
visitContainedRecords(RecordAggregate.RecordVisitor rv,
int offset)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short LeftMargin
public static final short RightMargin
public static final short TopMargin
public static final short BottomMargin
protected java.util.ArrayList records
protected PrintGridlinesRecord printGridlines
protected GridsetRecord gridset
protected DefaultColWidthRecord defaultcolwidth
protected DefaultRowHeightRecord defaultrowheight
protected ProtectRecord protect
protected ObjectProtectRecord objprotect
protected ScenarioProtectRecord scenprotect
protected PasswordRecord password
protected WindowTwoRecord windowTwo
protected SelectionRecord selection
protected final RowRecordsAggregate _rowsAggregate
protected boolean _isUncalced
public static final byte PANE_LOWER_RIGHT
public static final byte PANE_UPPER_RIGHT
public static final byte PANE_LOWER_LEFT
public static final byte PANE_UPPER_LEFT
Method Detail |
---|
public static Sheet createSheet(RecordStream rs)
inRecs
- array containing those records in the sheet in sequence (normally obtained from RecordFactory)sheetnum
- integer specifying the sheet's number (0,1 or 2 in this release)offset
- of the sheet's BOF record
Workbook
,
Record
public Sheet cloneSheet()
public static Sheet createSheet()
public RowRecordsAggregate getRowsAggregate()
public void updateFormulasAfterCellShift(FormulaShifter shifter, int externSheetIndex)
externSheetIndex
- the externSheet index of this sheetpublic int addMergedRegion(int rowFrom, int colFrom, int rowTo, int colTo)
public void removeMergedRegion(int index)
public CellRangeAddress getMergedRegionAt(int index)
public int getNumMergedRegions()
public ConditionalFormattingTable getConditionalFormattingTable()
public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol)
DimensionsRecord
public void visitContainedRecords(RecordAggregate.RecordVisitor rv, int offset)
public void addValueRecord(int row, CellValueRecordInterface col)
This method is "loc" sensitive. Meaning you need to set LOC to where you want it to start searching. If you don't know do this: setLoc(getDimsLoc). When adding several rows you can just start at the last one by leaving loc at what this sets it to.
row
- the row to add the cell value tocol
- the cell value record itself.public void removeValueRecord(int row, CellValueRecordInterface col)
row
- - the row of the value record you wish to removecol
- - a record supporting the CellValueRecordInterface.CellValueRecordInterface
public void replaceValueRecord(CellValueRecordInterface newval)
newval
- - a record supporting the CellValueRecordInterface. this will replace
the cell value with the same row and column. If there isn't one, one will
be added.public void addRow(RowRecord row)
This method is "loc" sensitive. Meaning you need to set LOC to where you want it to start searching. If you don't know do this: setLoc(getDimsLoc). When adding several rows you can just start at the last one by leaving loc at what this sets it to.
row
- the row record to be added#setLoc(int)
public void removeRow(RowRecord row)
row
- the row record to removepublic CellValueRecordInterface[] getValueRecords()
This method is "loc" sensitive. Meaning you need to set LOC to where you want it to start searching. If you don't know do this: setLoc(getDimsLoc). When adding several rows you can just start at the last one by leaving loc at what this sets it to. For this method, set loc to dimsloc to start with, subsequent calls will return values in (physical) sequence or NULL when you get to the end.
#setLoc(int)
public RowRecord getNextRow()
This method is "loc" sensitive. Meaning you need to set LOC to where you want it to start searching. If you don't know do this: setLoc(getDimsLoc). When adding several rows you can just start at the last one by leaving loc at what this sets it to. For this method, set loc to dimsloc to start with. subsequent calls will return rows in (physical) sequence or NULL when you get to the end.
#setLoc(int)
public RowRecord getRow(int rownum)
This method is "loc" sensitive. Meaning you need to set LOC to where you want it to start searching. If you don't know do this: setLoc(getDimsLoc). When adding several rows you can just start at the last one by leaving loc at what this sets it to. For this method, set loc to dimsloc to start with. subsequent calls will return rows in (physical) sequence or NULL when you get to the end.
rownum
- which row to return (careful with LOC)
#setLoc(int)
public int getDefaultColumnWidth()
public boolean isGridsPrinted()
public void setGridsPrinted(boolean value)
value
- True if gridlines printed.public void setDefaultColumnWidth(int dcw)
dcw
- default column widthpublic void setDefaultRowHeight(short dch)
public short getDefaultRowHeight()
public int getColumnWidth(int columnIndex)
columnIndex
- index
DefaultColWidthRecord
,
ColumnInfoRecord
,
#setColumnWidth(short,short)
public short getXFIndexForColAt(short columnIndex)
columnIndex
-
public void setColumnWidth(int column, int width)
column
- -
the column numberwidth
- (in units of 1/256th of a character width)public boolean isColumnHidden(int columnIndex)
column
- index
DefaultColWidthRecord
,
ColumnInfoRecord
,
#setColumnHidden(short,boolean)
public void setColumnHidden(int column, boolean hidden)
column
- - the column numberhidden
- - whether the column is hidden or notpublic void setDefaultColumnStyle(int column, int styleIndex)
public void groupColumnRange(int fromColumn, int toColumn, boolean indent)
fromColumn
- group from this column (inclusive)toColumn
- group to this column (inclusive)indent
- if true the group will be indented by one level,
if false indenting will be removed by one level.public short getTopRow()
public void setTopRow(short topRow)
public void setLeftCol(short leftCol)
leftCol
- the left column to show in desktop window panepublic short getLeftCol()
public int getActiveCellRow()
SelectionRecord
public void setActiveCellRow(int row)
row
- the row indexSelectionRecord
public short getActiveCellCol()
SelectionRecord
public void setActiveCellCol(short col)
col
- the column indexSelectionRecord
public java.util.List getRecords()
public GridsetRecord getGridsetRecord()
public Record findFirstRecordBySid(short sid)
public void setSCLRecord(SCLRecord sclRecord)
sclRecord
- The record to set.public int findFirstRecordLocBySid(short sid)
sid
- the sid to search for
public WindowTwoRecord getWindowTwo()
public PrintGridlinesRecord getPrintGridlines()
public void setPrintGridlines(PrintGridlinesRecord newPrintGridlines)
newPrintGridlines
- The new PrintGridlinesRecord for the sheet.public void setSelected(boolean sel)
sel
- True to select the sheet, false otherwise.public void createFreezePane(int colSplit, int rowSplit, int topRow, int leftmostColumn)
colSplit
- Horizonatal position of split.rowSplit
- Vertical position of split.topRow
- Top row visible in bottom paneleftmostColumn
- Left column visible in right pane.public void createSplitPane(int xSplitPos, int ySplitPos, int topRow, int leftmostColumn, int activePane)
xSplitPos
- Horizonatal position of split (in 1/20th of a point).ySplitPos
- Vertical position of split (in 1/20th of a point).topRow
- Top row visible in bottom paneleftmostColumn
- Left column visible in right pane.activePane
- Active pane. One of: PANE_LOWER_RIGHT,
PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFTPANE_LOWER_LEFT
,
PANE_LOWER_RIGHT
,
PANE_UPPER_LEFT
,
PANE_UPPER_RIGHT
public PaneInformation getPaneInformation()
public SelectionRecord getSelection()
public void setSelection(SelectionRecord selection)
public ProtectRecord getProtect()
public PasswordRecord getPassword()
public void setDisplayGridlines(boolean show)
show
- whether to show gridlines or notpublic boolean isDisplayGridlines()
public void setDisplayFormulas(boolean show)
show
- whether to show formulas or notpublic boolean isDisplayFormulas()
public void setDisplayRowColHeadings(boolean show)
show
- whether to show RowColHeadings or notpublic boolean isDisplayRowColHeadings()
public boolean getUncalced()
public void setUncalced(boolean uncalced)
uncalced
- whether an uncalced record must be inserted or not at generationpublic int aggregateDrawingRecords(DrawingManager2 drawingManager, boolean createIfMissing)
drawingManager
- The DrawingManager2 for our workbookcreateIfMissing
- Should one be created if missing?public void preSerialize()
public PageSettingsBlock getPageSettings()
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
public void protectSheet(java.lang.String password, boolean objects, boolean scenarios)
password
- to setobjects
- are protectedscenarios
- are protectedpublic void unprotectSheet(boolean sheet, boolean objects, boolean scenarios)
sheet
- is unprotected (false = unprotect)objects
- are unprotected (false = unprotect)scenarios
- are unprotected (false = unprotect)public boolean[] isProtected()
public void groupRowRange(int fromRow, int toRow, boolean indent)
public DataValidityTable getOrCreateDataValidityTable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |