1 2 17 18 19 20 package org.apache.poi.hdf.model.hdftypes; 21 22 import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType; 23 import org.apache.poi.util.LittleEndian; 24 29 30 public class TableCellDescriptor extends TCAbstractType implements HDFType 31 { 32 33 45 46 public TableCellDescriptor() 47 { 48 } 49 static TableCellDescriptor convertBytesToTC(byte[] array, int offset) 50 { 51 TableCellDescriptor tc = new TableCellDescriptor(); 52 int rgf = LittleEndian.getShort(array, offset); 53 tc.setFFirstMerged((rgf & 0x0001) > 0); 54 tc.setFMerged((rgf & 0x0002) > 0); 55 tc.setFVertical((rgf & 0x0004) > 0); 56 tc.setFBackward((rgf & 0x0008) > 0); 57 tc.setFRotateFont((rgf & 0x0010) > 0); 58 tc.setFVertMerge((rgf & 0x0020) > 0); 59 tc.setFVertRestart((rgf & 0x0040) > 0); 60 tc.setVertAlign((byte)((rgf & 0x0180) >> 7)); 61 62 short[] brcTop = new short[2]; 63 short[] brcLeft = new short[2]; 64 short[] brcBottom = new short[2]; 65 short[] brcRight = new short[2]; 66 67 brcTop[0] = LittleEndian.getShort(array, offset + 4); 68 brcTop[1] = LittleEndian.getShort(array, offset + 6); 69 70 brcLeft[0] = LittleEndian.getShort(array, offset + 8); 71 brcLeft[1] = LittleEndian.getShort(array, offset + 10); 72 73 brcBottom[0] = LittleEndian.getShort(array, offset + 12); 74 brcBottom[1] = LittleEndian.getShort(array, offset + 14); 75 76 brcRight[0] = LittleEndian.getShort(array, offset + 16); 77 brcRight[1] = LittleEndian.getShort(array, offset + 18); 78 79 return tc; 80 } 81 82 } 83 | Popular Tags |