1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 32 33 public class PrintHeadersRecord 34 extends Record 35 { 36 public final static short sid = 0x2a; 37 private short field_1_print_headers; 38 39 public PrintHeadersRecord() 40 { 41 } 42 43 50 51 public PrintHeadersRecord(short id, short size, byte [] data) 52 { 53 super(id, size, data); 54 } 55 56 64 65 public PrintHeadersRecord(short id, short size, byte [] data, int offset) 66 { 67 super(id, size, data, offset); 68 } 69 70 protected void validateSid(short id) 71 { 72 if (id != sid) 73 { 74 throw new RecordFormatException("NOT A PrintHeaders RECORD"); 75 } 76 } 77 78 protected void fillFields(byte [] data, short size, int offset) 79 { 80 field_1_print_headers = LittleEndian.getShort(data, 0 + offset); 81 } 82 83 87 88 public void setPrintHeaders(boolean p) 89 { 90 if (p == true) 91 { 92 field_1_print_headers = 1; 93 } 94 else 95 { 96 field_1_print_headers = 0; 97 } 98 } 99 100 104 105 public boolean getPrintHeaders() 106 { 107 return (field_1_print_headers == 1); 108 } 109 110 public String toString() 111 { 112 StringBuffer buffer = new StringBuffer (); 113 114 buffer.append("[PRINTHEADERS]\n"); 115 buffer.append(" .printheaders = ").append(getPrintHeaders()) 116 .append("\n"); 117 buffer.append("[/PRINTHEADERS]\n"); 118 return buffer.toString(); 119 } 120 121 public int serialize(int offset, byte [] data) 122 { 123 LittleEndian.putShort(data, 0 + offset, sid); 124 LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); 125 LittleEndian.putShort(data, 4 + offset, field_1_print_headers); 126 return getRecordSize(); 127 } 128 129 public int getRecordSize() 130 { 131 return 6; 132 } 133 134 public short getSid() 135 { 136 return this.sid; 137 } 138 139 public Object clone() { 140 PrintHeadersRecord rec = new PrintHeadersRecord(); 141 rec.field_1_print_headers = field_1_print_headers; 142 return rec; 143 } 144 } 145 | Popular Tags |