1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 31 32 public class PrintGridlinesRecord 33 extends Record 34 { 35 public final static short sid = 0x2b; 36 private short field_1_print_gridlines; 37 38 public PrintGridlinesRecord() 39 { 40 } 41 42 49 50 public PrintGridlinesRecord(short id, short size, byte [] data) 51 { 52 super(id, size, data); 53 } 54 55 63 64 public PrintGridlinesRecord(short id, short size, byte [] data, 65 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 PrintGridlines RECORD"); 75 } 76 } 77 78 protected void fillFields(byte [] data, short size, int offset) 79 { 80 field_1_print_gridlines = LittleEndian.getShort(data, 0 + offset); 81 } 82 83 88 89 public void setPrintGridlines(boolean pg) 90 { 91 if (pg == true) 92 { 93 field_1_print_gridlines = 1; 94 } 95 else 96 { 97 field_1_print_gridlines = 0; 98 } 99 } 100 101 106 107 public boolean getPrintGridlines() 108 { 109 return (field_1_print_gridlines == 1); 110 } 111 112 public String toString() 113 { 114 StringBuffer buffer = new StringBuffer (); 115 116 buffer.append("[PRINTGRIDLINES]\n"); 117 buffer.append(" .printgridlines = ").append(getPrintGridlines()) 118 .append("\n"); 119 buffer.append("[/PRINTGRIDLINES]\n"); 120 return buffer.toString(); 121 } 122 123 public int serialize(int offset, byte [] data) 124 { 125 LittleEndian.putShort(data, 0 + offset, sid); 126 LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); 127 LittleEndian.putShort(data, 4 + offset, field_1_print_gridlines); 128 return getRecordSize(); 129 } 130 131 public int getRecordSize() 132 { 133 return 6; 134 } 135 136 public short getSid() 137 { 138 return this.sid; 139 } 140 141 public Object clone() { 142 PrintGridlinesRecord rec = new PrintGridlinesRecord(); 143 rec.field_1_print_gridlines = field_1_print_gridlines; 144 return rec; 145 } 146 } 147 | Popular Tags |