Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Identifier Expected

$
0
0
Hello,

I am trying to copy information from one area of a ClosedXML sheet to another. I have the following setup:

Sheet1 is just data - as extracted from sql server (using ClosedXML - getting this happening was awesome; thank you MDeLeon).


On Sheet2 are a number of "='Sheet1'!<CellRef>" formulas (where <CellRef> is the A1 style reference for the cell).


I am trying to copy the information in those cells Sheet2 cells to a different range on Sheet2 using the following:
double sourceValue = ws.Cell("B12").GetDouble();
ws.Cell("B32").Value = sourceValue;
According to my understanding of the 'Evaluating a Formula' functionality, this should work, and give me the value of the cell (as a double). Please correct me if I have got this wrong.

However I am getting an 'Identifier Expected' exception on the double sourceValue = ... line with the following stacktrace:
   at ClosedXML.Excel.CalcEngine.CalcEngine.Throw(String msg)
   at ClosedXML.Excel.CalcEngine.CalcEngine.GetToken()
   at ClosedXML.Excel.CalcEngine.CalcEngine.ParseExpression()
   at ClosedXML.Excel.CalcEngine.CalcEngine.Parse(String expression)
   at ClosedXML.Excel.CalcEngine.ExpressionCache.get_Item(String expression)
   at ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression)
   at ClosedXML.Excel.CalcEngine.CellRangeReference.GetValue(IXLCell cell)
   at ClosedXML.Excel.CalcEngine.CellRangeReference.GetValue()
   at ClosedXML.Excel.CalcEngine.XObjectExpression.Evaluate()
   at ClosedXML.Excel.CalcEngine.Expression.op_Implicit(Expression x)
   at ClosedXML.Excel.CalcEngine.BinaryExpression.Evaluate()
   at ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression)
   at ClosedXML.Excel.XLWorksheet.Evaluate(String expression)
   at ClosedXML.Excel.XLCell.get_Value()
   at ClosedXML.Excel.XLCell.TryGetValue[T](T& value)
   at ClosedXML.Excel.XLCell.GetValue[T]()
   at ClosedXML.Excel.XLCell.GetDouble()
   at LGFinance.ViewModel.MainViewModel.InsertExpenditureWorkings(IXLWorksheet sheet, Int32 startRow)
What have I done wrong? :-)

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>