Formatting a number in excel export depennding on user settings

Posted on 2014-08-22
Last Modified: 2014-08-25
Hi all,

We have an application that, as part of its functionality, exports a GridView to Excel.

The issue we have is that the language of the server is set to a specific value, say French, but the user logging in is on a British set PC, so, when the export to excel happens, the formatting of numbers is incorrect.

There are two possibilities that we can think of:

1) To use some kind of JavaScript to set the formatting based on the users browser settings.

2) Against the users log in account, set a format value and add it to the session so that when they export, the format is picked up and applied.

What do you think, is one option better/quicker/easier than the other or are there other possibilities?

Thank you.

Question by:resourcesys
    LVL 14

    Accepted Solution

    I can't give you a specific answer without knowing the details of how your server is set up (what scripting language you're using, etc.), but in general terms, you should detect the Locale of the user when they log in, and then use that Locale for all their interactions in session. That'll make sure that if there are any other places that are Locale-dependent (or if you later add such functionality), you won't have to keep changing the script every time.

    Author Comment

    Hi btdownloads7,

    I have taken your advice (sort of) and will use a user setting that is kept on the session. When an export to excel is performed, any number fields will be formatted to the culture set on the session.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction (All good things must come to an end ( The original MySQL API ( has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all curre…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript … provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
    Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now