Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4695
Export to excel and Ultragrid -- (repost due to error)
posted

Dear all,

(1) If I export the ultragrid to the excel using document exporter, how to make datetime field to be only date format in excel, instead withing time format.

(2) How to make below picture strange items disappear??

  • 20872
    Suggested Answer
    Offline posted

    Hello rchiu5hk,

    I have been looking into this forum thread and you could do the steps below in order to achieve what you are looking for:

    1. In order to export just the Date part you should set the CellFormat in your Worksheet to the desired one, in a CellExported event like:

            private void ultraGridExcelExporter1_CellExported(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.CellExportedEventArgs e)
            {
                if (e.GridColumn.Key == "Your dateTime column key")
                    e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].CellFormat.FormatString = "mm/dd/yyyy";
            }

     2. In order to remove the RowSelectors from your UltraGrid, you could use the InitializeLayout event of the UltraGrid to do so like:

            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                e.Layout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
            }

    Please feel free to let us know if you have any other questions with this matter