@Internal public final class InternalSheet extends java.lang.Object
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 https://sc.openoffice.org/excelfileformat.pdf before even attempting to use this.
InternalWorkbook
,
HSSFSheet
Modifier and Type | Class and Description |
---|---|
static class |
InternalSheet.UnsupportedBOFType |
Modifier and Type | Field and Description |
---|---|
protected boolean |
_isUncalced
Add an UncalcedRecord if not true indicating formulas have not been calculated
|
protected RowRecordsAggregate |
_rowsAggregate
always present
|
protected SelectionRecord |
_selection |
static short |
BottomMargin |
protected DefaultColWidthRecord |
defaultcolwidth |
protected DefaultRowHeightRecord |
defaultrowheight |
protected GridsetRecord |
gridset |
static short |
LeftMargin |
static byte |
PANE_LOWER_LEFT |
static byte |
PANE_LOWER_RIGHT |
static byte |
PANE_UPPER_LEFT |
static byte |
PANE_UPPER_RIGHT |
protected PrintGridlinesRecord |
printGridlines |
protected PrintHeadersRecord |
printHeaders |
static short |
RightMargin |
static short |
TopMargin |
protected WindowTwoRecord |
windowTwo |
Modifier and Type | Method and Description |
---|---|
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).
|
InternalSheet |
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 InternalSheet |
createSheet()
Creates a sheet with all the usual records minus values and the "index"
record (not required).
|
static InternalSheet |
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
|
java.util.Iterator<CellValueRecordInterface> |
getCellValueIterator()
Get all the value records (from LOC).
|
int |
getColumnOutlineLevel(int columnIndex) |
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() |
int |
getMaxColumnIndex() |
CellRangeAddress |
getMergedRegionAt(int index) |
int |
getMinColumnIndex() |
RowRecord |
getNextRow()
get the NEXT RowRecord (from LOC).
|
NoteRecord[] |
getNoteRecords()
Get the
NoteRecord s (related to cell comments) for this sheet |
int |
getNumMergedRegions() |
DataValidityTable |
getOrCreateDataValidityTable() |
PageSettingsBlock |
getPageSettings() |
PaneInformation |
getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze).
|
PrintGridlinesRecord |
getPrintGridlines()
Returns the PrintGridlinesRecord.
|
PrintHeadersRecord |
getPrintHeaders()
Returns the PrintHeadersRecord.
|
WorksheetProtectionBlock |
getProtectionBlock() |
java.util.List<RecordBase> |
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() |
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() |
boolean |
isDisplayRowColHeadings()
Returns if RowColHeadings are displayed.
|
boolean |
isGridsPrinted() |
boolean |
isPrintRowColHeadings()
Returns if RowColHeadings are displayed.
|
void |
preSerialize()
Perform any work necessary before the sheet is about to be serialized.
|
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)
Set 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 |
setPrintHeaders(PrintHeadersRecord newPrintHeaders)
Sets the PrintHeadersRecord.
|
void |
setPrintRowColHeadings(boolean show)
Sets whether the RowColHeadings are shown in a viewer.
|
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 |
updateFormulasAfterCellShift(FormulaShifter shifter,
int externSheetIndex)
Updates formulas in cells and conditional formats due to moving of cells
|
void |
visitContainedRecords(RecordAggregate.RecordVisitor rv,
int offset) |
public static final short LeftMargin
public static final short RightMargin
public static final short TopMargin
public static final short BottomMargin
protected PrintGridlinesRecord printGridlines
protected PrintHeadersRecord printHeaders
protected GridsetRecord gridset
protected DefaultColWidthRecord defaultcolwidth
protected DefaultRowHeightRecord defaultrowheight
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
public static InternalSheet createSheet(RecordStream rs)
rs
- the stream to read records fromInternalWorkbook
,
Record
public InternalSheet cloneSheet()
public static InternalSheet createSheet()
public RowRecordsAggregate getRowsAggregate()
public void updateFormulasAfterCellShift(FormulaShifter shifter, int externSheetIndex)
shifter
- the formular shifterexternSheetIndex
- 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)
firstrow
- the first row indexfirstcol
- the first column indexlastrow
- the last row indexlastcol
- the last column indexDimensionsRecord
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 addedpublic void removeRow(RowRecord row)
row
- the row record to removepublic java.util.Iterator<CellValueRecordInterface> getCellValueIterator()
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.
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.
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)public int getDefaultColumnWidth()
public boolean isGridsPrinted()
true
if gridlines are printedpublic void setGridsPrinted(boolean value)
value
- True if gridlines printed.public void setDefaultColumnWidth(int dcw)
dcw
- default column widthpublic void setDefaultRowHeight(short dch)
dch
- the default row heightpublic short getDefaultRowHeight()
public int getColumnWidth(int columnIndex)
columnIndex
- indexDefaultColWidthRecord
,
ColumnInfoRecord
,
setColumnWidth(int, int)
public short getXFIndexForColAt(short columnIndex)
Returns the index to the default ExtendedFormatRecord (0xF) if no ColumnInfoRecord exists that includes the column index specified.
columnIndex
- the column indexpublic void setColumnWidth(int column, int width)
column
- -
the column numberwidth
- (in units of 1/256th of a character width)public boolean isColumnHidden(int columnIndex)
columnIndex
- column indexDefaultColWidthRecord
,
ColumnInfoRecord
,
setColumnHidden(int, 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<RecordBase> getRecords()
public GridsetRecord getGridsetRecord()
public Record findFirstRecordBySid(short sid)
sid
- the sid to search fornull
if it wasn't foundpublic void setSCLRecord(SCLRecord sclRecord)
sclRecord
- The record to set.public int findFirstRecordLocBySid(short sid)
sid
- the sid to search forpublic WindowTwoRecord getWindowTwo()
public PrintGridlinesRecord getPrintGridlines()
public void setPrintGridlines(PrintGridlinesRecord newPrintGridlines)
newPrintGridlines
- The new PrintGridlinesRecord for the sheet.public PrintHeadersRecord getPrintHeaders()
public void setPrintHeaders(PrintHeadersRecord newPrintHeaders)
newPrintHeaders
- The new PrintHeadersRecord 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)
If both colSplit and rowSplit are zero then the existing freeze pane is removed
colSplit
- Horizontal 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
- Horizontal 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()
null
if no pane configured, or the pane information.public SelectionRecord getSelection()
public void setSelection(SelectionRecord selection)
public WorksheetProtectionBlock getProtectionBlock()
WorksheetProtectionBlock
for this sheetpublic void setDisplayGridlines(boolean show)
show
- whether to show gridlines or notpublic boolean isDisplayGridlines()
true
if gridlines are displayedpublic 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 void setPrintRowColHeadings(boolean show)
show
- whether to show RowColHeadings or notpublic boolean isPrintRowColHeadings()
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 groupRowRange(int fromRow, int toRow, boolean indent)
public DataValidityTable getOrCreateDataValidityTable()
public NoteRecord[] getNoteRecords()
NoteRecord
s (related to cell comments) for this sheetnull
, typically empty arraypublic int getColumnOutlineLevel(int columnIndex)
public int getMinColumnIndex()
public int getMaxColumnIndex()
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.