How can we avoid the 'Unexpected token' exception while using formula in XlsIO?
(Views :1863)

While using formula in XlsIO the following exception may occur:

Syncfusion.XlsIO.Implementation.Exceptions.ParseException "Unexpected token.Unexpected token type: Identifier, string value: at position 7. Formula: SUM(A1;B2), Position: 7"

This issue occurs if a different regional setting is used other than English. You may need to set separator to workbook before assigning formula depending upon your current UI culture. The below code is used for setting separators:

C#
IWorkbook workbook = applicationWorkbooks.Create(1);
IWorksheet sheet = book.Worksheets[ 0 ];
workbook.SetSeparators('';'', '','');
sheet.Range["H10"].Formula = "=SUM(A1;B2)";
VB
Dim workbook As IWorkbook = applicationWorkbooks.Create(1)
Dim sheet As IWorksheet = book.Worksheets(0)
workbook.SetSeparators(";", ",")
sheet.Range("H10").Formula = "=SUM(A1;B2)"
::adCenter::