Hello,
i have an issue with the Infragistics3.Excel.v10.3 (2128 atm) engine. A Customer is using our implementation to import a Excel 2007 file, with a formula =IF(A2>0;A2;B2-(B2*C2/100)) to calculate a price. But in the cell.value the calculated result from A2=nothing, B2=12,97, C2=31,0 is something like -2.714 if i transfer the calculation to another cell, so that the formula is =IF(A2>0;A2;D2) and D2=B2-(B2*C2/100) it calculates the correct value of 8,9493.
So is there an issue with the engine or am i doing something wrong?
I cannot reproduce the issue with build 2128. Here is the code I used:
CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();cultureInfo.NumberFormat.NumberDecimalSeparator = ",";Thread.CurrentThread.CurrentCulture = cultureInfo;
Workbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets.Add("Sheet1");worksheet.GetCell("B2").Value = 12.97;worksheet.GetCell("C2").Value = 31;WorksheetCell cell = worksheet.GetCell("A1");cell.ApplyFormula("=IF(A2>0;A2;B2-(B2*C2/100))");Console.WriteLine(cell.Value);Console.Read();
The result is see if 8,9493. Can you provide a small sample which reproduces the issue?
here is a sample. The first value i get is -2.723,7 the second is the correct of 8,9493
Ok, I think I found the problem here. In the file with your sample, cells S2 and T2 have numeric values but they are stored as text. When you do arithmetic operations with these kinds of values in Excel, they are parsing the text value into a number using the current culture. We must be erroneously parsing the number using the invariant culture, so a value like "12,97" is being parsed to 1297 instead of 12.97. So to work around this until we implement a fix, you can change those cells to store numeric values instead of text value.
I have forwarded this post to the Developer Support Manager and a DS engineer will be contacting you about this issue.
Okay, thank you. I will forward your workaround to our customer.
I will be happy to help you out with this issue.
I have created case # CAS-84021-GPJX97 for you to better assist you with this issue going forward. To access the case, simply log into your IG account and click on My Support Activity.
Please let me know if you have further questions in this matter utilizing the case created.