3

We have a Syncfusion GridControl that contains formulae like: IF(R2<>0,100*(R3-R2)/R2,0)

These formulae work fine in the grid and the formulae calculation engine gives the correct results whatever regional settings/number formats we have on the PC concerned (e.g. English, French, Hungarian).

They also work perfectly when we use the XlsIO GridtoExcel function to create Excel files under English regional settings.

However, we get errors of the type below when we attempt to use GridtoExcel under regional settings like French and Hungarian that use a semi-colon argument separator in Excel:

Unexpected token.Unexpected token type: tNumber, string value: ,0 at position 24. Formula: IF(R2<>0,100*(R3-R2)/R2,0), Position: 26

We have tried to use the SetSeparators function, but it has no effect (as recommended in the KB article)

Any ideas on the correct approach here? Unfortunately the documentation on SetSeparators isn't too helpful here.

Many thanks

Richard

Richard B
  • 304
  • 6
  • 14
  • I had numerous problems trying to use Syncfusion. Lots of "Attempted to read protected memory" errors, which is strange as I thought it was supposed to all be managed. If you don't have much joy I can suggest other tools to do the job. – Ian Jan 28 '10 at 09:07
  • I've actually managed to workaround this by temporarily setting the current culture to en-US while creating the workbook. I then reset it afterwards. My.Application.ChangeCulture('en-US') Awaiting a more elegant solution from Syncfusion themselves, as the SetSeparators issue is believed to be a bug – Richard B Jan 28 '10 at 18:46

1 Answers1

2

The SetSeparators() method was set for WorkBook alone. For Grid, you can specify the separators in GridFormulaEngine. The GridFormulaEngine considers the culture ‘en-US’ as a default culture. For the other cultures, the ParseDecimalSeparator and ParseArgumentSeparator properties have to be set explicitly along with the SetSeparators() method. Here is the code,

 GridFormulaEngine.ParseDecimalSeparator = char.Parse(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);

 GridFormulaEngine.ParseArgumentSeparator = char.Parse(CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator);

Regards, Christo.

christo issac
  • 440
  • 3
  • 12