private static ValueEval EvaluateFormula(Ptg[] ptgs) { HSSFWorkbook wb = new HSSFWorkbook(); wb.CreateSheet().CreateRow(0).CreateCell(0); IEvaluationWorkbook ewb = HSSFEvaluationWorkbook.Create(wb); OperationEvaluationContext ec = new OperationEvaluationContext(null, ewb, 0, 0, 0, null); return(new WorkbookEvaluator(null, null, null).EvaluateFormula(ec, ptgs)); }
public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, IEvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker) { _bookEvaluator = bookEvaluator; _workbook = workbook; _sheetIndex = sheetIndex; _rowIndex = srcRowNum; _columnIndex = srcColNum; _tracker = tracker; }
public WorkbookEvaluator(IEvaluationWorkbook workbook, IEvaluationListener evaluationListener, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { _workbook = workbook; _evaluationListener = evaluationListener; _cache = new EvaluationCache(evaluationListener); _sheetIndexesBySheet = new Hashtable(); _sheetIndexesByName = new Dictionary<string, int>(); _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY; _workbookIx = 0; _stabilityClassifier = stabilityClassifier; AggregatingUDFFinder defaultToolkit = // workbook can be null in unit tests workbook == null ? null : (AggregatingUDFFinder)workbook.GetUDFFinder(); if (defaultToolkit != null && udfFinder != null) { defaultToolkit.Add(udfFinder); } _udfFinder = defaultToolkit; }
public WorkbookEvaluator(IEvaluationWorkbook workbook, IEvaluationListener evaluationListener, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { _workbook = workbook; _evaluationListener = evaluationListener; _cache = new EvaluationCache(evaluationListener); _sheetIndexesBySheet = new Hashtable(); _sheetIndexesByName = new Dictionary <string, int>(); _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY; _workbookIx = 0; _stabilityClassifier = stabilityClassifier; AggregatingUDFFinder defaultToolkit = // workbook can be null in unit tests workbook == null ? null : (AggregatingUDFFinder)workbook.GetUDFFinder(); if (defaultToolkit != null && udfFinder != null) { defaultToolkit.Add(udfFinder); } _udfFinder = defaultToolkit; }
/** * @return whether cell at rowIndex and columnIndex is a subtotal * @see org.apache.poi.ss.formula.functions.Subtotal */ public bool IsSubTotal(int rowIndex, int columnIndex) { bool subtotal = false; IEvaluationCell cell = Sheet.GetCell(rowIndex, columnIndex); if (cell != null && cell.CellType == CellType.Formula) { IEvaluationWorkbook wb = _bookEvaluator.Workbook; foreach (Ptg ptg in wb.GetFormulaTokens(cell)) { if (ptg is FuncVarPtg) { FuncVarPtg f = (FuncVarPtg)ptg; if ("SUBTOTAL".Equals(f.Name)) { subtotal = true; break; } } } } return(subtotal); }
public WorkbookEvaluator(IEvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) : this(workbook, null, stabilityClassifier, udfFinder) { }
public int GetSheetIndex(IEvaluationWorkbook mewb) { return(mewb.GetSheetIndex(_masterSheet)); }
private ForkedEvaluator(IEvaluationWorkbook masterWorkbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { _sewb = new ForkedEvaluationWorkbook(masterWorkbook); _evaluator = new WorkbookEvaluator(_sewb, stabilityClassifier, udfFinder); }
public ForkedEvaluationWorkbook(IEvaluationWorkbook master) { _masterBook = master; _sharedSheetsByName = new Dictionary <String, ForkedEvaluationSheet>(); }
public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, IEvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker) : this(bookEvaluator, workbook, sheetIndex, srcRowNum, srcColNum, tracker, isSingleValue : true) { }