1 19 20 package jxl.read.biff; 21 22 import java.text.DecimalFormat ; 23 import java.text.NumberFormat ; 24 25 import common.Logger; 26 27 import jxl.NumberCell; 28 import jxl.CellType; 29 import jxl.biff.IntegerHelper; 30 import jxl.biff.FormattingRecords; 31 32 35 class RKRecord extends CellValue implements NumberCell 36 { 37 40 private static Logger logger = Logger.getLogger(RKRecord.class); 41 42 45 private double value; 46 47 50 private NumberFormat format; 51 52 55 private static DecimalFormat defaultFormat = new DecimalFormat ("#.###"); 56 57 64 public RKRecord(Record t, FormattingRecords fr, SheetImpl si) 65 { 66 super(t, fr, si); 67 byte[] data = getRecord().getData(); 68 int rknum = IntegerHelper.getInt(data[6], data[7], data[8], data[9]); 69 value = RKHelper.getDouble(rknum); 70 71 format = fr.getNumberFormat(getXFIndex()); 73 if (format == null) 74 { 75 format = defaultFormat; 76 } 77 } 78 79 84 public double getValue() 85 { 86 return value; 87 } 88 89 94 public String getContents() 95 { 96 return format.format(value); 97 } 98 99 104 public CellType getType() 105 { 106 return CellType.NUMBER; 107 } 108 109 115 public NumberFormat getNumberFormat() 116 { 117 return format; 118 } 119 } 120 121 122 123 | Popular Tags |