1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 30 31 public class ExternSheetSubRecord extends Record { 32 public final static short sid = 0xFFF; private short field_1_index_to_supbook; 34 private short field_2_index_to_first_supbook_sheet; 35 private short field_3_index_to_last_supbook_sheet; 36 37 38 40 public ExternSheetSubRecord() { 41 } 42 43 50 public ExternSheetSubRecord(short id, short size, byte[] data) { 51 super(id, size, data); 52 } 53 54 62 public ExternSheetSubRecord(short id, short size, byte[] data, int offset) { 63 super(id, size, data, offset); 64 } 65 66 69 public void setIndexToSupBook(short index){ 70 field_1_index_to_supbook = index; 71 } 72 73 76 public short getIndexToSupBook(){ 77 return field_1_index_to_supbook; 78 } 79 80 83 public void setIndexToFirstSupBook(short index){ 84 field_2_index_to_first_supbook_sheet = index; 85 } 86 87 90 public short getIndexToFirstSupBook(){ 91 return field_2_index_to_first_supbook_sheet; 92 } 93 94 97 public void setIndexToLastSupBook(short index){ 98 field_3_index_to_last_supbook_sheet = index; 99 } 100 101 104 public short getIndexToLastSupBook(){ 105 return field_3_index_to_last_supbook_sheet; 106 } 107 108 114 protected void validateSid(short id) { 115 } 117 118 126 protected void fillFields(byte [] data, short size, int offset) { 127 field_1_index_to_supbook = LittleEndian.getShort(data, 0 + offset); 128 field_2_index_to_first_supbook_sheet = LittleEndian.getShort(data, 2 + offset); 129 field_3_index_to_last_supbook_sheet = LittleEndian.getShort(data, 4 + offset); 130 } 131 132 133 public String toString() { 134 StringBuffer buffer = new StringBuffer (); 135 buffer.append(" supbookindex =").append(getIndexToSupBook()).append('\n'); 136 buffer.append(" 1stsbindex =").append(getIndexToFirstSupBook()).append('\n'); 137 buffer.append(" lastsbindex =").append(getIndexToLastSupBook()).append('\n'); 138 return buffer.toString(); 139 } 140 141 150 public int serialize(int offset, byte [] data) { 151 LittleEndian.putShort(data, 0 + offset, getIndexToSupBook()); 152 LittleEndian.putShort(data, 2 + offset, getIndexToFirstSupBook()); 153 LittleEndian.putShort(data, 4 + offset, getIndexToLastSupBook()); 154 155 return getRecordSize(); 156 } 157 158 159 161 public int getRecordSize() { 162 return 6; 163 } 164 165 168 public short getSid() { 169 return this.sid; 170 } 171 } 172 | Popular Tags |