Class Sheet
- All Implemented Interfaces:
Model
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.
- Version:
- 1.0-pre
- Author:
- Andrew C. Oliver (acoliver at apache dot org), Glen Stampoultzis (glens at apache.org), Shawn Laubach (slaubach at apache dot org) Gridlines, Headers, Footers, PrintSetup, and Setting Default Column Styles, Jason Height (jheight at chariot dot net dot au) Clone support. DBCell & Index Record writing support, Brian Sanders (kestrel at burdell dot org) Active Cell support, Jean-Pierre Paris (jean-pierre.paris at m4x dot org) (Just a little)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortprotected ValueRecordsAggregateprotected PageBreakRecordprotected ColumnInfoRecordsAggregateprotected DefaultColWidthRecordprotected DefaultRowHeightRecordprotected DimensionsRecordprotected intprotected intprotected FooterRecordprotected GridsetRecordprotected HeaderRecordstatic final shortprotected Margin[]protected MergeCellsRecordprotected Listprotected intprotected ObjectProtectRecordstatic final bytestatic final bytestatic final bytestatic final byteprotected PasswordRecordprotected PrintGridlinesRecordprotected PrintSetupRecordprotected ProtectRecordprotected ArrayListstatic final shortprotected PageBreakRecordprotected RowRecordsAggregateprotected ScenarioProtectRecordprotected SelectionRecordstatic final shortprotected WindowTwoRecord -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddMergedRegion(int rowFrom, short colFrom, int rowTo, short colTo) voidAdds a row record to the sheetvoidaddValueRecord(int row, CellValueRecordInterface col) Adds a value record to the sheet's contained binary records (i.e.intaggregateDrawingRecords(DrawingManager2 drawingManager) voidcheckDimsLoc(Record rec, int recloc) in the event the record is a dimensions record, resets both the loc index and dimsloc indexClones the low level records of this sheet and returns the new sheet instance.createBlank(int row, short col) create a BLANK record (does not add it to the records contained in this sheet)protected Recordcreates the BOF recordprotected Recordcreates the CalcCount record and sets it to 0x64 (default number of iterations)protected Recordcreates the CalcMode record and sets it to 1 (automatic formula caculation)protected Recordcreates the ColumnInfo Record and sets it to a default column/widthprotected Recordcreates the DefaultColWidth Record and sets it to 8protected Recordcreates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xffprotected Recordcreates the Delta record and sets it to 0.0010 (default accuracy)protected Recordcreates the Dimensions Record and sets it to bogus values (you should set this yourself or let the high level API do it for you)protected Recordcreates the EOF recordprotected Recordcreates the Footer Record and sets it to nothing/0 lengthcreateFormula(int row, short col, String formula) Attempts to parse the formula into PTGs and create a formula record DOES NOT WORK YETvoidcreateFreezePane(int colSplit, int rowSplit, int topRow, int leftmostColumn) Creates a split (freezepane).protected Recordcreates the Gridset record and sets it to true (user has mucked with the gridlines)protected Recordcreates the Guts record and sets leftrow/topcol guttter and rowlevelmax/collevelmax to 0protected Recordcreates the HCenter Record and sets it to false (don't horizontally center)protected Recordcreates the Header Record and sets it to nothing/0 lengthprotected Recordcreates the Index record - not currently usedprotected Recordcreates the Iteration record and sets it to false (don't iteratively calculate formulas)createLabelSST(int row, short col, int index) Create a LABELSST Record (does not add it to the records contained in this sheet)protected RecordcreateNumber(int row, short col, double value) Create a NUMBER Record (does not add it to the records contained in this sheet)protected ObjectProtectRecordcreates an ObjectProtect record with protect set to false.protected PasswordRecordcreates a Password record with password set to 00.protected Recordcreates the PrintGridlines record and sets it to false (that makes for ugly sheets).protected Recordcreates the PrintHeaders record and sets it to false (we don't create headers yet so why print them)protected Recordcreates the PrintSetup Record and sets it to defaults and marks it invalidprotected Recordcreates a Protect record with protect set to false.protected Recordcreates the RefMode record and sets it to A1 Mode (default reference mode)createRow(int row) Create a row record.protected Recordcreates the SaveRecalc record and sets it to true (recalculate before saving)protected ScenarioProtectRecordcreates a ScenarioProtect record with protect set to false.protected RecordCreates the Selection record and sets it to nothing selectedstatic SheetCreates a sheet with all the usual records minus values and the "index" record (not required).static SheetcreateSheet(List records, int sheetnum) read support (offset = 0) Same as createSheet(Record[] recs, int, int) only the record offset is assumed to be 0.static SheetcreateSheet(List recs, int sheetnum, int offset) read support (offset used as starting point for search) for low level API.voidcreateSplitPane(int xSplitPos, int ySplitPos, int topRow, int leftmostColumn, int activePane) Creates a split pane.protected Recordcreates the VCenter Record and sets it to false (don't horizontally center)protected WindowTwoRecordcreates the WindowTwo Record and sets it to:protected Recordcreates the WSBoolRecord and sets its values to defaultsfindFirstRecordBySid(short sid) Returns the first occurance of a record matching a particular sid.intfindFirstRecordLocBySid(short sid) Finds the first occurance of a record matching a particular sid and returns it's position.shortReturns the active columnintReturns the active rowReturns all the column page breaksshortgetColumnWidth(short column) get the width of a given column in units of 1/20th of a point width (twips?)shortget the default column width for the sheet (if the columns do not define their own width)shortget the default row height for the sheet (if the rows do not define their own height)intget the location of the DimensionsRecord (which is the last record before the value section)intReturns the FooterRecord.Gets the gridset record for this sheet.Returns the HeaderRecord.shortintgetLoc()Returns the location pointer to the first record to look for when adding rows/valuesdoublegetMargin(short margin) Gets the size of the margin in inches.protected Margin[]Returns the array of margins.getMergedRegionAt(int index) get the NEXT RowRecord (from LOC).get the NEXT value record (from LOC).intReturns the number of column page breaksintintReturns the number of low level binary records in this sheet.intReturns the number of row page breaksReturns the information regarding the currently configured pane (split or freeze).Returns the PasswordRecord.intget the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.Returns the PrintGridlinesRecord.Returns the PrintSetupRecord.Returns the ProtectRecord.getRow(int rownum) get the NEXT (from LOC) RowRecord where rownumber matches the given rownum.Returns all the row page breaksintgetSize()shortshortgetXFIndexForColAt(short column) get the index to the ExtendedFormatRecord "associated" with the column at specified 0-based index.voidgroupColumnRange(short fromColumn, short toColumn, boolean indent) Creates an outline group for the specified columns.voidgroupRowRange(int fromRow, int toRow, boolean indent) booleanisColumnBroken(short column) Queries if the specified column has a page breakbooleanisColumnHidden(short column) Get the hidden property for a given column.booleanReturns if formulas are displayed.booleanReturns if gridlines are displayed.booleanReturns if RowColHeadings are displayed.booleanget whether gridlines are printed.boolean[]booleanisRowBroken(int row) Queries if the specified row has a page breakvoidPerform any work necessary before the sheet is about to be serialized.voidprotectSheet(String password, boolean objects, boolean scenarios) protect a spreadsheet with a password (not encypted, just sets protect flags and the password.voidremoveColumnBreak(short column) Removes a page break at the indicated columnvoidremoveMergedRegion(int index) voidRemoves a row record This method is not loc sensitive, it resets loc to = dimsloc so no worries.voidremoveRowBreak(int row) Removes a page break at the indicated rowvoidremoveValueRecord(int row, CellValueRecordInterface col) remove a value record from the records array.voidreplace a value record from the records array.intserialize(int offset, byte[] data) Serializes all records in the sheet into one big byte array.voidsetActiveCellCol(short col) Sets the active columnvoidsetActiveCellRow(int row) Sets the active rowvoidvoidsetColumn(short column, Short xfStyle, Short width, Integer level, Boolean hidden, Boolean collapsed) voidsetColumnBreak(short column, short fromRow, short toRow) Sets a page break at the indicated columnvoidsetColumnGroupCollapsed(short columnNumber, boolean collapsed) voidsetColumnHidden(short column, boolean hidden) Get the hidden property for a given column.voidsetColumnWidth(short column, short width) set the width for a given column in 1/20th of a character width unitsvoidsetDefaultColumnWidth(short dcw) set the default column width for the sheet (if the columns do not define their own width)voidsetDefaultRowHeight(short dch) set the default row height for the sheet (if the rows do not define their own height)voidsetDimensions(int firstrow, short firstcol, int lastrow, short lastcol) Per an earlier reported bug in working with Andy Khan's excel read library.voidsetDisplayFormulas(boolean show) Sets whether the formulas are shown in a viewer.voidsetDisplayGridlines(boolean show) /** Sets whether the gridlines are shown in a viewer.voidsetDisplayRowColHeadings(boolean show) Sets whether the RowColHeadings are shown in a viewer.voidsetFooter(FooterRecord newFooter) Sets the FooterRecord.voidsetGridsPrinted(boolean value) set whether gridlines printed or not.voidsetHeader(HeaderRecord newHeader) Sets the HeaderRecord.voidsetLeftCol(short leftCol) Sets the left column to show in desktop window pane.voidsetLoc(int loc) set the locator for where we should look for the next value record.voidsetMargin(short margin, double size) Sets the size of the margin in inches.voidsetPreOffset(int offset) Set the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.voidsetPrintGridlines(PrintGridlinesRecord newPrintGridlines) Sets the PrintGridlinesRecord.voidsetPrintSetup(PrintSetupRecord newPrintSetup) Sets the PrintSetupRecord.voidsetRowBreak(int row, short fromCol, short toCol) Sets a page break at the indicated rowvoidsetRowGroupCollapsed(int row, boolean collapse) voidsetSCLRecord(SCLRecord sclRecord) Sets the SCL record or creates it in the correct place if it does not already exist.voidsetSelected(boolean sel) Sets whether the sheet is selectedvoidsetSelection(SelectionRecord selection) voidsetTopRow(short topRow) voidshiftBreaks(PageBreakRecord breaks, short start, short stop, int count) Shifts all the page breaks in the range "count" number of rows/columnsvoidshiftColumnBreaks(short startingCol, short endingCol, short count) Shifts the vertical page breaks for the indicated countvoidshiftRowBreaks(int startingRow, int endingRow, int count) Shifts the horizontal page breaks for the indicated countvoidunprotectSheet(boolean sheet, boolean objects, boolean scenarios) unprotect objects in the sheet (will not protect them, but any set to false are unprotected.
-
Field Details
-
LeftMargin
public static final short LeftMargin- See Also:
-
RightMargin
public static final short RightMargin- See Also:
-
TopMargin
public static final short TopMargin- See Also:
-
BottomMargin
public static final short BottomMargin- See Also:
-
records
-
dimsloc
protected int dimsloc -
dims
-
defaultcolwidth
-
defaultrowheight
-
gridset
-
printSetup
-
header
-
printGridlines
-
windowTwo
-
merged
-
margins
-
mergedRecords
-
numMergedRegions
protected int numMergedRegions -
selection
-
columns
-
cells
-
rows
-
eofLoc
protected int eofLoc -
protect
-
rowBreaks
-
colBreaks
-
objprotect
-
scenprotect
-
password
-
PANE_LOWER_RIGHT
public static final byte PANE_LOWER_RIGHT- See Also:
-
PANE_UPPER_RIGHT
public static final byte PANE_UPPER_RIGHT- See Also:
-
PANE_LOWER_LEFT
public static final byte PANE_LOWER_LEFT- See Also:
-
PANE_UPPER_LEFT
public static final byte PANE_UPPER_LEFT- See Also:
-
-
Constructor Details
-
Sheet
public Sheet()Creates new Sheet with no intialization --useless at this point- See Also:
-
-
Method Details
-
createSheet
read support (offset used as starting point for search) for low level API. Pass in an array of Record objects, the sheet number (0 based) and a record offset (should be the location of the sheets BOF record). A Sheet object is constructed and passed back with all of its initialization set to the passed in records and references to those records held. This function is normally called via Workbook.- Parameters:
recs- 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- Returns:
- Sheet object with all values set to those read from the file
- See Also:
-
cloneSheet
Clones the low level records of this sheet and returns the new sheet instance. This method is implemented by adding methods for deep cloning to all records that can be added to a sheet. The Record object does not implement cloneable. When adding a new record, implement a public clone method if and only if the record belongs to a sheet. -
createSheet
read support (offset = 0) Same as createSheet(Record[] recs, int, int) only the record offset is assumed to be 0.- Parameters:
records- 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)- Returns:
- Sheet object
-
createSheet
Creates a sheet with all the usual records minus values and the "index" record (not required). Sets the location pointer to where the first value records should go. Use this to create a sheet from "scratch".- Returns:
- Sheet object with all values set to defaults
-
addMergedRegion
public int addMergedRegion(int rowFrom, short colFrom, int rowTo, short colTo) -
removeMergedRegion
public void removeMergedRegion(int index) -
getMergedRegionAt
-
getNumMergedRegions
public int getNumMergedRegions() -
getNumRecords
public int getNumRecords()Returns the number of low level binary records in this sheet. This adjusts things for the so called AgregateRecords.- See Also:
-
setDimensions
public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol) Per an earlier reported bug in working with Andy Khan's excel read library. This sets the values in the sheet's DimensionsRecord object to be correct. Excel doesn't really care, but we want to play nice with other libraries.- See Also:
-
setLoc
public void setLoc(int loc) set the locator for where we should look for the next value record. The algorythm will actually start here and find the correct location so you can set this to 0 and watch performance go down the tubes but it will work. After a value is set this is automatically advanced. Its also set by the create method. So you probably shouldn't mess with this unless you have a compelling reason why or the help for the method you're calling says so. Check the other methods for whether they care about the loc pointer. Many of the "modify" and "remove" methods re-initialize this to "dimsloc" which is the location of the Dimensions Record and presumably the start of the value section (at or around 19 dec).- Parameters:
loc- the record number to start at
-
getLoc
public int getLoc()Returns the location pointer to the first record to look for when adding rows/values -
setPreOffset
public void setPreOffset(int offset) Set the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.- Parameters:
offset- the offset of the sheet's BOF within the file.
-
getPreOffset
public int getPreOffset()get the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.- Returns:
- offset the offset of the sheet's BOF within the file.
-
serialize
public int serialize(int offset, byte[] data) Serializes all records in the sheet into one big byte array. Use this to write the sheet out.- Parameters:
offset- to begin write atdata- array containing the binary representation of the records in this sheet
-
createRow
Create a row record. (does not add it to the records contained in this sheet)- Parameters:
row- number- Returns:
- RowRecord created for the passed in row number
- See Also:
-
createLabelSST
Create a LABELSST Record (does not add it to the records contained in this sheet)- Parameters:
row- the row the LabelSST is a member ofcol- the column the LabelSST definesindex- the index of the string within the SST (use workbook addSSTString method)- Returns:
- LabelSSTRecord newly created containing your SST Index, row,col.
- See Also:
-
createNumber
Create a NUMBER Record (does not add it to the records contained in this sheet)- Parameters:
row- the row the NumberRecord is a member ofcol- the column the NumberRecord definesvalue- for the number record- Returns:
- NumberRecord for that row, col containing that value as added to the sheet
-
createBlank
create a BLANK record (does not add it to the records contained in this sheet)- Parameters:
row- - the row the BlankRecord is a member ofcol- - the column the BlankRecord is a member of
-
createFormula
Attempts to parse the formula into PTGs and create a formula record DOES NOT WORK YET- Parameters:
row- - the row for the formula recordcol- - the column of the formula recordformula- - a String representing the formula. To be parsed to PTGs- Returns:
- bogus/useless formula record
-
addValueRecord
Adds a value record to the sheet's contained binary records (i.e. LabelSSTRecord or NumberRecord).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.
- Parameters:
row- the row to add the cell value tocol- the cell value record itself.
-
removeValueRecord
remove a value record from the records array. This method is not loc sensitive, it resets loc to = dimsloc so no worries.- Parameters:
row- - the row of the value record you wish to removecol- - a record supporting the CellValueRecordInterface.- See Also:
-
replaceValueRecord
replace a value record from the records array. This method is not loc sensitive, it resets loc to = dimsloc so no worries.- Parameters:
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.
-
addRow
Adds a row record to the sheetThis 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.
- Parameters:
row- the row record to be added- See Also:
-
removeRow
Removes a row record This method is not loc sensitive, it resets loc to = dimsloc so no worries.- Parameters:
row- the row record to remove
-
getNextValueRecord
get the NEXT value record (from LOC). The first record that is a value record (starting at LOC) will be returned.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.
- Returns:
- CellValueRecordInterface representing the next value record or NULL if there are no more
- See Also:
-
getNextRow
get the NEXT RowRecord (from LOC). The first record that is a Row record (starting at LOC) will be returned.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.
- Returns:
- RowRecord representing the next row record or NULL if there are no more
- See Also:
-
getRow
get the NEXT (from LOC) RowRecord where rownumber matches the given rownum. The first record that is a Row record (starting at LOC) that has the same rownum as the given rownum will be returned.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.
- Parameters:
rownum- which row to return (careful with LOC)- Returns:
- RowRecord representing the next row record or NULL if there are no more
- See Also:
-
createBOF
creates the BOF record -
createIndex
creates the Index record - not currently used- Returns:
- record containing a IndexRecord
- See Also:
-
createCalcMode
creates the CalcMode record and sets it to 1 (automatic formula caculation)- Returns:
- record containing a CalcModeRecord
- See Also:
-
createCalcCount
creates the CalcCount record and sets it to 0x64 (default number of iterations)- Returns:
- record containing a CalcCountRecord
- See Also:
-
createRefMode
creates the RefMode record and sets it to A1 Mode (default reference mode)- Returns:
- record containing a RefModeRecord
- See Also:
-
createIteration
creates the Iteration record and sets it to false (don't iteratively calculate formulas)- Returns:
- record containing a IterationRecord
- See Also:
-
createDelta
creates the Delta record and sets it to 0.0010 (default accuracy)- Returns:
- record containing a DeltaRecord
- See Also:
-
createSaveRecalc
creates the SaveRecalc record and sets it to true (recalculate before saving)- Returns:
- record containing a SaveRecalcRecord
- See Also:
-
createPrintHeaders
creates the PrintHeaders record and sets it to false (we don't create headers yet so why print them)- Returns:
- record containing a PrintHeadersRecord
- See Also:
-
createPrintGridlines
creates the PrintGridlines record and sets it to false (that makes for ugly sheets). As far as I can tell this does the same thing as the GridsetRecord- Returns:
- record containing a PrintGridlinesRecord
- See Also:
-
createGridset
creates the Gridset record and sets it to true (user has mucked with the gridlines)- Returns:
- record containing a GridsetRecord
- See Also:
-
createGuts
creates the Guts record and sets leftrow/topcol guttter and rowlevelmax/collevelmax to 0- Returns:
- record containing a GutsRecordRecord
- See Also:
-
createDefaultRowHeight
creates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xff- Returns:
- record containing a DefaultRowHeightRecord
- See Also:
-
createWSBool
creates the WSBoolRecord and sets its values to defaults- Returns:
- record containing a WSBoolRecord
- See Also:
-
createHeader
creates the Header Record and sets it to nothing/0 length- Returns:
- record containing a HeaderRecord
- See Also:
-
createHCenter
creates the HCenter Record and sets it to false (don't horizontally center)- Returns:
- record containing a HCenterRecord
- See Also:
-
createVCenter
creates the VCenter Record and sets it to false (don't horizontally center)- Returns:
- record containing a VCenterRecord
- See Also:
-
createPrintSetup
creates the PrintSetup Record and sets it to defaults and marks it invalid- Returns:
- record containing a PrintSetupRecord
- See Also:
-
createDefaultColWidth
creates the DefaultColWidth Record and sets it to 8- Returns:
- record containing a DefaultColWidthRecord
- See Also:
-
createColInfo
creates the ColumnInfo Record and sets it to a default column/width- Returns:
- record containing a ColumnInfoRecord
- See Also:
-
getDefaultColumnWidth
public short getDefaultColumnWidth()get the default column width for the sheet (if the columns do not define their own width)- Returns:
- default column width
-
isGridsPrinted
public boolean isGridsPrinted()get whether gridlines are printed.- Returns:
- true if printed
-
setGridsPrinted
public void setGridsPrinted(boolean value) set whether gridlines printed or not.- Parameters:
value- True if gridlines printed.
-
setDefaultColumnWidth
public void setDefaultColumnWidth(short dcw) set the default column width for the sheet (if the columns do not define their own width)- Parameters:
dcw- default column width
-
setDefaultRowHeight
public void setDefaultRowHeight(short dch) set the default row height for the sheet (if the rows do not define their own height) -
getDefaultRowHeight
public short getDefaultRowHeight()get the default row height for the sheet (if the rows do not define their own height)- Returns:
- default row height
-
getColumnWidth
public short getColumnWidth(short column) get the width of a given column in units of 1/20th of a point width (twips?)- Parameters:
column- index- Returns:
- column width in units of 1/20th of a point (twips?)
- See Also:
-
getXFIndexForColAt
public short getXFIndexForColAt(short column) get the index to the ExtendedFormatRecord "associated" with the column at specified 0-based index. (In this case, an ExtendedFormatRecord index is actually associated with a ColumnInfoRecord which spans 1 or more columns)
Returns the index to the default ExtendedFormatRecord (0xF) if no ColumnInfoRecord exists that includes the column index specified.- Parameters:
column-- Returns:
- index of ExtendedFormatRecord associated with ColumnInfoRecord that includes the column index or the index of the default ExtendedFormatRecord (0xF)
-
setColumnWidth
public void setColumnWidth(short column, short width) set the width for a given column in 1/20th of a character width units- Parameters:
column- - the column numberwidth- (in units of 1/20th of a character width)
-
isColumnHidden
public boolean isColumnHidden(short column) Get the hidden property for a given column.- Parameters:
column- index- Returns:
- whether the column is hidden or not.
- See Also:
-
setColumnHidden
public void setColumnHidden(short column, boolean hidden) Get the hidden property for a given column.- Parameters:
column- - the column numberhidden- - whether the column is hidden or not
-
setColumn
-
setColumn
-
groupColumnRange
public void groupColumnRange(short fromColumn, short toColumn, boolean indent) Creates an outline group for the specified columns.- Parameters:
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.
-
createDimensions
creates the Dimensions Record and sets it to bogus values (you should set this yourself or let the high level API do it for you)- Returns:
- record containing a DimensionsRecord
- See Also:
-
createWindowTwo
creates the WindowTwo Record and sets it to:options = 0x6b6
toprow = 0
leftcol = 0
headercolor = 0x40
pagebreakzoom = 0x0
normalzoom = 0x0
- Returns:
- record containing a WindowTwoRecord
- See Also:
-
createSelection
Creates the Selection record and sets it to nothing selected- Returns:
- record containing a SelectionRecord
- See Also:
-
getTopRow
public short getTopRow() -
setTopRow
public void setTopRow(short topRow) -
setLeftCol
public void setLeftCol(short leftCol) Sets the left column to show in desktop window pane.- Parameters:
leftCol- the left column to show in desktop window pane
-
getLeftCol
public short getLeftCol() -
getActiveCellRow
public int getActiveCellRow()Returns the active row- Returns:
- row the active row index
- See Also:
-
setActiveCellRow
public void setActiveCellRow(int row) Sets the active row- Parameters:
row- the row index- See Also:
-
getActiveCellCol
public short getActiveCellCol()Returns the active column- Returns:
- row the active column index
- See Also:
-
setActiveCellCol
public void setActiveCellCol(short col) Sets the active column- Parameters:
col- the column index- See Also:
-
createMergedCells
-
createEOF
creates the EOF record -
getDimsLoc
public int getDimsLoc()get the location of the DimensionsRecord (which is the last record before the value section)- Returns:
- location in the array of records of the DimensionsRecord
-
checkDimsLoc
in the event the record is a dimensions record, resets both the loc index and dimsloc index -
getSize
public int getSize() -
getRecords
-
getGridsetRecord
Gets the gridset record for this sheet. -
findFirstRecordBySid
Returns the first occurance of a record matching a particular sid. -
setSCLRecord
Sets the SCL record or creates it in the correct place if it does not already exist.- Parameters:
sclRecord- The record to set.
-
findFirstRecordLocBySid
public int findFirstRecordLocBySid(short sid) Finds the first occurance of a record matching a particular sid and returns it's position.- Parameters:
sid- the sid to search for- Returns:
- the record position of the matching record or -1 if no match is made.
-
getHeader
Returns the HeaderRecord.- Returns:
- HeaderRecord for the sheet.
-
setHeader
Sets the HeaderRecord.- Parameters:
newHeader- The new HeaderRecord for the sheet.
-
getPrintSetup
Returns the PrintSetupRecord.- Returns:
- PrintSetupRecord for the sheet.
-
setPrintSetup
Sets the PrintSetupRecord.- Parameters:
newPrintSetup- The new PrintSetupRecord for the sheet.
-
getPrintGridlines
Returns the PrintGridlinesRecord.- Returns:
- PrintGridlinesRecord for the sheet.
-
setPrintGridlines
Sets the PrintGridlinesRecord.- Parameters:
newPrintGridlines- The new PrintGridlinesRecord for the sheet.
-
setSelected
public void setSelected(boolean sel) Sets whether the sheet is selected- Parameters:
sel- True to select the sheet, false otherwise.
-
getMargin
public double getMargin(short margin) Gets the size of the margin in inches.- Parameters:
margin- which margin to get- Returns:
- the size of the margin
-
setMargin
public void setMargin(short margin, double size) Sets the size of the margin in inches.- Parameters:
margin- which margin to getsize- the size of the margin
-
getEofLoc
public int getEofLoc() -
createFreezePane
public void createFreezePane(int colSplit, int rowSplit, int topRow, int leftmostColumn) Creates a split (freezepane). Any existing freezepane or split pane is overwritten.- Parameters:
colSplit- Horizonatal position of split.rowSplit- Vertical position of split.topRow- Top row visible in bottom paneleftmostColumn- Left column visible in right pane.
-
createSplitPane
public void createSplitPane(int xSplitPos, int ySplitPos, int topRow, int leftmostColumn, int activePane) Creates a split pane. Any existing freezepane or split pane is overwritten.- Parameters:
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_LEFT- See Also:
-
getPaneInformation
Returns the information regarding the currently configured pane (split or freeze).- Returns:
- null if no pane configured, or the pane information.
-
getSelection
-
setSelection
-
createProtect
creates a Protect record with protect set to false.- Returns:
- a ProtectRecord
- See Also:
-
createObjectProtect
creates an ObjectProtect record with protect set to false.- Returns:
- an ObjectProtectRecord
- See Also:
-
createScenarioProtect
creates a ScenarioProtect record with protect set to false.- Returns:
- a ScenarioProtectRecord
- See Also:
-
getProtect
Returns the ProtectRecord. If one is not contained in the sheet, then one is created. -
getPassword
Returns the PasswordRecord. If one is not contained in the sheet, then one is created. -
createPassword
creates a Password record with password set to 00.- Returns:
- a PasswordRecord
- See Also:
-
setDisplayGridlines
public void setDisplayGridlines(boolean show) /** Sets whether the gridlines are shown in a viewer.- Parameters:
show- whether to show gridlines or not
-
isDisplayGridlines
public boolean isDisplayGridlines()Returns if gridlines are displayed.- Returns:
- whether gridlines are displayed
-
setDisplayFormulas
public void setDisplayFormulas(boolean show) Sets whether the formulas are shown in a viewer.- Parameters:
show- whether to show formulas or not
-
isDisplayFormulas
public boolean isDisplayFormulas()Returns if formulas are displayed.- Returns:
- whether formulas are displayed
-
setDisplayRowColHeadings
public void setDisplayRowColHeadings(boolean show) Sets whether the RowColHeadings are shown in a viewer.- Parameters:
show- whether to show RowColHeadings or not
-
isDisplayRowColHeadings
public boolean isDisplayRowColHeadings()Returns if RowColHeadings are displayed.- Returns:
- whether RowColHeadings are displayed
-
getMargins
Returns the array of margins. If not created, will create.- Returns:
- the array of marings.
-
aggregateDrawingRecords
-
preSerialize
public void preSerialize()Perform any work necessary before the sheet is about to be serialized. For instance the escher aggregates size needs to be calculated before serialization so that the dgg record (which occurs first) can be written. -
shiftBreaks
Shifts all the page breaks in the range "count" number of rows/columns- Parameters:
breaks- The page record to be shiftedstart- Starting "main" value to shift breaksstop- Ending "main" value to shift breakscount- number of units (rows/columns) to shift by
-
setRowBreak
public void setRowBreak(int row, short fromCol, short toCol) Sets a page break at the indicated row- Parameters:
row-
-
removeRowBreak
public void removeRowBreak(int row) Removes a page break at the indicated row- Parameters:
row-
-
isRowBroken
public boolean isRowBroken(int row) Queries if the specified row has a page break- Parameters:
row-- Returns:
- true if the specified row has a page break
-
setColumnBreak
public void setColumnBreak(short column, short fromRow, short toRow) Sets a page break at the indicated column -
removeColumnBreak
public void removeColumnBreak(short column) Removes a page break at the indicated column -
isColumnBroken
public boolean isColumnBroken(short column) Queries if the specified column has a page break- Returns:
- true if the specified column has a page break
-
shiftRowBreaks
public void shiftRowBreaks(int startingRow, int endingRow, int count) Shifts the horizontal page breaks for the indicated count- Parameters:
startingRow-endingRow-count-
-
shiftColumnBreaks
public void shiftColumnBreaks(short startingCol, short endingCol, short count) Shifts the vertical page breaks for the indicated count- Parameters:
startingCol-endingCol-count-
-
getRowBreaks
Returns all the row page breaks- Returns:
- all the row page breaks
-
getNumRowBreaks
public int getNumRowBreaks()Returns the number of row page breaks- Returns:
- the number of row page breaks
-
getColumnBreaks
Returns all the column page breaks- Returns:
- all the column page breaks
-
getNumColumnBreaks
public int getNumColumnBreaks()Returns the number of column page breaks- Returns:
- the number of column page breaks
-
setColumnGroupCollapsed
public void setColumnGroupCollapsed(short columnNumber, boolean collapsed) -
protectSheet
protect a spreadsheet with a password (not encypted, just sets protect flags and the password.- Parameters:
password- to setobjects- are protectedscenarios- are protected
-
unprotectSheet
public void unprotectSheet(boolean sheet, boolean objects, boolean scenarios) unprotect objects in the sheet (will not protect them, but any set to false are unprotected.- Parameters:
sheet- is unprotected (false = unprotect)objects- are unprotected (false = unprotect)scenarios- are unprotected (false = unprotect)
-
isProtected
public boolean[] isProtected()- Returns:
- {sheet is protected, objects are proteced, scenarios are protected}
-
groupRowRange
public void groupRowRange(int fromRow, int toRow, boolean indent) -
setRowGroupCollapsed
public void setRowGroupCollapsed(int row, boolean collapse)
-