EscherTextboxRecordpublic class EscherTextboxRecord extends EscherRecord Holds data from the parent application. Most commonly used to store
text in the format of the parent application, rather than in
Escher format. We don't attempt to understand the contents, since
they will be in the parent's format, not Escher format. |
Fields Summary |
---|
public static final short | RECORD_ID | public static final String | RECORD_DESCRIPTION | private static final byte[] | NO_BYTES | private byte[] | thedataThe data for this record not including the the 8 byte header |
Constructors Summary |
---|
public EscherTextboxRecord()
|
Methods Summary |
---|
public java.lang.Object | clone()
// shallow clone
return super.clone();
| public int | fillFields(byte[] data, int offset, org.apache.poi.ddf.EscherRecordFactory recordFactory)This method deserializes the record from a byte array.
int bytesRemaining = readHeader( data, offset );
// Save the data, ready for the calling code to do something
// useful with it
thedata = new byte[bytesRemaining];
System.arraycopy( data, offset + 8, thedata, 0, bytesRemaining );
return bytesRemaining + 8;
| public byte[] | getData()Returns any extra data associated with this record. In practice excel
does not seem to put anything here, but with PowerPoint this will
contain the bytes that make up a TextHeaderAtom followed by a
TextBytesAtom/TextCharsAtom
return thedata;
| public java.lang.String | getRecordName()The short name for this record
return "ClientTextbox";
| public int | getRecordSize()Returns the number of bytes that are required to serialize this record.
return 8 + thedata.length;
| public int | serialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)Writes this record and any contained records to the supplied byte
array.
listener.beforeRecordSerialize( offset, getRecordId(), this );
LittleEndian.putShort(data, offset, getOptions());
LittleEndian.putShort(data, offset+2, getRecordId());
int remainingBytes = thedata.length;
LittleEndian.putInt(data, offset+4, remainingBytes);
System.arraycopy(thedata, 0, data, offset+8, thedata.length);
int pos = offset+8+thedata.length;
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
int size = pos - offset;
if (size != getRecordSize())
throw new RecordFormatException(size + " bytes written but getRecordSize() reports " + getRecordSize());
return size;
| public void | setData(byte[] b, int start, int length)Sets the extra data (in the parent application's format) to be
contained by the record. Used when the parent application changes
the contents.
thedata = new byte[length];
System.arraycopy(b,start,thedata,0,length);
| public void | setData(byte[] b)
setData(b,0,b.length);
| public java.lang.String | toString()
String nl = System.getProperty( "line.separator" );
String theDumpHex = "";
try
{
if (thedata.length != 0)
{
theDumpHex = " Extra Data:" + nl;
theDumpHex += HexDump.dump(thedata, 0, 0);
}
}
catch ( Exception e )
{
theDumpHex = "Error!!";
}
return getClass().getName() + ":" + nl +
" isContainer: " + isContainerRecord() + nl +
" options: 0x" + HexDump.toHex( getOptions() ) + nl +
" recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" numchildren: " + getChildRecords().size() + nl +
theDumpHex;
|
|