We have a Razor Page the use localization in Spanish (culture 'en') and English (culture: 'en')
Where we run the following code with culture in English, everything runs fine, but if changed the culture to Spanish I receive an error reading the calculated value in Cell E1 and E2: ""Input string was not in a correct format." If I set the formula with a negative a get th error "NaN"
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Setting values to the cells
sheet.Range["A1"].Number = (double)LoanAmount;
sheet.Range["B1"].Number = (double)LoanRate / 12;
sheet.Range["C1"].Number = MonthlyPayment;
sheet.Range["A2"].Number = (double)(LoanAmount - AditionalPayment);
sheet.Range["B2"].Number = (double)LoanRate / 12;
sheet.Range["C2"].Number = MonthlyPayment;
//Setting formula in the cell
sheet.Range["D1"].Formula = "=NPER(B1,-C1,A1)";
sheet.Range["E1"].Formula = "=CUMIPMT(B1,D1,A1,1,D1,0)";
sheet.Range["D2"].Formula = "=NPER(B2,-C2,A2)";
sheet.Range["E2"].Formula = "=CUMIPMT(B2,D2,A2,1,D2,0)";
sheet.EnableSheetCalculations();
CurrentMonthsPayoff = Convert.ToInt16(Math.Ceiling(Convert.ToDecimal(sheet["D1"].CalculatedValue)));
TotalCurrentInterest = Convert.ToInt16(Convert.ToDecimal(sheet["E1"].CalculatedValue));
AditionalMonthsPayoff = Convert.ToInt16(Math.Ceiling(Convert.ToDecimal(sheet["D2"].CalculatedValue)));
TotalAditionalInterest = Convert.ToInt16(Convert.ToDecimal(sheet["E2"].CalculatedValue));
}
Hi Arsenio,
Greetings from Syncfusion.
We are checking the query and will get back to you with details on October 26th, 2022.
Regards,
Keerthi.
Hi Arsenio,
We appreciate your patience.
We are able to reproduce the reported issues and validating them currently. We will share the validation details on October 28th, 2022.
Regards,
Keerthi.
Hi Arsenio,
We regret for the inconvenience.
We are facing complexity in finding the root cause of the issue and request you one more business day timeline. We will share the details on October 31st, 2022.
Regards,
Keerthi.
Hi Arsenio,
We appreciate your patience.
We have confirmed the issue as CUMIPMT formula return incorrect result while using different culture and logged a defect report. We will include the fix of this issue in our weekly NuGet release scheduled for November 15th, 2022. You can track the status of defect report through following feedback link.
Track Status: https://www.syncfusion.com/feedback/38712/cumipmt-formula-return-incorrect-result-while-using-different-culture
Regards,
Keerthi.
Sorry for the delay, Arsenio.
We have included the fix to resolve the issue, CUMIPMT formula return incorrect result while using different culture in our weekly NuGet release version 20.3.0.58. Kindly upgrade to this latest version and let us know if the issue is resolved.
Latest NuGet Package: https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core/20.3.0.58