We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set date format

Thread ID:





123844 Apr 26,2016 12:28 PM UTC Apr 27,2016 01:47 PM UTC ASP.NET Web Forms 1
Tags: XlsIO
gaurav singh
Asked On April 26, 2016 12:28 PM UTC

I want to set date format "mm-dd-yy" to excel entire column of IWorksheet, and date fileld containing value like "01/30/16". After writing excel file i open file and checked date field there is no formatting applied. Same issue with number field.Following is code please have a look and help me out.

         Dim cIndex As Integer = 0
                Dim rIndex As Integer = 0

                For Each dc In dtExport.Columns
                    cIndex = cIndex + 1
                    sheet.Range(1, cIndex).Text = dc.ColumnName
                For Each dr In dtExport.Rows
                    rIndex = rIndex + 1
                    cIndex = 0
                    For Each dc In dtExport.Columns
                        cIndex = cIndex + 1
                        sheet.Range(rIndex + 1, cIndex).Text = dr(dc.ColumnName).ToString()

                For Each column In formattedColumns
                    For Each sheetColumn As IRange In sheet.Columns
                        If sheetColumn.DisplayText = column.Name Then
                            If column.DataType.ToLower() = "datetime" Then
                                sheetColumn.CellStyle.NumberFormat = "mm/dd/yy"
                                sheetColumn.DateTime = Date.Parse(DateTime.Now)
                            ElseIf column.DataType.ToLower() = "currency" Then
                                sheet.Range().NumberFormat = DataHelper.GetSafeStr(column.DataFormat)
                            End If
                            Exit For
                        End If



Abirami Varadharajan [Syncfusion]
Replied On April 27, 2016 01:47 PM UTC

Hi Gaurav, 
Thank you for contacting Syncfusion support. 
We are unable to reproduce the reported issue from our side. We have prepared the sample based on the given code example and shared it for your reference which can be downloaded from the following link. 
Kindly share us the issue reproducing file or modified sample to reproduce the issue, which will be helpful for us to provide you a prompt solution at the earliest. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon