а

Problem with Excel Export - returned empty file


#1

Hi All,

I’m trying to export to excel by using Dhtmlx gantt.exportToexcel method and it returned empty file.
var json = gantt.serialize();
gantt.exportToExcel({
data:json,
});
Can you please help me to find out the root cause of this issue.

Thanks,
Anuj kumar dixit


#2

Hello Anuj,
gantt.exportToExcel() function has the data parameter, although it is not documented. And it doesn’t work as expected. The columns with the templates will be empty when you export them. It will be fixed in the future.
Now, you can specify the data by using this command:

var json = gantt.serialize().data;
gantt.exportToExcel({
  data:json,
});

#3

thanks for reply. I have used same method as well but tasks indented is not clear Parent/Child relationship in excel. As it is mentioned in the below example. https://docs.dhtmlx.com/gantt/samples/08_api/08_export_other.html

If you check this example by clicking on export to excel button. it will give you the right excel sheet with Parent/Child relationship in excel. When i’m trying with below method. Tasks indented is not clear Parent/Child relationship in excel.

let config = { open_tree_initially: true };
config = this.defaults(config, {
name: “gantt.xlsx”,
data: this.gantt._serialize_table(config).data,
columns: this.gantt._serialize_columns({ rawDates: true }),
version: this.gantt.version,
server: “http://localhost:8199
});
this.gantt._send_to_export(config, “excel”);

I don’t know what configuration. i have missed.


#4

Hello Anuj,
Please, do not create duplication questions in different places.
Let’s continue our discussion here: