1 19 20 package jxl.read.biff; 21 22 import java.text.NumberFormat ; 23 24 import jxl.DateCell; 25 import jxl.CellType; 26 import jxl.DateFormulaCell; 27 import jxl.biff.FormattingRecords; 28 import jxl.biff.FormulaData; 29 import jxl.biff.WorkbookMethods; 30 import jxl.biff.formula.FormulaParser; 31 import jxl.biff.formula.ExternalSheet; 32 import jxl.biff.formula.FormulaException; 33 34 37 class DateFormulaRecord extends DateRecord 38 implements DateCell, FormulaData, DateFormulaCell 39 { 40 43 private String formulaString; 44 45 48 private ExternalSheet externalSheet; 49 50 53 private WorkbookMethods nameTable; 54 55 58 private byte[] data; 59 60 70 public DateFormulaRecord(NumberFormulaRecord t, FormattingRecords fr, 71 ExternalSheet es, WorkbookMethods nt, 72 boolean nf, SheetImpl si) throws FormulaException 73 { 74 super(t, t.getXFIndex(), fr, nf, si); 75 76 externalSheet = es; 77 nameTable = nt; 78 data = t.getFormulaData(); 79 } 80 81 86 public CellType getType() 87 { 88 return CellType.DATE_FORMULA; 89 } 90 91 97 public byte[] getFormulaData() throws FormulaException 98 { 99 if (!getSheet().getWorkbookBof().isBiff8()) 100 { 101 throw new FormulaException(FormulaException.biff8Supported); 102 } 103 104 return data; 106 } 107 108 114 public String getFormula() throws FormulaException 115 { 116 if (formulaString == null) 119 { 120 byte[] tokens = new byte[data.length - 16]; 121 System.arraycopy(data, 16, tokens, 0, tokens.length); 122 FormulaParser fp = new FormulaParser 123 (tokens, this, externalSheet, nameTable, 124 getSheet().getWorkbook().getSettings()); 125 fp.parse(); 126 formulaString = fp.getFormula(); 127 } 128 129 return formulaString; 130 } 131 132 137 public double getValue() 138 { 139 return 0; 140 } 141 142 147 public NumberFormat getNumberFormat() 148 { 149 return null; 150 } 151 } 152 | Popular Tags |