Excel Export feature of Data Grid not keeping the Date column formatting

                <e-column field="someDate" headerText="Some Date"
                textAlign="center" width=140
                type='date' format='MMM dd, yyyy'></e-column>

3 Replies

MA Mohammed Ansar Sathik Ali Syncfusion Team June 1, 2022 04:30 PM UTC

Hi Wei Cheng,


Greetings from Syncfusion support.


Query: Excel Export feature of Data Grid not keeping the Date column formatting


We analyzed your query, we suspect that you are providing the date format as  format='MMM dd, yyyy. please provide the format in the following method to avoid the issue


<template>

  <div id="app">

    <ejs-grid

      ref="grid"

      id="Grid"

      :dataSource="data"

      height="400px"

      :toolbar="toolbarOptions"

      :allowExcelExport="true"

      :toolbarClick="toolbarClick"

    >

      <e-columns>

        <e-column

          field="OrderDate"

          headerText="Order Date"

          textAlign="Right"

          :format="formatOptions"

          type="date"

          width="120"

        ></e-column>

      </e-columns>

    </ejs-grid>

  </div>

</template>

<script>

  data() {

    return {

      data: gridData,

      formatOptions: { type: "date", format: "MMM/dd/yyyy" },

      toolbarOptions: ["ExcelExport"],

    };

  },


Sample: https://codesandbox.io/s/vue-template-forked-3iu2l9?file=/src/App.vue


Please get back to us if you need further assistance on this.


Regards,

Mohammed Ansar ,



WC Wei Cheng June 1, 2022 05:36 PM UTC

Hi, Mohammed:


I tried your approach but it didn't help, I did get it format properly using excelQueryCellInfo, so we will be using that for now.


Ideally the ExcelExport should be like what is rendered on screen. Otherwise it will be cause a lot of extra code when there are many such date columns.


Thanks,


Wei






MA Mohammed Ansar Sathik Ali Syncfusion Team June 2, 2022 01:26 PM UTC

Hi Wei Cheng,


Thanks for your update.


We are pleased to hear that you were able to resolve the problem.


Please contact us again if you require any additional assistance.


Regards,

Mohammed Ansar ,


Loader.
Up arrow icon