Our blazing fast Grid component built with pure JavaScript


Post by it-lab@tesar.it »

Hello,
I'm here to ask for support with this issue. I need to export my grid to Excel, and it contains fields of type strings, numbers, and dates. For the first two, I have no issues; once I create the Excel table, they are recognized correctly with their types, text, and numbers. However, this is not the case for dates. Once tabulated, they are still recognized as text and lose all their date-specific characteristics that make them useful. Do you know how to provide me with support? These are some pieces of my code.

Attachments
Features.PNG
Features.PNG (32.76 KiB) Viewed 385 times
Export.PNG
Export.PNG (11.08 KiB) Viewed 385 times
excel.PNG
excel.PNG (55.15 KiB) Viewed 385 times

Post by alex.l »

Hi,

Will it be recognized as Date if you used default date format that Excel understands as Date?

All the best,
Alex


Post by it-lab@tesar.it »

Hi Alex,
Thanks for the quick answer, but no, I tried these types of date format and noone is recognized correctly:
YYYY-MM-DD
DD-MM-YYYY
dd-mm-yyyy
Removing also the DateFormat in the excelExport Feature

Any suggestion? It's a blocking activity sadly...

Thanks


Post by ghulam.ghous »

Hi,

I have checked the feature and with the person who wrote this feature and unfortunately we do not support the date type in the excel export. The reason for this is, it is still an experimental feature and it was built looking back to zipcelx API. Later we figured out that whole idea of zipcelx was simple as possible export and there was no support for styles and data types. So it turns out we are still using zipcelx to export the grid into excel.

So what you can do here is copy sources of excelExporter feature, look out for a more powerful frontend library which supports everything like date types etc and integrate it with our Scheduler api's to get data.

Regards,
Ghous


Post by it-lab@tesar.it »

Thanks for answering,

it's ok, but so, let me ask one more question. I alredy tried using a new library, named exceljs, but I'm having trouble in order to obtain the correct datas for columns and rows. Can you tell me the correct data source to utilize if I'm using a ganttComponent? For the columns I'm using "visible columns", but for the rows it seems way harder obtaining the cell, there is a simple objet who wrap up the complete row?

Thanks,
Have a good day


Post by ghulam.ghous »

Hi,

Apologies for late response. I have checked and export function is available on TableExporter class that returns the data -> both columns and rows. The date is returned as object in the row data. Here's the docs https://bryntum.com/products/grid/docs/api/Grid/util/TableExporter#function-export. You need to do something like this:

const exporter = new TableExporter({target: grid})

And then you can call the export func to get the data. You can pass your config to it as well:

const data = exporter.export()

See the clip: https://drive.google.com/drive/folders/1NyL0M-i30OB3gyYvK8w4zIvvrarvAeUk?usp=sharing

Regards,
Ghous


Post Reply