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.DoubleHelper; 30 import jxl.biff.FormattingRecords; 31 32 36 class NumberRecord extends CellValue implements NumberCell 37 { 38 41 private static Logger logger = Logger.getLogger(NumberRecord.class); 42 43 46 private double value; 47 48 51 private NumberFormat format; 52 53 56 private static DecimalFormat defaultFormat = new DecimalFormat ("#.###"); 57 58 65 public NumberRecord(Record t, FormattingRecords fr, SheetImpl si) 66 { 67 super(t, fr, si); 68 byte[] data = getRecord().getData(); 69 70 value = DoubleHelper.getIEEEDouble(data, 6); 71 72 format = fr.getNumberFormat(getXFIndex()); 74 if (format == null) 75 { 76 format = defaultFormat; 77 } 78 } 79 80 85 public double getValue() 86 { 87 return value; 88 } 89 90 95 public String getContents() 96 { 97 return format.format(value); 98 } 99 100 105 public CellType getType() 106 { 107 return CellType.NUMBER; 108 } 109 110 116 public NumberFormat getNumberFormat() 117 { 118 return format; 119 } 120 } 121 122 123 124 | Popular Tags |