We host our web forms app on a Windows server.
We utilize SpreadSheetGear to write formulas to cells and allow the user to download the workbook.
We determine the list separator by the Server culture (this is a problem).
We service customers in USA and Latin America.
All this adds up to us providing the wrong List Separator for Latin America machines. The server culture doesn't match the user culture, so SpreadSheetGear throws an Invalid Formula error when we try to .Formula a cell with an improper separator.
I can't find a way to get the separator from the local machine. Accept-Language on the HTTP header passes me multiple languages with weighted values, but this is still guesswork.
My solution was to create a workbook and try to write to a cell on that new workbook. If it fails, the separator is a comma, otherwise, it's a semi-colon.
The concern with this logic is that we call ExcelValueSeparator often, and each time we do, we'd be creating and disposing of a new workbook, worksheet, etc. We're concerned about speed.
I've attached a screenshot of my new logic.
Does anyone here have a better way to accomplish this without guesswork? Are our speed concerns here warranted?