## org.apache.poi.hssf.model
Class Sheet

    java.lang.Object
      org.apache.poi.hssf.model.Sheet

All Implemented Interfaces:
  Model

public class Sheet
extends java.lang.Object
implements Model

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.

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, and PrintSetup, Jason Height (jheight at chariot dot net dot au) Clone support, Brian Sanders (kestrel at burdell dot org) Active Cell support
See Also:
  `Workbook`, `HSSFSheet`

Field Summary
`static short` `BottomMargin`
`protected ValueRecordsAggregate` `cells`
`protected PageBreakRecord` `colBreaks`
`protected ColumnInfoRecordsAggregate` `columns`
`protected boolean` `containsLabels`
`protected DefaultColWidthRecord` `defaultcolwidth`
`protected DefaultRowHeightRecord` `defaultrowheight`
`protected DimensionsRecord` `dims`
`protected int` `dimsloc`
`protected int` `eofLoc`
`protected FooterRecord` `footer`
`protected GridsetRecord` `gridset`
`protected HeaderRecord` `header`
`static short` `LeftMargin`
`protected Margin[]` `margins`
`protected MergeCellsRecord` `merged`
`protected java.util.List` `mergedRecords`
`protected int` `numMergedRegions`
`static byte` `PANE_LOWER_LEFT`
`static byte` `PANE_LOWER_RIGHT`
`static byte` `PANE_UPPER_LEFT`
`static byte` `PANE_UPPER_RIGHT`
`protected PrintGridlinesRecord` `printGridlines`
`protected PrintSetupRecord` `printSetup`
`protected ProtectRecord` `protect`
`protected java.util.ArrayList` `records`
`static short` `RightMargin`
`protected PageBreakRecord` `rowBreaks`
`protected RowRecordsAggregate` `rows`
`protected SelectionRecord` `selection`
`static short` `TopMargin`
`protected WindowTwoRecord` `windowTwo`

Constructor Summary
`Sheet()` Creates new Sheet with no intialization --useless at this point

Method Summary
`void` `addDBCellRecords()` Not currently used method to calculate and add dbcell records
`int` `addMergedRegion(int rowFrom, short colFrom, int rowTo, short 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(DrawingManager drawingManager)`
`void` `checkDimsLoc(Record rec, int recloc)` in the event the record is a dimensions record, resets both the loc index and dimsloc index
`Sheet` `cloneSheet()` Clones the low level records of this sheet and returns the new sheet instance.
`void` `convertLabelRecords(Workbook wb)` This is basically a kludge to deal with the now obsolete Label records.
`BlankRecord` `createBlank(int row, short col)` create a BLANK record (does not add it to the records contained in this sheet)
`protected Record` `createBOF()` creates the BOF record
`protected Record` `createCalcCount()` creates the CalcCount record and sets it to 0x64 (default number of iterations)
`protected Record` `createCalcMode()` creates the CalcMode record and sets it to 1 (automatic formula caculation)
`protected Record` `createColInfo()` creates the ColumnInfo Record and sets it to a default column/width
`protected Record` `createDefaultColWidth()` creates the DefaultColWidth Record and sets it to 8
`protected Record` `createDefaultRowHeight()` creates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xff
`protected Record` `createDelta()` creates the Delta record and sets it to 0.0010 (default accuracy)
`protected Record` `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)
`protected Record` `createEOF()` creates the EOF record
`protected Record` `createFooter()` creates the Footer Record and sets it to nothing/0 length
`FormulaRecord` `createFormula(int row, short col, java.lang.String formula)` Attempts to parse the formula into PTGs and create a formula record DOES NOT WORK YET
`void` `createFreezePane(int colSplit, int rowSplit, int topRow, int leftmostColumn)` Creates a split (freezepane).
`protected Record` `createGridset()` creates the Gridset record and sets it to true (user has mucked with the gridlines)
`protected Record` `createGuts()` creates the Guts record and sets leftrow/topcol guttter and rowlevelmax/collevelmax to 0
`protected Record` `createHCenter()` creates the HCenter Record and sets it to false (don't horizontally center)
`protected Record` `createHeader()` creates the Header Record and sets it to nothing/0 length
`protected Record` `createIndex()` creates the Index record - not currently used
`protected Record` `createIteration()` creates the Iteration record and sets it to false (don't iteratively calculate formulas)
`LabelSSTRecord` `createLabelSST(int row, short col, int index)` Create a LABELSST Record (does not add it to the records contained in this sheet)
`protected Record` `createMergedCells()`
`NumberRecord` `createNumber(int row, short col, double value)` Create a NUMBER Record (does not add it to the records contained in this sheet)
`protected Record` `createPrintGridlines()` creates the PrintGridlines record and sets it to false (that makes for ugly sheets).
`protected Record` `createPrintHeaders()` creates the PrintHeaders record and sets it to false (we don't create headers yet so why print them)
`protected Record` `createPrintSetup()` creates the PrintSetup Record and sets it to defaults and marks it invalid
`protected Record` `createProtect()` creates a Protect record with protect set to false.
`protected Record` `createRefMode()` creates the RefMode record and sets it to A1 Mode (default reference mode)
`RowRecord` `createRow(int row)` Create a row record.
`protected Record` `createSaveRecalc()` creates the SaveRecalc record and sets it to true (recalculate before saving)
`protected Record` `createSelection()` Creates the Selection record and sets it to nothing selected
`static Sheet` `createSheet()` Creates a sheet with all the usual records minus values and the "index" record (not required).
`static Sheet` `createSheet(java.util.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 Sheet` `createSheet(java.util.List recs, int sheetnum, int offset)` 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.
`protected Record` `createVCenter()` creates the VCenter Record and sets it to false (don't horizontally center)
`protected WindowTwoRecord` `createWindowTwo()` creates the WindowTwo Record and sets it to:
`protected Record` `createWSBool()` creates the WSBoolRecord and sets its values to defaults
`Record` `findFirstRecordBySid(short sid)` Returns the first occurance of a record matching a particular sid.
`int` `findFirstRecordLocBySid(short sid)` Finds the first occurance of a record matching a particular sid and returns it's position.
`short` `getActiveCellCol()` Returns the active column
`int` `getActiveCellRow()` Returns the active row
`java.util.Iterator` `getColumnBreaks()` Returns all the column page breaks
`short` `getColumnWidth(short column)` get the width of a given column in units of 1/20th of a point width (twips?)
`short` `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)
`int` `getDimsLoc()` get the location of the DimensionsRecord (which is the last record before the value section)
`int` `getEofLoc()`
`FooterRecord` `getFooter()` Returns the FooterRecord.
`GridsetRecord` `getGridsetRecord()` Gets the gridset record for this sheet.
`HeaderRecord` `getHeader()` Returns the HeaderRecord.
`int` `getLoc()` Returns the location pointer to the first record to look for when adding rows/values
`double` `getMargin(short margin)` Gets the size of the margin in inches.
`protected Margin[]` `getMargins()` Returns the array of margins.
`MergeCellsRecord.MergedRegion` `getMergedRegionAt(int index)`
`RowRecord` `getNextRow()` get the NEXT RowRecord (from LOC).
`CellValueRecordInterface` `getNextValueRecord()` get the NEXT value record (from LOC).
`int` `getNumColumnBreaks()` Returns the number of column page breaks
`int` `getNumMergedRegions()`
`int` `getNumRecords()` Returns the number of low level binary records in this sheet.
`int` `getNumRowBreaks()` Returns the number of row page breaks
`int` `getPreOffset()` get the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.
`PrintGridlinesRecord` `getPrintGridlines()` Returns the PrintGridlinesRecord.
`PrintSetupRecord` `getPrintSetup()` Returns the PrintSetupRecord.
`ProtectRecord` `getProtect()`
`java.util.List` `getRecords()`
`RowRecord` `getRow(int rownum)` get the NEXT (from LOC) RowRecord where rownumber matches the given rownum.
`java.util.Iterator` `getRowBreaks()` Returns all the row page breaks
`SelectionRecord` `getSelection()`
`int` `getSize()`
`void` `groupColumnRange(short fromColumn, short toColumn, boolean indent)` Creates an outline group for the specified columns.
`void` `groupRowRange(int fromRow, int toRow, boolean indent)`
`boolean` `isColumnBroken(short column)` Queries if the specified column has a page break
`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` `isRowBroken(int row)` Queries if the specified row has a page break
`void` `preSerialize()` Perform any work necessary before the sheet is about to be serialized.
`void` `removeColumnBreak(short column)` Removes a page break at the indicated column
`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` `removeRowBreak(int row)` Removes a page break at the indicated row
`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.
`byte[]` `serialize()` Serializes all records in the sheet into one big byte array.
`int` `serialize(int offset, byte[] data)` Serializes all records in the sheet into one big byte array.
`void` `setActiveCellCol(short col)` Sets the active column
`void` `setActiveCellRow(int row)` Sets the active row
`void` `setColumn(short column, java.lang.Short width, java.lang.Integer level, java.lang.Boolean hidden, java.lang.Boolean collapsed)`
`void` `setColumnBreak(short column, short fromRow, short toRow)` Sets a page break at the indicated column
`void` `setColumnGroupCollapsed(short columnNumber, boolean collapsed)`
`void` `setColumnWidth(short column, short width)` set the width for a given column in 1/20th of a character width units
`void` `setDefaultColumnWidth(short 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` `setFooter(FooterRecord newFooter)` Sets the FooterRecord.
`void` `setGridsPrinted(boolean value)` set whether gridlines printed or not.
`void` `setHeader(HeaderRecord newHeader)` Sets the HeaderRecord.
`void` `setLoc(int loc)` set the locator for where we should look for the next value record.
`void` `setMargin(short margin, double size)` Sets the size of the margin in inches.
`void` `setPreOffset(int offset)` Set the preoffset when using DBCELL records (currently unused) - this is the position of this sheet within the whole file.
`void` `setPrintGridlines(PrintGridlinesRecord newPrintGridlines)` Sets the PrintGridlinesRecord.
`void` `setPrintSetup(PrintSetupRecord newPrintSetup)` Sets the PrintSetupRecord.
`void` `setRowBreak(int row, short fromCol, short toCol)` Sets a page break at the indicated row
`void` `setRowGroupCollapsed(int row, boolean collapse)`
`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` `shiftBreaks(PageBreakRecord breaks, short start, short stop, int count)` Shifts all the page breaks in the range "count" number of rows/columns
`void` `shiftColumnBreaks(short startingCol, short endingCol, short count)` Shifts the vertical page breaks for the indicated count
`void` `shiftRowBreaks(int startingRow, int endingRow, int count)` Shifts the horizontal page breaks for the indicated count

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LeftMargin

    public static final short LeftMargin

See Also:
  Constant Field Values

### RightMargin

    public static final short RightMargin

See Also:
  Constant Field Values

### TopMargin

    public static final short TopMargin

See Also:
  Constant Field Values

### BottomMargin

    public static final short BottomMargin

See Also:
  Constant Field Values

### records

    protected java.util.ArrayList records

### containsLabels

    protected boolean containsLabels

### dimsloc

    protected int dimsloc

### dims

    protected DimensionsRecord dims

### defaultcolwidth

    protected DefaultColWidthRecord defaultcolwidth

### defaultrowheight

    protected DefaultRowHeightRecord defaultrowheight

### gridset

    protected GridsetRecord gridset

### printSetup

    protected PrintSetupRecord printSetup

### header

    protected HeaderRecord header

### footer

    protected FooterRecord footer

### printGridlines

    protected PrintGridlinesRecord printGridlines

### windowTwo

    protected WindowTwoRecord windowTwo

### merged

    protected MergeCellsRecord merged

### margins

    protected Margin[] margins

### mergedRecords

    protected java.util.List mergedRecords

### numMergedRegions

    protected int numMergedRegions

### selection

    protected SelectionRecord selection

### columns

    protected ColumnInfoRecordsAggregate columns

### cells

    protected ValueRecordsAggregate cells

### rows

    protected RowRecordsAggregate rows

### eofLoc

    protected int eofLoc

### protect

    protected ProtectRecord protect

### rowBreaks

    protected PageBreakRecord rowBreaks

### colBreaks

    protected PageBreakRecord colBreaks

### PANE_LOWER_RIGHT

    public static final byte PANE_LOWER_RIGHT

See Also:
  Constant Field Values

### PANE_UPPER_RIGHT

    public static final byte PANE_UPPER_RIGHT

See Also:
  Constant Field Values

### PANE_LOWER_LEFT

    public static final byte PANE_LOWER_LEFT

See Also:
  Constant Field Values

### PANE_UPPER_LEFT

    public static final byte PANE_UPPER_LEFT

See Also:
  Constant Field Values

Constructor Detail

### Sheet

    public Sheet()

  Creates new Sheet with no intialization --useless at this point

See Also:
  `createSheet(List,int,int)`

Method Detail

### createSheet

    public static Sheet createSheet(java.util.List recs,
                                    int sheetnum,
                                    int offset)

  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:
    `Workbook`, `Record`

### cloneSheet

    public Sheet 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

    public static Sheet createSheet(java.util.List records,
                                    int sheetnum)

  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

    public static Sheet 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

    public MergeCellsRecord.MergedRegion getMergedRegionAt(int index)

### getNumMergedRegions

    public int getNumMergedRegions()

### convertLabelRecords

    public void convertLabelRecords(Workbook wb)

  This is basically a kludge to deal with the now obsolete Label records. If you have to read in a sheet that contains Label records, be aware that the rest of the API doesn't deal with them, the low level structure only provides read-only semi-immutable structures (the sets are there for interface conformance with NO impelmentation). In short, you need to call this function passing it a reference to the Workbook object. All labels will be converted to LabelSST records and their contained strings will be written to the Shared String tabel (SSTRecord) within the Workbook.

  Parameters:
    `wb` - sheet's matching low level Workbook structure containing the SSTRecord.
  See Also:
    `LabelRecord`, `LabelSSTRecord`, `SSTRecord`

### 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:
    `Record`

### 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:
    `DimensionsRecord`

### 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 byte[] serialize()

  Serializes all records in the sheet into one big byte array. Use this to write the sheet out.

  Returns:
    byte[] array containing the binary representation of the records in this sheet

### 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 at
    `data` - array containing the binary representation of the records in this sheet

### createRow

    public RowRecord createRow(int row)

  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:
    `RowRecord`

### createLabelSST

    public LabelSSTRecord createLabelSST(int row,
                                         short col,
                                         int index)

  Create a LABELSST Record (does not add it to the records contained in this sheet)

  Parameters:
    `row` - the row the LabelSST is a member of
    `col` - the column the LabelSST defines
    `index` - the index of the string within the SST (use workbook addSSTString method)
  Returns:
    LabelSSTRecord newly created containing your SST Index, row,col.
  See Also:
    `SSTRecord`

### createNumber

    public NumberRecord createNumber(int row,
                                     short col,
                                     double value)

  Create a NUMBER Record (does not add it to the records contained in this sheet)

  Parameters:
    `row` - the row the NumberRecord is a member of
    `col` - the column the NumberRecord defines
    `value` - for the number record
  Returns:
    NumberRecord for that row, col containing that value as added to the sheet

### createBlank

    public BlankRecord createBlank(int row,
                                   short col)

  create a BLANK record (does not add it to the records contained in this sheet)

  Parameters:
    `row` - - the row the BlankRecord is a member of
    `col` - - the column the BlankRecord is a member of

### createFormula

    public FormulaRecord createFormula(int row,
                                       short col,
                                       java.lang.String formula)

  Attempts to parse the formula into PTGs and create a formula record DOES NOT WORK YET

  Parameters:
    `row` - - the row for the formula record
    `col` - - the column of the formula record
    `formula` - - a String representing the formula. To be parsed to PTGs
  Returns:
    bogus/useless formula record

### addValueRecord

    public void addValueRecord(int row,
                               CellValueRecordInterface col)

  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 to
    `col` - the cell value record itself.

### removeValueRecord

    public void removeValueRecord(int row,
                                  CellValueRecordInterface col)

  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 remove
    `col` - - a record supporting the CellValueRecordInterface.
  See Also:
    `CellValueRecordInterface`

### replaceValueRecord

    public void replaceValueRecord(CellValueRecordInterface newval)

  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

    public void addRow(RowRecord row)

  Adds a row record to the sheet

  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 record to be added
  See Also:
    `setLoc(int)`

### removeRow

    public void removeRow(RowRecord row)

  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

    public CellValueRecordInterface 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:
    `setLoc(int)`

### getNextRow

    public RowRecord 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:
    `setLoc(int)`

### getRow

    public RowRecord getRow(int rownum)

  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:
    `setLoc(int)`

### addDBCellRecords

    public void addDBCellRecords()

  Not currently used method to calculate and add dbcell records

### createBOF

    protected Record createBOF()

  creates the BOF record

  Returns:
    record containing a BOFRecord
  See Also:
    `BOFRecord`, `Record`

### createIndex

    protected Record createIndex()

  creates the Index record - not currently used

  Returns:
    record containing a IndexRecord
  See Also:
    `IndexRecord`, `Record`

### createCalcMode

    protected Record createCalcMode()

  creates the CalcMode record and sets it to 1 (automatic formula caculation)

  Returns:
    record containing a CalcModeRecord
  See Also:
    `CalcModeRecord`, `Record`

### createCalcCount

    protected Record createCalcCount()

  creates the CalcCount record and sets it to 0x64 (default number of iterations)

  Returns:
    record containing a CalcCountRecord
  See Also:
    `CalcCountRecord`, `Record`

### createRefMode

    protected Record createRefMode()

  creates the RefMode record and sets it to A1 Mode (default reference mode)

  Returns:
    record containing a RefModeRecord
  See Also:
    `RefModeRecord`, `Record`

### createIteration

    protected Record createIteration()

  creates the Iteration record and sets it to false (don't iteratively calculate formulas)

  Returns:
    record containing a IterationRecord
  See Also:
    `IterationRecord`, `Record`

### createDelta

    protected Record createDelta()

  creates the Delta record and sets it to 0.0010 (default accuracy)

  Returns:
    record containing a DeltaRecord
  See Also:
    `DeltaRecord`, `Record`

### createSaveRecalc

    protected Record createSaveRecalc()

  creates the SaveRecalc record and sets it to true (recalculate before saving)

  Returns:
    record containing a SaveRecalcRecord
  See Also:
    `SaveRecalcRecord`, `Record`

### createPrintHeaders

    protected Record 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:
    `PrintHeadersRecord`, `Record`

### createPrintGridlines

    protected Record 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:
    `PrintGridlinesRecord`, `Record`

### createGridset

    protected Record createGridset()

  creates the Gridset record and sets it to true (user has mucked with the gridlines)

  Returns:
    record containing a GridsetRecord
  See Also:
    `GridsetRecord`, `Record`

### createGuts

    protected Record createGuts()

  creates the Guts record and sets leftrow/topcol guttter and rowlevelmax/collevelmax to 0

  Returns:
    record containing a GutsRecordRecord
  See Also:
    `GutsRecord`, `Record`

### createDefaultRowHeight

    protected Record createDefaultRowHeight()

  creates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xff

  Returns:
    record containing a DefaultRowHeightRecord
  See Also:
    `DefaultRowHeightRecord`, `Record`

### createWSBool

    protected Record createWSBool()

  creates the WSBoolRecord and sets its values to defaults

  Returns:
    record containing a WSBoolRecord
  See Also:
    `WSBoolRecord`, `Record`

### createHeader

    protected Record createHeader()

  creates the Header Record and sets it to nothing/0 length

  Returns:
    record containing a HeaderRecord
  See Also:
    `HeaderRecord`, `Record`

### createFooter

    protected Record createFooter()

  creates the Footer Record and sets it to nothing/0 length

  Returns:
    record containing a FooterRecord
  See Also:
    `FooterRecord`, `Record`

### createHCenter

    protected Record createHCenter()

  creates the HCenter Record and sets it to false (don't horizontally center)

  Returns:
    record containing a HCenterRecord
  See Also:
    `HCenterRecord`, `Record`

### createVCenter

    protected Record createVCenter()

  creates the VCenter Record and sets it to false (don't horizontally center)

  Returns:
    record containing a VCenterRecord
  See Also:
    `VCenterRecord`, `Record`

### createPrintSetup

    protected Record createPrintSetup()

  creates the PrintSetup Record and sets it to defaults and marks it invalid

  Returns:
    record containing a PrintSetupRecord
  See Also:
    `PrintSetupRecord`, `Record`

### createDefaultColWidth

    protected Record createDefaultColWidth()

  creates the DefaultColWidth Record and sets it to 8

  Returns:
    record containing a DefaultColWidthRecord
  See Also:
    `DefaultColWidthRecord`, `Record`

### createColInfo

    protected Record createColInfo()

  creates the ColumnInfo Record and sets it to a default column/width

  Returns:
    record containing a ColumnInfoRecord
  See Also:
    `ColumnInfoRecord`

### 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:
    `DefaultColWidthRecord`, `ColumnInfoRecord`, `setColumnWidth(short,short)`

### 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 number
    `width` - (in units of 1/20th of a character width)

### setColumn

    public void setColumn(short column,
                          java.lang.Short width,
                          java.lang.Integer level,
                          java.lang.Boolean hidden,
                          java.lang.Boolean collapsed)

### 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

    protected Record 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:
    `DimensionsRecord`, `Record`

### createWindowTwo

    protected WindowTwoRecord 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:
    `WindowTwoRecord`, `Record`

### createSelection

    protected Record createSelection()

  Creates the Selection record and sets it to nothing selected

  Returns:
    record containing a SelectionRecord
  See Also:
    `SelectionRecord`, `Record`

### getActiveCellRow

    public int getActiveCellRow()

  Returns the active row

  Returns:
    row the active row index
  See Also:
    `SelectionRecord`

### setActiveCellRow

    public void setActiveCellRow(int row)

  Sets the active row

  Parameters:
    `row` - the row index
  See Also:
    `SelectionRecord`

### getActiveCellCol

    public short getActiveCellCol()

  Returns the active column

  Returns:
    row the active column index
  See Also:
    `SelectionRecord`

### setActiveCellCol

    public void setActiveCellCol(short col)

  Sets the active column

  Parameters:
    `col` - the column index
  See Also:
    `SelectionRecord`

### createMergedCells

    protected Record createMergedCells()

### createEOF

    protected Record createEOF()

  creates the EOF record

  Returns:
    record containing a EOFRecord
  See Also:
    `EOFRecord`, `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

    public void checkDimsLoc(Record rec,
                             int recloc)

  in the event the record is a dimensions record, resets both the loc index and dimsloc index

### getSize

    public int getSize()

### getRecords

    public java.util.List getRecords()

### getGridsetRecord

    public GridsetRecord getGridsetRecord()

  Gets the gridset record for this sheet.

### findFirstRecordBySid

    public Record findFirstRecordBySid(short sid)

  Returns the first occurance of a record matching a particular sid.

### setSCLRecord

    public void setSCLRecord(SCLRecord sclRecord)

  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

    public HeaderRecord getHeader()

  Returns the HeaderRecord.

  Returns:
    HeaderRecord for the sheet.

### setHeader

    public void setHeader(HeaderRecord newHeader)

  Sets the HeaderRecord.

  Parameters:
    `newHeader` - The new HeaderRecord for the sheet.

### getFooter

    public FooterRecord getFooter()

  Returns the FooterRecord.

  Returns:
    FooterRecord for the sheet.

### setFooter

    public void setFooter(FooterRecord newFooter)

  Sets the FooterRecord.

  Parameters:
    `newFooter` - The new FooterRecord for the sheet.

### getPrintSetup

    public PrintSetupRecord getPrintSetup()

  Returns the PrintSetupRecord.

  Returns:
    PrintSetupRecord for the sheet.

### setPrintSetup

    public void setPrintSetup(PrintSetupRecord newPrintSetup)

  Sets the PrintSetupRecord.

  Parameters:
    `newPrintSetup` - The new PrintSetupRecord for the sheet.

### getPrintGridlines

    public PrintGridlinesRecord getPrintGridlines()

  Returns the PrintGridlinesRecord.

  Returns:
    PrintGridlinesRecord for the sheet.

### setPrintGridlines

    public void setPrintGridlines(PrintGridlinesRecord newPrintGridlines)

  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 get
    `size` - 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).

  Parameters:
    `colSplit` - Horizonatal position of split.
    `rowSplit` - Vertical position of split.
    `topRow` - Top row visible in bottom pane
    `leftmostColumn` - Left column visible in right pane.

### createSplitPane

    public void createSplitPane(int xSplitPos,
                                int ySplitPos,
                                int topRow,
                                int leftmostColumn,
                                int activePane)

  Creates a split pane.

  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 pane
    `leftmostColumn` - 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:
    `PANE_LOWER_LEFT`, `PANE_LOWER_RIGHT`, `PANE_UPPER_LEFT`, `PANE_UPPER_RIGHT`

### getSelection

    public SelectionRecord getSelection()

### setSelection

    public void setSelection(SelectionRecord selection)

### createProtect

    protected Record createProtect()

  creates a Protect record with protect set to false.

  Returns:
    a ProtectRecord
  See Also:
    `ProtectRecord`, `Record`

### getProtect

    public ProtectRecord getProtect()

### 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

    protected Margin[] getMargins()

  Returns the array of margins. If not created, will create.

  Returns:
    the array of marings.

### aggregateDrawingRecords

    public int aggregateDrawingRecords(DrawingManager drawingManager)

### 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

    public void shiftBreaks(PageBreakRecord breaks,
                            short start,
                            short stop,
                            int count)

  Shifts all the page breaks in the range "count" number of rows/columns

  Parameters:
    `breaks` - The page record to be shifted
    `start` - Starting "main" value to shift breaks
    `stop` - Ending "main" value to shift breaks
    `count` - 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

    public java.util.Iterator getRowBreaks()

  Returns all the row page breaks

  Returns:

### getNumRowBreaks

    public int getNumRowBreaks()

  Returns the number of row page breaks

  Returns:

### getColumnBreaks

    public java.util.Iterator getColumnBreaks()

  Returns all the column page breaks

  Returns:

### getNumColumnBreaks

    public int getNumColumnBreaks()

  Returns the number of column page breaks

  Returns:

### setColumnGroupCollapsed

    public void setColumnGroupCollapsed(short columnNumber,
                                        boolean collapsed)

### groupRowRange

    public void groupRowRange(int fromRow,
                              int toRow,
                              boolean indent)

### setRowGroupCollapsed

    public void setRowGroupCollapsed(int row,
                                     boolean collapse)

Copyright © 2003 Apache Software Foundation.