Author Topic: Maintain the date format in Excel Export  (Read 361 times)

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Maintain the date format in Excel Export
« on: March 27, 2023, 11:00:41 am »
Hi Paramvir,

I am trying to bind a pqGrid with date columns. I have mentioned the dataType property as a date for the respective columns. Also, I am formatting the date in the "dd-M-yy, D" format.

The grid is binding properly and showing data as per the given format. But when I try to export the grid in Excel, the generated files lost the data format for the date columns.

For your reference, I'm attaching screenshots. One is with the grid with properly formatted data and the other is after the export.

Kindly provide the solution.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Maintain the date format in Excel Export
« Reply #1 on: March 27, 2023, 12:40:00 pm »
you need to mention the format in the column definition e.g.,

Code: [Select]
{ title: "Shipped Date", width: 100, dataIndx: "ShippedDate", dataType: "date", format: 'dd-M-yy, D' },

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Re: Maintain the date format in Excel Export
« Reply #2 on: March 27, 2023, 01:17:06 pm »
Hi Paramvir,

As earlier mentioned, I have applied the format property in the colModel object.

I am facing issues with the Excel Export..
Whenever I export the grid in Excel format, the exported date columns are not in the provided format.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Maintain the date format in Excel Export
« Reply #3 on: March 27, 2023, 02:08:58 pm »
It works fine in the exported Excel in this example: https://paramquery.com/pro/demos87/export

Please share a small reproducible issue on jsfiddle if still facing issues.

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Re: Maintain the date format in Excel Export
« Reply #4 on: March 27, 2023, 03:30:17 pm »
Hi Paramvir,

Thanks for the reply. I understand the issue.