Ticket T320595
Visible to All Users

Spreadsheet - Numeric value is considered as DateTime when Spanish culture is applied.

created 9 years ago (modified 9 years ago)

Hi,
I'm using Devexpress v15.1 MVC

I have problem with SpreadSheet culture, i'm using cultures "es-ES".
spreadsheet1.Document.Options.Culture = new System.Globalization.CultureInfo("es-ES");

I put 1.1 in a cell  the value cell is 01/en but if i put 1.13 the value cell is 1.13 , Why?

In culture "es-ES" the following formula    =TEXTO(D4;"0,00E+00")  don't work show #VALOR and value cell D4 is 10000
but in culture "en" the following formula  =TEXT(D4, "0.00E+00") work.

I'm using default Riboon
settings.RibbonMode = SpreadsheetRibbonMode.Ribbon;
This Ribbon have option "Protect Sheet"

Thanks.

Answers approved by DevExpress Support

created 9 years ago

Hello Juan,

When a specific culture is applied, default separators (decimal, date and time separators, etc.) are changed. In the Spanish culture, NumberDecimalSeparator is comma and DateSeparator is dot. Thus, when you type "1.1", it is considered as a DateTime value. In order to input a numeric value, use a comma as a separator, i.e. type "1,1".

As for the second issue, I've moved it to a separate ticket and passed it to our R&D team: Spreadsheet - Formula is not parsed correctly when Spanish culture is applied.
We need to perform additional research on this matter. We will inform you once we have results.

    Comments (3)

      Hello Helen,
      So Cann't I use 1.1 in my application?
      I can use 1.1 en my application using this:
      settings.PreRender = (s, e) =>
             {
                 MVCxSpreadsheet spreadsheet1 = (MVCxSpreadsheet)s;
                 spreadsheet1.Document.Options.Culture = new System.Globalization.CultureInfo("es");
                 spreadsheet1.Document.Options.Culture.NumberFormat.NumberDecimalSeparator = ",";
                 spreadsheet1.Document.Options.Culture.DateTimeFormat.MonthDayPattern = "dd-mmm";
             }
      but When I import a file's previous settings are lost .
      Thanks.

        How can i run PreRender when  I select a file ? Becouse if i run PreRender i can change culture.
        Thanks,

        Alessandro (DevExpress Support) 9 years ago

          Hi,

          1. I have tested the code you provided. It works correctly in the scenario you described. I mean that the number format is applied instead of the date format even when a new document is opened. There is a chance that some other part of your code makes an impact.

          2. I believe that you can use the SettingsBase.Init event. It is raised when a new file is opened. I have prepared a small code example that illustrates this approach in action. I hope reviewing it will help you find a solution to this problem. If this does not help, please update my sample to illustrate the problem. Then, I will see what is going wrong and do my best to find a solution.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.