public abstract SetCellValue ( string address, object value ) : void | ||
address | string | |
value | object | |
return | void |
public FormulaParser(ExcelDataProvider excelDataProvider, ParsingContext parsingContext) { parsingContext.Parser = this; parsingContext.ExcelDataProvider = excelDataProvider; parsingContext.NameValueProvider = new NameValueProvider(excelDataProvider); parsingContext.RangeAddressFactory = new RangeAddressFactory(excelDataProvider); _parsingContext = parsingContext; _excelDataProvider = excelDataProvider; Configure(configuration => { configuration .SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)) .SetGraphBuilder(new ExpressionGraphBuilder(excelDataProvider, _parsingContext)) .SetExpresionCompiler(new ExpressionCompiler()) .SetIdProvider(new IntegerIdProvider()) .FunctionRepository.LoadModule(new BuiltInFunctions()); }); try { var sw = new Stopwatch(); sw.Start(); var chain = new CalculationChain.CalculationChainBuilder(_parsingContext).Build(); foreach (var cell in chain.Cells) { var result = ParseAt(cell.Address); try { _excelDataProvider.SetCellValue(cell.Address, result); } catch { } } sw.Stop(); } catch { } }
public FormulaParser(ExcelDataProvider excelDataProvider, ParsingContext parsingContext) { parsingContext.Parser = this; parsingContext.ExcelDataProvider = excelDataProvider; parsingContext.NameValueProvider = new NameValueProvider(excelDataProvider); parsingContext.RangeAddressFactory = new RangeAddressFactory(excelDataProvider); _parsingContext = parsingContext; _excelDataProvider = excelDataProvider; Configure(configuration => { configuration .SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)) .SetGraphBuilder(new ExpressionGraphBuilder(excelDataProvider, _parsingContext)) .SetExpresionCompiler(new ExpressionCompiler()) .SetIdProvider(new IntegerIdProvider()) .FunctionRepository.LoadModule(new BuiltInFunctions()); }); try { var sw = new Stopwatch(); sw.Start(); var chain = new CalculationChain.CalculationChainBuilder(_parsingContext).Build(); foreach (var cell in chain.Cells) { var result = ParseAt(cell.Address); try { _excelDataProvider.SetCellValue(cell.Address, result); } catch { } } sw.Stop(); } catch { } }