Date Format in Cell

Posted by: anand-r on 8 September 2017, 3:03 pm EST

  • Posted 8 September 2017, 3:03 pm EST

    Team

    When i copy a date in format of 12/5/2012, the system gives me an error which in text (red).  But spread wants it in format of 12/05/2012. Is there a way for the system to fix this itself?  For example input of 12/5/2012 would be self corrected to 12/05/2012 and so forth.

     

    Please gives us suggestions.

    Thanks

    Anand R 

  • Replied 8 September 2017, 3:03 pm EST

    Hello,

    I was not able to reproduce the issue at my end related to the copy paste of the date values, with the latest version of Spread i.e Spread.Net6 v6.0.xx06. If no format is explicitly set for DateTimeCellType then it would use the regional settings to set the DateTimeFormat in the cell. In case you are looking for self corrected value then I would suggest you to define a user defined format for the DateTimeCellTYpe, so that the input dtae is formatted in the desired format. Here is the code snippet to achieve the format defined above:

                FarPoint.Win.Spread.CellType.DateTimeCellType dct = new FarPoint.Win.Spread.CellType.DateTimeCellType();
                dct.UserDefinedFormat = "MM/dd/yyyy";
                dct.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined;
                fpSpread1.Sheets[0].Columns[0].CellType = dct;

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels