Class ExternSheetRecord
- java.lang.Object
-
- org.apache.poi.hssf.record.RecordBase
-
- org.apache.poi.hssf.record.Record
-
- org.apache.poi.hssf.record.StandardRecord
-
- org.apache.poi.hssf.record.ExternSheetRecord
-
- All Implemented Interfaces:
Duplicatable
,GenericRecord
public class ExternSheetRecord extends StandardRecord
EXTERNSHEET (0x0017)A List of Indexes to EXTERNALBOOK (supplemental book) Records
-
-
Field Summary
Fields Modifier and Type Field Description static short
sid
-
Constructor Summary
Constructors Constructor Description ExternSheetRecord()
ExternSheetRecord(ExternSheetRecord other)
ExternSheetRecord(RecordInputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addRef(int extBookIndex, int firstSheetIndex, int lastSheetIndex)
Add a zero-based reference to aSupBookRecord
.void
addREFRecord(org.apache.poi.hssf.record.ExternSheetRecord.RefSubRecord rec)
adds REF struct (ExternSheetSubRecord)static ExternSheetRecord
combine(ExternSheetRecord[] esrs)
ExternSheetRecord
copy()
int
findRefIndexFromExtBookIndex(int extBookIndex)
protected int
getDataSize()
int
getExtbookIndexFromRefIndex(int refIndex)
int
getFirstSheetIndexFromRefIndex(int extRefIndex)
Returns the first sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped.Map<String,Supplier<?>>
getGenericProperties()
HSSFRecordTypes
getGenericRecordType()
int
getLastSheetIndexFromRefIndex(int extRefIndex)
Returns the last sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped.int
getNumOfREFRecords()
returns the number of REF Records, which is in modelint
getNumOfRefs()
int
getRefIxForSheet(int externalBookIndex, int firstSheetIndex, int lastSheetIndex)
short
getSid()
return the non static version of the id for this record.void
removeSheet(int sheetIdx)
void
serialize(LittleEndianOutput out)
Write the data content of this BIFF record.-
Methods inherited from class org.apache.poi.hssf.record.StandardRecord
getRecordSize, serialize
-
Methods inherited from class org.apache.poi.hssf.record.Record
cloneViaReserialise, serialize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren
-
-
-
-
Field Detail
-
sid
public static final short sid
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExternSheetRecord
public ExternSheetRecord()
-
ExternSheetRecord
public ExternSheetRecord(ExternSheetRecord other)
-
ExternSheetRecord
public ExternSheetRecord(RecordInputStream in)
-
-
Method Detail
-
getNumOfRefs
public int getNumOfRefs()
- Returns:
- number of REF structures
-
addREFRecord
public void addREFRecord(org.apache.poi.hssf.record.ExternSheetRecord.RefSubRecord rec)
adds REF struct (ExternSheetSubRecord)- Parameters:
rec
- REF struct
-
getNumOfREFRecords
public int getNumOfREFRecords()
returns the number of REF Records, which is in model- Returns:
- number of REF records
-
getDataSize
protected int getDataSize()
- Specified by:
getDataSize
in classStandardRecord
-
serialize
public void serialize(LittleEndianOutput out)
Description copied from class:StandardRecord
Write the data content of this BIFF record. The 'ushort sid' and 'ushort size' header fields have already been written by the superclass.The number of bytes written must equal the record size reported by
RecordBase.getRecordSize()
} minus four ( record header consisting of a 'ushort sid' and 'ushort reclength' has already been written by their superclass).- Specified by:
serialize
in classStandardRecord
- Parameters:
out
- the output object
-
removeSheet
public void removeSheet(int sheetIdx)
-
getSid
public short getSid()
return the non static version of the id for this record.
-
getExtbookIndexFromRefIndex
public int getExtbookIndexFromRefIndex(int refIndex)
- Parameters:
refIndex
- specifies the n-th refIndex- Returns:
- the index of the SupBookRecord for this index
-
findRefIndexFromExtBookIndex
public int findRefIndexFromExtBookIndex(int extBookIndex)
- Parameters:
extBookIndex
- external sheet reference index- Returns:
- -1 if not found
-
getFirstSheetIndexFromRefIndex
public int getFirstSheetIndexFromRefIndex(int extRefIndex)
Returns the first sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped.- Parameters:
extRefIndex
- external sheet reference index- Returns:
- the first sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped
-
getLastSheetIndexFromRefIndex
public int getLastSheetIndexFromRefIndex(int extRefIndex)
Returns the last sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped. For a single sheet reference, the first and last should be the same.- Parameters:
extRefIndex
- external sheet reference index- Returns:
- the last sheet that the reference applies to, or -1 if the referenced sheet can't be found, or -2 if the reference is workbook scoped.
-
addRef
public int addRef(int extBookIndex, int firstSheetIndex, int lastSheetIndex)
Add a zero-based reference to aSupBookRecord
.If the type of the SupBook record is same-sheet referencing, Add-In referencing, DDE data source referencing, or OLE data source referencing, then no scope is specified and this value MUST be -2. Otherwise, the scope must be set as follows:
-2
Workbook-level reference that applies to the entire workbook.-1
Sheet-level reference.>=0
Sheet-level reference. This specifies the first sheet in the reference.If the SupBook type is unused or external workbook referencing, then this value specifies the zero-based index of an external sheet name, see
SupBookRecord.getSheetNames()
. This referenced string specifies the name of the first sheet within the external workbook that is in scope. This sheet MUST be a worksheet or macro sheet.If the supporting link type is self-referencing, then this value specifies the zero-based index of a
BoundSheetRecord
record in the workbook stream that specifies the first sheet within the scope of this reference. This sheet MUST be a worksheet or a macro sheet.
- Parameters:
extBookIndex
- the external book block indexfirstSheetIndex
- the scope, must be -2 for add-in referenceslastSheetIndex
- the scope, must be -2 for add-in references- Returns:
- index of newly added ref
-
getRefIxForSheet
public int getRefIxForSheet(int externalBookIndex, int firstSheetIndex, int lastSheetIndex)
-
combine
public static ExternSheetRecord combine(ExternSheetRecord[] esrs)
-
copy
public ExternSheetRecord copy()
- Specified by:
copy
in interfaceDuplicatable
- Specified by:
copy
in classStandardRecord
- Returns:
- a deep copy of the implementing class / instance
-
getGenericRecordType
public HSSFRecordTypes getGenericRecordType()
- Specified by:
getGenericRecordType
in interfaceGenericRecord
- Specified by:
getGenericRecordType
in classRecord
-
-