Gantt Excel Export column not exporting all columns as soon as I add columns

On gantt export, it is exporting all columns if i try:

gantt.exportToExcel({
   name:exportFileName,
   date_format: "mm/dd/YYYY"
});

However, if I try to add columns, it is exporting only the first columns (text / title)

gantt.exportToExcel({
   name:exportFileName,
   columns:[
       { id:"text",  header:"Title", width:150 },
       { id:"start_date",  header:"Start date", width:250, type:"date" },
       { id:"end_date",  header:"End date", width:250, type:"date" },
       { id:"duration",  header:"Duration", width:250 },
       { id:"change_in_due_date",  header:"Delay", width:250 },
       { id:"progress",  header:"Process", width:250 },
      ],
   date_format: "mm/dd/YYYY"
});

This is one issue, and another issue is that one of my column value is exporting html text, and I would like to format it before exporting.

For example, it is exporting currently as <span class=''>0</span>

I would like to export only 0, form here.

Hello,

On gantt export, it is exporting all columns if i try:
However, if I try to add columns, it is exporting only the first columns (text / title)

I couldn’t reproduce that issue in the following snippet:
https://snippet.dhtmlx.com/bbv6469u

It may look as if there is only one column, but the issue here is with the large width of the columns. The 120 value is not the size in pixels. Excel measures the sizes differently.
You can see what actually happens in the following video:
https://files.dhtmlx.com/30d/601d189049e157acb3ae358ec030256e/simplescreenrecorder-2022-12-05_14.51.26.mp4

Also, you need to specify the type: "number" parameter for the duration column.


This is one issue, and another issue is that one of my column value is exporting html text, and I would like to format it before exporting.
For example, it is exporting currently as 0
I would like to export only 0, form here.

Right now, there is no way to change how it works. The dev team will fix that issue, but I cannot give you any ETA.
As a workaround, you can redefine the column configuration before exporting the data, then revert the changes:
https://snippet.dhtmlx.com/feep3zl8

I have followed the last approached, you mentioned on your reply, however, it is just returning the empty column, my exact config.columns look like this:

           { name: "change_in_due_date", label: "Delay", width: 60, align: "center", resize: true, hide:"{{$ganttUserColPreference->delay}}" == 1 ? false: true, template: function(task){
                    let textColorClass = "";
                    if(task.change_in_due_date !== 0){
                        if(task.change_in_due_date > 0){
                            textColorClass = 'text-danger font-weight-bold';
                        }else{
                            textColorClass = 'text-success';
                        }
                    }
                    return "<span class='"+textColorClass+"'>"+task.change_in_due_date+"</span>"
               }},

and my export function looks like this:

           const backupColumns = gantt.copy(gantt.config.columns);
           gantt.config.columns[4].template = function(task){
               console.log(task.change_in_due_date);
              return task.change_in_due_date;
           }
           gantt.exportToExcel({
               name:exportFileName,
               date_format: "mm/dd/YYYY"
           });
           gantt.config.columns = backupColumns;
           gantt.render();

However, this column is returning empty.

Hello,
I added your configuration to the snippet, but I cannot reproduce the issue:
https://snippet.dhtmlx.com/w17hqtzi

It is hard to suggest what might be wrong as I don’t see your code.
Please add your configuration to the snippet and make sure that the issue is reproduced there. Then, click on the Save button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

Could you check this issue, https://snippet.dhtmlx.com/0a1ie5g5 I have tried to replicate one here.

Hello,
The template function in the columns parameter in the exportToExcel function doesn’t have any effect. It doesn’t work the same way as in the gantt.config.columns parameter. The dev team will add it in the future, but I cannot give you any ETA.
And as you didn’t specify the type of the column, it returns an empty value. You need to use the Number type for that column:

type: "number

As I suggested in the previous message, you need to redefine the column configuration (in the gantt.config.columns parameter), export the data, then revert the changes.
Here is the updated snippet:
https://snippet.dhtmlx.com/t2ebubtx