org.apache.poi.hssf.record
public final class: FormatRecord [javadoc |
source]
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.FormatRecord
Title: Format Record (0x041E)
Description: describes a number format -- those goofy strings like $(#,###)
REFERENCE: PG 317 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
- author:
Andrew - C. Oliver (acoliver at apache dot org)
- author:
Shawn - M. Laubach (slaubach at apache dot org)
| Field Summary |
|---|
| public static final short | sid | |
| Constructor: |
public FormatRecord(RecordInputStream in) {
field_1_index_code = in.readShort();
int field_3_unicode_len = in.readUShort();
field_3_hasMultibyte = (in.readByte() & 0x01) != 0;
if (field_3_hasMultibyte) {
field_4_formatstring = in.readUnicodeLEString(field_3_unicode_len);
} else {
field_4_formatstring = in.readCompressedUnicode(field_3_unicode_len);
}
}
|
public FormatRecord(int indexCode,
String fs) {
field_1_index_code = indexCode;
field_4_formatstring = fs;
field_3_hasMultibyte = StringUtil.hasMultibyte(fs);
}
|
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.poi.hssf.record.FormatRecord Detail: |
public Object clone() {
// immutable
return this;
}
|
protected int getDataSize() {
return 5 // 2 shorts + 1 byte
+ getFormatString().length() * (field_3_hasMultibyte ? 2 : 1);
}
|
public String getFormatString() {
return field_4_formatstring;
}
|
public int getIndexCode() {
return field_1_index_code;
}
get the format index code (for built in formats) |
public short getSid() {
return sid;
}
|
public void serialize(LittleEndianOutput out) {
String formatString = getFormatString();
out.writeShort(getIndexCode());
out.writeShort(formatString.length());
out.writeByte(field_3_hasMultibyte ? 0x01 : 0x00);
if ( field_3_hasMultibyte ) {
StringUtil.putUnicodeLE( formatString, out);
} else {
StringUtil.putCompressedUnicode( formatString, out);
}
}
|
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[FORMAT]\n");
buffer.append(" .indexcode = ").append(HexDump.shortToHex(getIndexCode())).append("\n");
buffer.append(" .isUnicode = ").append(field_3_hasMultibyte ).append("\n");
buffer.append(" .formatstring = ").append(getFormatString()).append("\n");
buffer.append("[/FORMAT]\n");
return buffer.toString();
}
|